The Bonsai API supports Bearer authentication over TLS >= 1.2, sending an API token as it is in the Authorization header.
With Bearer authentication, each request carries an Authorization header with the word Bearer, a space, and the token. The token takes one of two forms, depending on when it was created.
Tokens in the bonsai_ format
Send a token created in the bonsai_<key>_<secret> format exactly as the dashboard showed it:
Authorization: Bearer bonsai_<key>_<secret>
For example, with curl:
Tokens created before the bonsai_ format
A token created before the bonsai_ format has a separate key and secret. Join them with a dot:
Authorization: Bearer <key>.<secret>
For example, with curl:
The same key and secret also work with Basic authentication.
Notes
Beareris not case-sensitive, but the token is.- Send only the token after
Bearer: no quotes, and nothing after it. - Send one credential per request. A header with more than one credential, such as a Basic and a Bearer credential together, is refused with an HTTP 401: Unauthorized error.
Ready to power your search with AI?
Launch a fully managed Elasticsearch or OpenSearch cluster, with built-in vector search and AI capabilities.