Skip to content
Esc
↑↓navigate↵open⌘Jpreview

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/cli
Authorization
AuthorizationBearer token (varsafe CLI grant) · headerrequired

An opaque, database-backed credential obtained through the device authorization grant (POST /auth/cli/device) and revocable on the spot. Presented as Authorization: Bearer <token>. A route accepts it only when it declares CLI access; the scopes it must hold are listed per operation under x-varsafe-cli-scopes.

Responses
200

Success.

accountobjectrequired
Show properties
userIdstringrequired
emailstring<email>required
namestring | nullrequired
grantobjectrequired
Show properties
idstring<uuid>required
namestring | nullrequired
createdAtstring<date-time>required
lastUsedAtstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
lastUsedIpstring | nullrequired
expiresAtstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
teamsobject[]required
Show properties
Array of object
teamIdstring<uuid>required
teamNamestringrequired
scopesstring[]required
projectSelectionstringrequired
Allowed:allsubset
environmentSelectionstringrequired
Allowed:allsubset
400

The request failed validation. field names the offending input.

statusCodeintegerrequired

HTTP status code, repeated in the body.

min -9007199254740991 · max 9007199254740991
codestringrequired

Stable machine-readable error code, e.g. SECRET_NOT_FOUND or FORBIDDEN. Branch on this, never on the message.

messagestringrequired

Human-readable explanation. Wording may change.

fieldstring

The offending request field, present on validation failures.

401

No credential was presented, or it is invalid or revoked.

statusCodeintegerrequired

HTTP status code, repeated in the body.

min -9007199254740991 · max 9007199254740991
codestringrequired

Stable machine-readable error code, e.g. SECRET_NOT_FOUND or FORBIDDEN. Branch on this, never on the message.

messagestringrequired

Human-readable explanation. Wording may change.

fieldstring

The offending request field, present on validation failures.

403

The credential is valid but lacks the required scope, role or team access.

statusCodeintegerrequired

HTTP status code, repeated in the body.

min -9007199254740991 · max 9007199254740991
codestringrequired

Stable machine-readable error code, e.g. SECRET_NOT_FOUND or FORBIDDEN. Branch on this, never on the message.

messagestringrequired

Human-readable explanation. Wording may change.

fieldstring

The offending request field, present on validation failures.

404

The resource does not exist, or is not visible to this credential.

statusCodeintegerrequired

HTTP status code, repeated in the body.

min -9007199254740991 · max 9007199254740991
codestringrequired

Stable machine-readable error code, e.g. SECRET_NOT_FOUND or FORBIDDEN. Branch on this, never on the message.

messagestringrequired

Human-readable explanation. Wording may change.

fieldstring

The offending request field, present on validation failures.

429

Rate limited. Retry after the interval named in the response.

statusCodeintegerrequired

HTTP status code, repeated in the body.

min -9007199254740991 · max 9007199254740991
codestringrequired

Stable machine-readable error code, e.g. SECRET_NOT_FOUND or FORBIDDEN. Branch on this, never on the message.

messagestringrequired

Human-readable explanation. Wording may change.

fieldstring

The offending request field, present on validation failures.

500

Unexpected server error. The body never carries internal detail.

statusCodeintegerrequired

HTTP status code, repeated in the body.

min -9007199254740991 · max 9007199254740991
codestringrequired

Stable machine-readable error code, e.g. SECRET_NOT_FOUND or FORBIDDEN. Branch on this, never on the message.

messagestringrequired

Human-readable explanation. Wording may change.

fieldstring

The offending request field, present on validation failures.

Try it
Server
Authorization
Request
curl -X GET 'https://api.varsafe.dev/me/cli' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json'
Response
{
  "account": {
    "userId": "string",
    "email": "user@example.com",
    "name": "string"
  },
  "grant": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "name": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "lastUsedAt": "2019-08-24T14:15:22Z",
    "lastUsedIp": "string",
    "expiresAt": "2019-08-24T14:15:22Z",
    "teams": [
      {
        "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",
        "teamName": "string",
        "scopes": [
          "secrets:read"
        ],
        "projectSelection": "all",
        "environmentSelection": "all"
      }
    ]
  }
}