Docs Home

Credentials

A credential is a username and password for a cluster. Each has an access type:

Access typeWhat it allows
rwRead and write everything. Every cluster has at least one.
roRead only.
rwmThe actions in allowed_actions, from the addresses in allowed_cidrs.
aclAs rwm, limited to the indices matching allowed_index_globs.

Which types a cluster takes depends on its plan, and rwm and acl need a feature enabled on the account. Only showing or creating a single credential returns its password.

On this page: Credential object, Credential object, with its secret, List a cluster's active credentials, Create a credential, Show a credential, with its secret, Revoke a credential.

The Credential object

FieldTypeDescription
idstringIts ID. Never changes.
namestring or nullA label, or null.
access_typestringOne of rw, ro, rwm, acl. More may be added.
defaultbooleanThe cluster's default credential: its oldest active rw one, whose URL the dashboard shows as the cluster's. Exactly one of a cluster's credentials while it has an active rw one, which it does from provisioning until it's terminated, since the last one can't be revoked.
allowed_actionsarray of stringsFor rwm and acl, the actions it may take. Empty for rw and ro.
allowed_index_globsarray of stringsFor acl, the indices it may reach. Empty otherwise.
allowed_cidrsarray of stringsFor rwm and acl, the addresses it may connect from. Empty otherwise.
created_atstring (date-time)When the credential was created.
{
  "id": "scc-a8Kd",
  "name": null,
  "access_type": "rw",
  "default": true,
  "allowed_actions": [],
  "allowed_index_globs": [],
  "allowed_cidrs": [],
  "created_at": "2026-10-26T14:03:05Z"
}

The Credential object, with its secret

A credential's fields, plus its secret. Only showing or creating a single credential returns it.

FieldTypeDescription
idstringIts ID. Never changes.
namestring or nullA label, or null.
access_typestringOne of rw, ro, rwm, acl. More may be added.
defaultbooleanThe cluster's default credential: its oldest active rw one, whose URL the dashboard shows as the cluster's. Exactly one of a cluster's credentials while it has an active rw one, which it does from provisioning until it's terminated, since the last one can't be revoked.
allowed_actionsarray of stringsFor rwm and acl, the actions it may take. Empty for rw and ro.
allowed_index_globsarray of stringsFor acl, the indices it may reach. Empty otherwise.
allowed_cidrsarray of stringsFor rwm and acl, the addresses it may connect from. Empty otherwise.
created_atstring (date-time)When the credential was created.
usernamestringThe username to connect with.
passwordstringThe password to connect with. Keep it out of logs and source control.
urlstringA complete https://user:pass@host URL.
{
  "id": "scc-a8Kd",
  "name": null,
  "access_type": "rw",
  "default": true,
  "allowed_actions": [],
  "allowed_index_globs": [],
  "allowed_cidrs": [],
  "created_at": "2026-10-26T14:03:05Z",
  "username": "a8kd3x9q2m",
  "password": "7v1c8b4nq0w2e5r9",
  "url": "https://a8kd3x9q2m:7v1c8b4nq0w2e5r9@my-search-4823919.us-east-1.bonsaisearch.net"
}

List a cluster's active credentials

GET /v1/clusters/{cluster_id}/credentials

  • Scope: credentials:read

Newest first. No secrets in the list. A terminated cluster has no active credentials.

Parameters

NameInTypeDescription
cluster_idpathstringRequired. The cluster's ID, which is its slug. It never changes.
limitqueryintegerPage size. Defaults to 25.
cursorquerystringThe next_cursor of the previous page. Opaque.

Example request

curl https://api.bonsai.io/v1/clusters/my-search-4823919/credentials \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

200 OK. A page of Credential objects in data, with next_cursor. See Pagination.

{
  "data": [
    {
      "id": "scc-a8Kd",
      "name": null,
      "access_type": "rw",
      "default": true,
      "allowed_actions": [],
      "allowed_index_globs": [],
      "allowed_cidrs": [],
      "created_at": "2026-10-26T14:03:05Z"
    }
  ],
  "next_cursor": null
}

Errors

Create a credential

POST /v1/clusters/{cluster_id}/credentials

  • Scope: credentials:write
  • Idempotent: with an Idempotency-Key header. See Retrying safely.

