Docs Home

Clusters

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

FieldTypeDescription
idstringThe slug. Never changes, never reused.
namestringA label; can change and isn't unique.
statestringOne 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.
planobject or nullnull only for a draft.
plan.idstringThe plan's ID.
plan.namestringThe plan's name.
regionobjectThe region the cluster runs in.
region.idstringThe region's ID, such as aws-us-east-1.
region.namestringThe region's name.
spaceobject or nullSet only for private placement.
space.idstringThe space's ID.
space.namestringThe space's name.
releaseobjectThe engine and version the cluster runs.
release.idstringThe release's ID, such as opensearch-3.8.0.
release.namestringThe release's name.
single_tenantbooleanWhether the cluster runs on servers of its own.
hoststring or nullnull until provisioned.
portintegerThe port to connect on.
statsobjectFrom the last index-stats poll. All null until the first poll; never a fake 0.
stats.docsinteger or nullDocuments in the cluster.
stats.shardsinteger or nullShards in the cluster.
stats.bytesinteger or nullBytes the cluster uses on disk.
stats.polled_atstring (date-time) or nullWhen the stats were taken.
stats.limitsobject or nullnull when the plan has no resource limits on record.
stats.limits.docsinteger or nullThe most documents the plan allows.
stats.limits.shardsinteger or nullThe most shards the plan allows.
stats.limits.bytesinteger or nullThe most disk the plan allows, in bytes.
stats.limits.daily_bandwidth_bytesinteger or nullThe most bandwidth the plan allows a day, in bytes.
latest_actionobject or nullThe cluster's most recent Action. null if it has none.
latest_action.idstringThe Action's ID.
latest_action.typestringOne of cluster.provision, cluster.deprovision, cluster.change_plan, cluster.read_only, cluster.disable, cluster.enable. More may be added.
latest_action.statestringOne of new, running, success, error. More may be added.
dashboard_urlstring (URL)The cluster's page in the dashboard.
created_atstring (date-time)When the cluster was created.
terminated_atstring (date-time) or nullWhen the cluster was deleted. null while it exists.
{
  "id": "my-search-4823919",
  "name": "my-search",
  "state": "ready",
  "plan": { "id": "sandbox", "name": "Sandbox" },
  "region": { "id": "aws-us-east-1", "name": "AWS US East (N. Virginia)" },
  "space": null,
  "release": { "id": "opensearch-3.8.0", "name": "OpenSearch 3.8.0" },
  "single_tenant": false,
  "host": "my-search-4823919.us-east-1.bonsaisearch.net",
  "port": 443,
  "stats": {
    "docs": 12840,
    "shards": 2,
    "bytes": 48211968,
    "polled_at": "2026-10-26T13:50:00Z",
    "limits": {
      "docs": 50000,
      "shards": 10,
      "bytes": 1073741824,
      "daily_bandwidth_bytes": null
    }
  },
  "latest_action": {
    "id": "act_3k9x0q2m7v1c8b4n",
    "type": "cluster.provision",
    "state": "success"
  },
  "dashboard_url": "https://app.bonsai.io/accounts/acme/clusters/my-search-4823919",
  "created_at": "2026-10-26T14:03:00Z",
  "terminated_at": null
}

List the account's clusters

GET /v1/clusters

  • Scope: clusters:read

Newest first. Terminated clusters are not listed.

Parameters

NameInTypeDescription
limitqueryintegerPage size. Defaults to 25.
cursorquerystringThe next_cursor of the previous page. Opaque.
namequerystringCase-insensitive substring of the name.
regionquerystringRegion ID.
spacequerystringSpace ID (private placement only).
single_tenantquerybooleanOnly clusters on servers of their own (true), or only shared ones (false).
statequerystringOne of the cluster states.

Example request

curl "https://api.bonsai.io/v1/clusters?region=aws-us-east-1&limit=10" \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

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

