Docs Home

Account and tokens

The account an API token belongs to, and the token itself. GET /v1 needs no token, so it also serves as a health check. See Authentication for how tokens and scopes work.

On this page: Account object, Token object, Show the API's version and links, Show the token's account, Show the calling token, Revoke the calling token.

The Account object

FieldTypeDescription
idstringThe account's slug. Never changes.
namestringThe account's name.
contact_email_overridestring or nullWhen set, the only address that gets cluster notifications and billing email. null to use the default.
created_atstring (date-time)When it was created.
{
  "id": "acme",
  "name": "Acme",
  "contact_email_override": null,
  "created_at": "2024-03-12T09:30:00Z"
}

The Token object

FieldTypeDescription
keystringThe token's public half: <key> in bonsai_<key>_<secret>. The dashboard lists tokens by it.
namestring or nullThe token's name, or null.
accountobjectThe account the token belongs to.
account.idstringThe account's ID.
account.namestringThe account's name.
scopesarray of stringsThe scopes the token holds. See Scopes.
expires_atstring (date-time) or nullnull for a token that never expires.
created_atstring (date-time)When it was created.
{
  "key": "1a2b3c4d5e6f7a8b",
  "name": null,
  "account": { "id": "acme", "name": "Acme" },
  "scopes": ["account:read", "clusters:read", "clusters:write", "credentials:read"],
  "expires_at": null,
  "created_at": "2026-10-26T14:00:00Z"
}

Show the API's version and links

GET /v1

  • Token: none needed.

Needs no token, so it also serves as a health check. Rate-limited by IP address.

Example request

curl https://api.bonsai.io/v1/

Response

200 OK. The API's name, version and links.

FieldTypeDescription
namestringBonsai API.
versionstringThis contract's info.version.
docs_urlstring (URL)The API reference.
openapi_urlstring (URL)This contract as JSON.
tokens_urlstring (URL)The dashboard's API Tokens page, where a token is made by hand. It names no account: it opens the signed-in person's default account.
{
  "name": "Bonsai API",
  "version": "1.0.0",
  "docs_url": "https://bonsai.io/docs/api/",
  "openapi_url": "https://api.bonsai.io/v1/openapi.json",
  "tokens_url": "https://app.bonsai.io/api_tokens"
}

Errors

StatusCodes
429rate_limited

Show the token's account

GET /v1/account

  • Scope: account:read

What the dashboard's account settings show every member. No billing or payment details.

Example request

curl https://api.bonsai.io/v1/account \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

200 OK. The account. Returns an Account object.

{
  "id": "acme",
  "name": "Acme",
  "contact_email_override": null,
  "created_at": "2024-03-12T09:30:00Z"
}

Errors

Show the calling token

GET /v1/token

  • Scope: none. Any valid token can call it.

Its key, scopes and expiry. Needs no scope; a token only ever reaches itself.

Example request

curl https://api.bonsai.io/v1/token \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

200 OK. The token. Returns a Token object.

{
  "key": "1a2b3c4d5e6f7a8b",
  "name": null,
  "account": { "id": "acme", "name": "Acme" },
  "scopes": ["account:read", "clusters:read", "clusters:write", "credentials:read"],
  "expires_at": null,
  "created_at": "2026-10-26T14:00:00Z"
}

Errors

Revoke the calling token

DELETE /v1/token

  • Scope: none. Any valid token can call it.

As revoking it in the dashboard does. Needs no scope; a token only ever reaches itself. Every later request with it is a 401.

Example request

curl -X DELETE https://api.bonsai.io/v1/token \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

204 No Content. Revoked.

Errors

Ready to power your search with AI?

Launch a fully managed Elasticsearch or OpenSearch cluster, with built-in vector search and AI capabilities.

Create an AI Ready Search Cluster
Calming Bonsai waves