A credential is a username and password for a cluster. Each has an access type:
| Access type | What it allows |
|---|---|
rw | Read and write everything. Every cluster has at least one. |
ro | Read only. |
rwm | The actions in allowed_actions, from the addresses in allowed_cidrs. |
acl | As 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
| Field | Type | Description |
|---|---|---|
id | string | Its ID. Never changes. |
name | string or null | A label, or null. |
access_type | string | One of rw, ro, rwm, acl. More may be added. |
default | boolean | The 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_actions | array of strings | For rwm and acl, the actions it may take. Empty for rw and ro. |
allowed_index_globs | array of strings | For acl, the indices it may reach. Empty otherwise. |
allowed_cidrs | array of strings | For rwm and acl, the addresses it may connect from. Empty otherwise. |
created_at | string (date-time) | When the credential was created. |
The Credential object, with its secret
A credential's fields, plus its secret. Only showing or creating a single credential returns it.
| Field | Type | Description |
|---|---|---|
id | string | Its ID. Never changes. |
name | string or null | A label, or null. |
access_type | string | One of rw, ro, rwm, acl. More may be added. |
default | boolean | The 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_actions | array of strings | For rwm and acl, the actions it may take. Empty for rw and ro. |
allowed_index_globs | array of strings | For acl, the indices it may reach. Empty otherwise. |
allowed_cidrs | array of strings | For rwm and acl, the addresses it may connect from. Empty otherwise. |
created_at | string (date-time) | When the credential was created. |
username | string | The username to connect with. |
password | string | The password to connect with. Keep it out of logs and source control. |
url | string | A complete https://user:pass@host URL. |
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
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
limit | query | integer | Page size. Defaults to 25. |
cursor | query | string | The next_cursor of the previous page. Opaque. |
Example request
Response
200 OK. A page of Credential objects in data, with next_cursor. See Pagination.
Errors
| Status | Codes |
|---|---|
400 | invalid_parameter |
401 | unauthorized |
403 | missing_scope |
404 | not_found |
429 | rate_limited, too_many_failed_authentications |
Create a credential
POST /v1/clusters/{cluster_id}/credentials
- Scope:
credentials:write - Idempotent: with an
Idempotency-Keyheader. 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
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
Idempotency-Key | header | string | 1 to 255 printable ASCII characters. Kept for 24 hours. See Retrying safely. |
Body
A field this schema doesn't list is 400 invalid_parameter.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A label. |
access_type | string | Yes | One 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_actions | array of strings | No | For rwm and acl only. |
allowed_index_globs | array of strings | No | For acl only. |
allowed_cidrs | array of strings | No | For rwm and acl only, e.g. 203.0.113.0/24. |
Example request
Response
201 Created. The new credential and its secret. Returns a CredentialWithSecret object.
| Header | Description |
|---|---|
Location | The credential's URL. |
Idempotent-Replayed | true 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. |
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
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
credential_id | path | string | Required. The credential's ID, which is its slug. It never changes. |
Example request
Response
200 OK. The credential and its secret. Returns a CredentialWithSecret object.
Errors
| Status | Codes |
|---|---|
401 | unauthorized |
403 | missing_scope |
404 | not_found |
429 | rate_limited, too_many_failed_authentications |
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
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
credential_id | path | string | Required. The credential's ID, which is its slug. It never changes. |
Example request
Response
204 No Content. Revoked.
Errors
| Status | Codes |
|---|---|
401 | unauthorized |
403 | missing_scope |
404 | not_found |
422 | validation_failed |
429 | rate_limited, too_many_failed_authentications |
Ready to power your search with AI?
Launch a fully managed Elasticsearch or OpenSearch cluster, with built-in vector search and AI capabilities.