{
  "data": [
    {
      "id": "my-search-4823919",
      "name": "my-search",
      "state": "ready",
      "plan": { "id": "sandbox", "name": "Sandbox" },
      "region": { "id": "aws-us-east-1", "name": "AWS US East (N. Virginia)" },
      "space": null,
      "release": { "id": "opensearch-3.8.0", "name": "OpenSearch 3.8.0" },
      "single_tenant": false,
      "host": "my-search-4823919.us-east-1.bonsaisearch.net",
      "port": 443,
      "stats": {
        "docs": 12840,
        "shards": 2,
        "bytes": 48211968,
        "polled_at": "2026-10-26T13:50:00Z",
        "limits": {
          "docs": 50000,
          "shards": 10,
          "bytes": 1073741824,
          "daily_bandwidth_bytes": null
        }
      },
      "latest_action": {
        "id": "act_3k9x0q2m7v1c8b4n",
        "type": "cluster.provision",
        "state": "success"
      },
      "dashboard_url": "https://app.bonsai.io/accounts/acme/clusters/my-search-4823919",
      "created_at": "2026-10-26T14:03:00Z",
      "terminated_at": null
    }
  ],
  "next_cursor": null
}

Errors

Create a cluster

POST /v1/clusters

  • Scope: clusters:write
  • Starts: a cluster.provision Action
  • Idempotent: with an Idempotency-Key header. 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

NameInTypeDescription
Idempotency-Keyheaderstring1 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.

FieldTypeRequiredDescription
namestringYesThe cluster's name. A label, which needn't be unique.
planstringYesPlan ID.
regionstringYesRegion ID, e.g. aws-us-east-1.
spacestringNoPrivate space ID. Must be in region.
releasestringNoRelease ID, one of the plan's releases in region (its offers). Defaults to the first of them the space can place.

Example request

curl -X POST https://api.bonsai.io/v1/clusters \
  -H "Authorization: Bearer $BONSAI_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name": "my-search", "plan": "sandbox", "region": "aws-us-east-1"}'

Response

202 Accepted. Provisioning started. Returns an Action object.

HeaderDescription
LocationThe Action'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.
Retry-AfterSet while the Action is new or running. Seconds to wait before polling it again.
{
  "id": "act_3k9x0q2m7v1c8b4n",
  "type": "cluster.provision",
  "state": "success",
  "subject": { "type": "cluster", "id": "my-search-4823919" },
  "created_at": "2026-10-26T14:03:00Z",
  "finished_at": "2026-10-26T14:03:06Z",
  "error": null,
  "result": { "cluster": "my-search-4823919", "credential": "scc-a8Kd" },
  "steps": [
    {
      "state": "success",
      "message": "Placing the cluster",
      "at": "2026-10-26T14:03:01Z"
    },
    {
      "state": "success",
      "message": "Creating the first credential",
      "at": "2026-10-26T14:03:05Z"
    }
  ]
}

Errors

Show a cluster

GET /v1/clusters/{cluster_id}

  • Scope: clusters:read

Terminated clusters are still shown, with state deprovisioned.

Parameters

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

Example request

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

Response

200 OK. The cluster. Returns a Cluster object.

{
  "id": "my-search-4823919",
  "name": "my-search",
  "state": "ready",
  "plan": { "id": "sandbox", "name": "Sandbox" },
  "region": { "id": "aws-us-east-1", "name": "AWS US East (N. Virginia)" },
  "space": null,
  "release": { "id": "opensearch-3.8.0", "name": "OpenSearch 3.8.0" },
  "single_tenant": false,
  "host": "my-search-4823919.us-east-1.bonsaisearch.net",
  "port": 443,
  "stats": {
    "docs": 12840,
    "shards": 2,
    "bytes": 48211968,
    "polled_at": "2026-10-26T13:50:00Z",
    "limits": {
      "docs": 50000,
      "shards": 10,
      "bytes": 1073741824,
      "daily_bandwidth_bytes": null
    }
  },
  "latest_action": {
    "id": "act_3k9x0q2m7v1c8b4n",
    "type": "cluster.provision",
    "state": "success"
  },
  "dashboard_url": "https://app.bonsai.io/accounts/acme/clusters/my-search-4823919",
  "created_at": "2026-10-26T14:03:00Z",
  "terminated_at": null
}

Errors

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

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

Body

FieldTypeRequiredDescription
namestringYesThe cluster's new name.

Example request