Synchronous: the cluster's routes are updated before this answers, so an rw or ro credential works as soon as it is returned. An rwm or acl credential's permissions are then sent to the cluster in the background, and apply once that finishes. The response carries the password, as only this and GET /v1/clusters/{cluster_id}/credentials/{credential_id} do. The cluster must be ready; a Hobby cluster may have one active credential. A replay with the same Idempotency-Key returns the credential again with Idempotent-Replayed: true, or 409 idempotency_replay_unavailable once it is revoked or can't be identified.

Parameters

NameInTypeDescription
cluster_idpathstringRequired. The cluster's ID, which is its slug. It never changes.
Idempotency-Keyheaderstring1 to 255 printable ASCII characters. Kept for 24 hours. See Retrying safely.

Body

A field this schema doesn't list is 400 invalid_parameter.

FieldTypeRequiredDescription
namestringYesA label.
access_typestringYesOne of rw, ro, rwm, acl. More may be added. Required, so full access is never a default. Which types a cluster takes depends on its plan; rwm and acl also need a feature enabled for the token's owner (403 feature_not_enabled).
allowed_actionsarray of stringsNoFor rwm and acl only.
allowed_index_globsarray of stringsNoFor acl only.
allowed_cidrsarray of stringsNoFor rwm and acl only, e.g. 203.0.113.0/24.

Example request

curl -X POST https://api.bonsai.io/v1/clusters/my-search-4823919/credentials \
  -H "Authorization: Bearer $BONSAI_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name": "frontend", "access_type": "ro"}'

Response

201 Created. The new credential and its secret. Returns a CredentialWithSecret object.

HeaderDescription
LocationThe credential's URL.
Idempotent-Replayedtrue when this is the replay of an earlier request with the same Idempotency-Key, rebuilt from what it made as that is now; absent otherwise.
{
  "id": "scc-a8Kd",
  "name": null,
  "access_type": "rw",
  "default": true,
  "allowed_actions": [],
  "allowed_index_globs": [],
  "allowed_cidrs": [],
  "created_at": "2026-10-26T14:03:05Z",
  "username": "a8kd3x9q2m",
  "password": "7v1c8b4nq0w2e5r9",
  "url": "https://a8kd3x9q2m:7v1c8b4nq0w2e5r9@my-search-4823919.us-east-1.bonsaisearch.net"
}

Errors

Show a credential, with its secret

GET /v1/clusters/{cluster_id}/credentials/{credential_id}

  • Scope: credentials:read

Carries the credential's password, as only this and POST /v1/clusters/{cluster_id}/credentials do.

Parameters

NameInTypeDescription
cluster_idpathstringRequired. The cluster's ID, which is its slug. It never changes.
credential_idpathstringRequired. The credential's ID, which is its slug. It never changes.

Example request

curl https://api.bonsai.io/v1/clusters/my-search-4823919/credentials/scc-a8Kd \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

200 OK. The credential and its secret. Returns a CredentialWithSecret object.

{
  "id": "scc-a8Kd",
  "name": null,
  "access_type": "rw",
  "default": true,
  "allowed_actions": [],
  "allowed_index_globs": [],
  "allowed_cidrs": [],
  "created_at": "2026-10-26T14:03:05Z",
  "username": "a8kd3x9q2m",
  "password": "7v1c8b4nq0w2e5r9",
  "url": "https://a8kd3x9q2m:7v1c8b4nq0w2e5r9@my-search-4823919.us-east-1.bonsaisearch.net"
}

Errors

Revoke a credential

DELETE /v1/clusters/{cluster_id}/credentials/{credential_id}

  • Scope: credentials:write

Synchronous: the credential stops working on the cluster's routes before this answers. An rwm or acl credential is then removed from the cluster's permissions in the background. A revoked credential is gone from this API, so revoking it again is a 404. The last active rw credential can't be revoked (422).

Parameters

NameInTypeDescription
cluster_idpathstringRequired. The cluster's ID, which is its slug. It never changes.
credential_idpathstringRequired. The credential's ID, which is its slug. It never changes.

Example request

curl -X DELETE https://api.bonsai.io/v1/clusters/my-search-4823919/credentials/scc-a8Kd \
  -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