Skip to content
sproutboatDocs
Esc
↑↓navigate↵open⌘Jpreview

Who a key is

The team, the key and its grants. A provider calls this once to learn the team slug (for the default route <project>.<slug>.sproutboat.app) and to check that the key can do what it needs.

GET/v1/whoami
Authorization
AuthorizationBearer token · headerrequired

A team API key, sbk_..., from Settings, API keys.

or
x-api-keyAPI key · headerrequired

The same key, in a header of its own.

Responses
200

The key's identity.

kindstringrequired
organizationstringrequired

The team's id.

organization_slugstring | null

The <team> in <project>.<team>.sproutboat.app.

organization_namestring | null
keyobject
Show properties
idstring
namestring | null
startstring | null

The first characters of the key, for recognition.

permissionsobject | null

Grants by resource, for example {"app": ["read", "write"], "secret": ["list", "write"]}.

expires_atstring<date-time> | null
created_byobject | null

The team member who created the key.

Show properties
idstring
namestring
emailstring
401

No key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
429

The key is over its requests a minute (600, or 2,000 with app:write; reason: key-rate-limited, retry_after_s, Retry-After). Wait that long and retry.

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:key-rate-limited
retry_after_sintegerrequired

Seconds to wait; also the Retry-After header.

Request
curl -X GET 'https://dash.sproutboat.com/v1/whoami' \
  -H 'Authorization: Bearer YOUR_TOKEN'
Response
{
  "kind": "apikey",
  "organization": "string",
  "organization_slug": "string",
  "organization_name": "string",
  "key": {
    "id": "string",
    "name": "string",
    "start": "string",
    "permissions": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "expires_at": "2019-08-24T14:15:22Z"
  },
  "created_by": {
    "id": "string",
    "name": "string",
    "email": "string"
  }
}