List the caller's grants - Spacefast Docs
List the caller's grants
Returns every grant the signed-in user has authorized, newest first, each with the client that holds it, the scopes in force including temporary elevation, when it was last used, and whether it is active, expired, or revoked. Requires a browser session. Scopes stored on a grant that are missing from the current vocabulary are dropped from the response.
GET /v1/me/grants
Authorization
Authorization Bearer token · header required
Authorization: Bearer <token> with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).
Query parameters
teamId string
min length 1
Responses
200 Response for status 200
$schema string
Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
data object required
Show properties
grants object[] required
Show properties
Array of object
idstring requirednamestring requiredkindstring required- Allowed:
agent,app,cli,handoff,api-key,machine
- Allowed:
clientNamestringlogoUristringeffectiveScopesstring[] requiredscopesobject[] required
Show properties
Array of object
idstring requiredlabelstring requiredelevatedUntilstring
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$
teamScopeobject | any required
Show properties
Any of:
object
teamIdstring requiredteamNamestring required
ownerobjectidstring requirednamestring requiredemailstringrequired
matches ^(?!.)(?!...)([A-Za-z0-9_'+-.][A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9-]*.)+[A-Za-z]{2,}$
teamNamestringlastUsedAtstring| any required
Show properties
Any of:
string
any
lastUsedLabelstringstatusstring required- Allowed:
active,expired,revoked
- Allowed:
createdAtstringrequired
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$
expiresAtstringrequired
defaultError. Every 4xx and 5xx response is one RFC 9457 problem document served as application/problem+json.
$schemastringtypestring requiredtitlestring requiredstatusinteger required
min -9007199254740991 · max 9007199254740991
detailstring requiredcodestring requiredpointerstringdetailsobject- Machine-readable context keyed by the error code.
suggestionsstring[]nextstring[]requestIdstring required
Try it
Server
Base URL https://api.spacefast.com
Custom base URL Overrides the selected server when set.
Parameters
teamIdquery
Send
Request
cURL
curl -X GET "https://api.spacefast.com/v1/me/grants" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch("https://api.spacefast.com/v1/me/grants", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});
Python
import requests
response = requests.get(
"https://api.spacefast.com/v1/me/grants",
headers={
"Authorization": "Bearer YOUR_TOKEN"
},
)
Response
200 default
{
"$schema": "http://example.com",
"data": {
"grants": [
{
"id": "string",
"name": "string",
"kind": "agent",
"clientName": "string",
"logoUri": "string",
"effectiveScopes": [
"string"
],
"scopes": [
{
"id": "string",
"label": "string",
"elevatedUntil": "2019-08-24T14:15:22Z"
}
],
"teamScope": {
"teamId": "string",
"teamName": "string"
},
"owner": {
"id": "string",
"name": "string",
"email": "user@example.com"
},
"teamName": "string",
"lastUsedAt": "2019-08-24T14:15:22Z",
"lastUsedLabel": "string",
"status": "active",
"createdAt": "2019-08-24T14:15:22Z",
"expiresAt": "2019-08-24T14:15:22Z"
}
]
}
}
Error response
{
"$schema": "http://example.com",
"type": "string",
"title": "string",
"status": -9007199254740991,
"detail": "string",
"code": "string",
"pointer": "string",
"details": {
"property1": null,
"property2": null
},
"suggestions": [
"string"
],
"next": [
"string"
],
"requestId": "string"
}