Create, read, rename and delete the account's clusters, and change
their plans. Creating, deleting and changing a plan are slow, so they
start an Action and answer 202 at once.
A cluster's connection details are its
credentials.
On this page: Cluster object, List the account's clusters, Create a cluster, Show a cluster, Rename a cluster, Delete a cluster, Change a cluster's plan.
The Cluster object
| Field | Type | Description |
|---|---|---|
id | string | The slug. Never changes, never reused. |
name | string | A label; can change and isn't unique. |
state | string | One of draft, provisioning, ready, failed, read_only, disabled, deprovisioning, deprovisioned. More may be added. draft: created in the dashboard and never provisioned. read_only and disabled win over ready. |
plan | object or null | null only for a draft. |
plan.id | string | The plan's ID. |
plan.name | string | The plan's name. |
region | object | The region the cluster runs in. |
region.id | string | The region's ID, such as aws-us-east-1. |
region.name | string | The region's name. |
space | object or null | Set only for private placement. |
space.id | string | The space's ID. |
space.name | string | The space's name. |
release | object | The engine and version the cluster runs. |
release.id | string | The release's ID, such as opensearch-3.8.0. |
release.name | string | The release's name. |
single_tenant | boolean | Whether the cluster runs on servers of its own. |
host | string or null | null until provisioned. |
port | integer | The port to connect on. |
stats | object | From the last index-stats poll. All null until the first poll; never a fake 0. |
stats.docs | integer or null | Documents in the cluster. |
stats.shards | integer or null | Shards in the cluster. |
stats.bytes | integer or null | Bytes the cluster uses on disk. |
stats.polled_at | string (date-time) or null | When the stats were taken. |
stats.limits | object or null | null when the plan has no resource limits on record. |
stats.limits.docs | integer or null | The most documents the plan allows. |
stats.limits.shards | integer or null | The most shards the plan allows. |
stats.limits.bytes | integer or null | The most disk the plan allows, in bytes. |
stats.limits.daily_bandwidth_bytes | integer or null | The most bandwidth the plan allows a day, in bytes. |
latest_action | object or null | The cluster's most recent Action. null if it has none. |
latest_action.id | string | The Action's ID. |
latest_action.type | string | One of cluster.provision, cluster.deprovision, cluster.change_plan, cluster.read_only, cluster.disable, cluster.enable. More may be added. |
latest_action.state | string | One of new, running, success, error. More may be added. |
dashboard_url | string (URL) | The cluster's page in the dashboard. |
created_at | string (date-time) | When the cluster was created. |
terminated_at | string (date-time) or null | When the cluster was deleted. null while it exists. |
List the account's clusters
GET /v1/clusters
- Scope:
clusters:read
Newest first. Terminated clusters are not listed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
limit | query | integer | Page size. Defaults to 25. |
cursor | query | string | The next_cursor of the previous page. Opaque. |
name | query | string | Case-insensitive substring of the name. |
region | query | string | Region ID. |
space | query | string | Space ID (private placement only). |
single_tenant | query | boolean | Only clusters on servers of their own (true), or only shared ones (false). |
state | query | string | One of the cluster states. |
Example request
Response
200 OK. A page of Cluster objects in data, with next_cursor. See Pagination.
Errors
| Status | Codes |
|---|---|
400 | invalid_parameter |
401 | unauthorized |
403 | missing_scope |
429 | rate_limited, too_many_failed_authentications |
Create a cluster
POST /v1/clusters
- Scope:
clusters:write - Starts: a
cluster.provisionAction - Idempotent: with an
Idempotency-Keyheader. See Retrying safely.
Poll the Action; its result names the cluster and its first credential.
Unless the account is billed by invoice, a paid plan needs a payment method
on file. Without one this is refused at once with 422 payment_method_required, before any Action starts, so the same
Idempotency-Key works once a card is added. The problem's action_url
is a Stripe Checkout page where a person adds one, no Bonsai login needed.
A card added there becomes the account's default within seconds, once
Stripe tells Bonsai; repeat the request then.
Billing starts before the cluster is built, during this request. If
Stripe refuses the charge, this is 422 payment_failed, with the same
kind of action_url; nothing is built, and the same Idempotency-Key
works once a card is added. If the build fails after the 202, billing
stops and the Action fails with action_failed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Key | header | string | 1 to 255 printable ASCII characters. Kept for 24 hours. See Retrying safely. |
Body
Without space, the cluster goes on shared infrastructure in region.
An unknown or unavailable plan, region, space or release is 422 validation_failed naming the field, as is an Enterprise plan that
needs its own servers, which Bonsai support provisions. Enterprise plans
on shared servers can be created here. A field this schema doesn't list,
or one that isn't a string, is 400 invalid_parameter.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The cluster's name. A label, which needn't be unique. |
plan | string | Yes | Plan ID. |
region | string | Yes | Region ID, e.g. aws-us-east-1. |
space | string | No | Private space ID. Must be in region. |
release | string | No | Release ID, one of the plan's releases in region (its offers). Defaults to the first of them the space can place. |
Example request
Response
202 Accepted. Provisioning started. Returns an Action object.
| Header | Description |
|---|---|
Location | The Action'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. |
Retry-After | Set while the Action is new or running. Seconds to wait before polling it again. |
Errors
Show a cluster
GET /v1/clusters/{cluster_id}
- Scope:
clusters:read
Terminated clusters are still shown, with state deprovisioned.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
Example request
Response
200 OK. The cluster. Returns a Cluster object.
Errors
| Status | Codes |
|---|---|
401 | unauthorized |
403 | missing_scope |
404 | not_found |
429 | rate_limited, too_many_failed_authentications |
Rename a cluster
PATCH /v1/clusters/{cluster_id}
- Scope:
clusters:write
Synchronous. To change the plan, start a cluster.change_plan Action with POST /v1/clusters/{cluster_id}/plan_changes.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The cluster's new name. |
Example request
Response
200 OK. The renamed cluster. Returns a Cluster object.
Errors
| Status | Codes |
|---|---|
400 | invalid_json, body_required, invalid_parameter |
401 | unauthorized |
403 | missing_scope |
404 | not_found |
422 | validation_failed |
429 | rate_limited, too_many_failed_authentications |
Delete a cluster
DELETE /v1/clusters/{cluster_id}
- Scope:
clusters:write - Starts: a
cluster.deprovisionAction - Idempotent: with an
Idempotency-Keyheader. See Retrying safely.
name must equal the cluster's
current name exactly, as a confirmation. Send an Idempotency-Key to
retry safely: without one, a retry after the cluster is terminated gets
422 cluster_terminated instead of the Action.
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. |
name | query | string | Required. The cluster's current name, as confirmation. |
Example request
Response
202 Accepted. Deprovisioning started. Returns an Action object.
| Header | Description |
|---|---|
Location | The Action'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. |
Retry-After | Set while the Action is new or running. Seconds to wait before polling it again. |
Errors
Change a cluster's plan
POST /v1/clusters/{cluster_id}/plan_changes
- Scope:
clusters:write - Starts: a
cluster.change_planAction - Idempotent: with an
Idempotency-Keyheader. See Retrying safely.
Changes on shared servers take seconds; on dedicated ones, minutes.
Unless the account is billed by invoice, moving to a paid plan needs a payment method
on file. Without one this is refused at once with 422 payment_method_required, before any Action starts, so the same
Idempotency-Key works once a card is added. The problem's action_url
is a Stripe Checkout page where a person adds one, no Bonsai login needed.
A card added there becomes the account's default within seconds, once
Stripe tells Bonsai; repeat the request then.
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 change the plan's tier can't make (see each plan's tier) is 422 plan_change_refused.
| Field | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | Plan ID. |
Example request
Response
202 Accepted. Plan change started. Returns an Action object.
| Header | Description |
|---|---|
Location | The Action'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. |
Retry-After | Set while the Action is new or running. Seconds to wait before polling it again. |
Errors
Ready to power your search with AI?
Launch a fully managed Elasticsearch or OpenSearch cluster, with built-in vector search and AI capabilities.