Get the CLI grant behind the credential
Returns what the person who approved this CLI credential consented to: the teams it may act on, the scopes it holds per team, and any project or environment restriction. This is what varsafe whoami prints.
GET
/me/cliResponses
200Success.
accountobjectrequiredShow propertiesHide properties
userIdstringrequiredemailstring<email>requirednamestring | nullrequiredgrantobjectrequiredShow propertiesHide properties
idstring<uuid>requirednamestring | nullrequiredcreatedAtstring<date-time>requiredlastUsedAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anylastUsedIpstring | nullrequiredexpiresAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anyteamsobject[]requiredShow propertiesHide properties
Array of
objectteamIdstring<uuid>requiredteamNamestringrequiredscopesstring[]requiredprojectSelectionstringrequiredAllowed:
allsubsetenvironmentSelectionstringrequiredAllowed:
allsubset400The request failed validation. `field` names the offending input.
statusCodeintegerrequiredHTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequiredStable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequiredHuman-readable explanation. Wording may change.
fieldstringThe offending request field, present on validation failures.
401No credential was presented, or it is invalid or revoked.
statusCodeintegerrequiredHTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequiredStable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequiredHuman-readable explanation. Wording may change.
fieldstringThe offending request field, present on validation failures.
403The credential is valid but lacks the required scope, role or team access.
statusCodeintegerrequiredHTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequiredStable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequiredHuman-readable explanation. Wording may change.
fieldstringThe offending request field, present on validation failures.
404The resource does not exist, or is not visible to this credential.
statusCodeintegerrequiredHTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequiredStable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequiredHuman-readable explanation. Wording may change.
fieldstringThe offending request field, present on validation failures.
429Rate limited. Retry after the interval named in the response.
statusCodeintegerrequiredHTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequiredStable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequiredHuman-readable explanation. Wording may change.
fieldstringThe offending request field, present on validation failures.
500Unexpected server error. The body never carries internal detail.
statusCodeintegerrequiredHTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequiredStable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequiredHuman-readable explanation. Wording may change.
fieldstringThe offending request field, present on validation failures.
Request
curl -X GET "https://api.varsafe.dev/me/cli"const response = await fetch("https://api.varsafe.dev/me/cli", {
method: "GET"
});import requests
response = requests.get(
"https://api.varsafe.dev/me/cli",
)Response
{
"account": {
"userId": "string",
"email": "<email>",
"name": "string"
},
"grant": {
"id": "<uuid>",
"name": "string",
"createdAt": "2024-01-01T00:00:00Z",
"lastUsedAt": "2024-01-01T00:00:00Z",
"lastUsedIp": "string",
"expiresAt": "2024-01-01T00:00:00Z",
"teams": [
{
"teamId": "<uuid>",
"teamName": "string",
"scopes": [
"secrets:read"
],
"projectSelection": "all",
"environmentSelection": "all"
}
]
}
}{
"statusCode": 0,
"code": "string",
"message": "string",
"field": "string"
}{
"statusCode": 0,
"code": "string",
"message": "string",
"field": "string"
}{
"statusCode": 0,
"code": "string",
"message": "string",
"field": "string"
}{
"statusCode": 0,
"code": "string",
"message": "string",
"field": "string"
}{
"statusCode": 0,
"code": "string",
"message": "string",
"field": "string"
}{
"statusCode": 0,
"code": "string",
"message": "string",
"field": "string"
}