curl -X PATCH https://api.bonsai.io/v1/clusters/my-search-4823919 \
  -H "Authorization: Bearer $BONSAI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "product-search"}'

Response

200 OK. The renamed cluster. Returns a Cluster object.

{
  "id": "my-search-4823919",
  "name": "my-search",
  "state": "ready",
  "plan": { "id": "sandbox", "name": "Sandbox" },
  "region": { "id": "aws-us-east-1", "name": "AWS US East (N. Virginia)" },
  "space": null,
  "release": { "id": "opensearch-3.8.0", "name": "OpenSearch 3.8.0" },
  "single_tenant": false,
  "host": "my-search-4823919.us-east-1.bonsaisearch.net",
  "port": 443,
  "stats": {
    "docs": 12840,
    "shards": 2,
    "bytes": 48211968,
    "polled_at": "2026-10-26T13:50:00Z",
    "limits": {
      "docs": 50000,
      "shards": 10,
      "bytes": 1073741824,
      "daily_bandwidth_bytes": null
    }
  },
  "latest_action": {
    "id": "act_3k9x0q2m7v1c8b4n",
    "type": "cluster.provision",
    "state": "success"
  },
  "dashboard_url": "https://app.bonsai.io/accounts/acme/clusters/my-search-4823919",
  "created_at": "2026-10-26T14:03:00Z",
  "terminated_at": null
}

Errors

Delete a cluster

DELETE /v1/clusters/{cluster_id}

  • Scope: clusters:write
  • Starts: a cluster.deprovision Action
  • Idempotent: with an Idempotency-Key header. 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

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.
namequerystringRequired. The cluster's current name, as confirmation.

Example request

curl -X DELETE "https://api.bonsai.io/v1/clusters/my-search-4823919?name=my-search" \
  -H "Authorization: Bearer $BONSAI_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

Response

202 Accepted. Deprovisioning started. Returns an Action object.

HeaderDescription
LocationThe Action'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.
Retry-AfterSet while the Action is new or running. Seconds to wait before polling it again.
{
  "id": "act_3k9x0q2m7v1c8b4n",
  "type": "cluster.provision",
  "state": "success",
  "subject": { "type": "cluster", "id": "my-search-4823919" },
  "created_at": "2026-10-26T14:03:00Z",
  "finished_at": "2026-10-26T14:03:06Z",
  "error": null,
  "result": { "cluster": "my-search-4823919", "credential": "scc-a8Kd" },
  "steps": [
    {
      "state": "success",
      "message": "Placing the cluster",
      "at": "2026-10-26T14:03:01Z"
    },
    {
      "state": "success",
      "message": "Creating the first credential",
      "at": "2026-10-26T14:03:05Z"
    }
  ]
}

Errors

Change a cluster's plan

POST /v1/clusters/{cluster_id}/plan_changes

  • Scope: clusters:write
  • Starts: a cluster.change_plan Action
  • Idempotent: with an Idempotency-Key header. 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

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 change the plan's tier can't make (see each plan's tier) is 422 plan_change_refused.

FieldTypeRequiredDescription
planstringYesPlan ID.

Example request

curl -X POST https://api.bonsai.io/v1/clusters/my-search-4823919/plan_changes \
  -H "Authorization: Bearer $BONSAI_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"plan": "standard-fir"}'

Response

202 Accepted. Plan change started. Returns an Action object.

HeaderDescription
LocationThe Action'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.
Retry-AfterSet while the Action is new or running. Seconds to wait before polling it again.
{
  "id": "act_3k9x0q2m7v1c8b4n",
  "type": "cluster.provision",
  "state": "success",
  "subject": { "type": "cluster", "id": "my-search-4823919" },
  "created_at": "2026-10-26T14:03:00Z",
  "finished_at": "2026-10-26T14:03:06Z",
  "error": null,
  "result": { "cluster": "my-search-4823919", "credential": "scc-a8Kd" },
  "steps": [
    {
      "state": "success",
      "message": "Placing the cluster",
      "at": "2026-10-26T14:03:01Z"
    },
    {
      "state": "success",
      "message": "Creating the first credential",
      "at": "2026-10-26T14:03:05Z"
    }
  ]
}

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