Docs Home

Actions

An Action is slow work on a cluster: provisioning, deprovisioning, a plan change, or a change Bonsai makes on its own. Follow one by polling it. See Actions for the states, results and failures.

On this page: Action object, Show an Action, List a cluster's Actions.

The Action object

FieldTypeDescription
idstringOpaque: act_ and 16 random characters, in no order. Never changes.
typestringOne of cluster.provision, cluster.deprovision, cluster.change_plan, cluster.read_only, cluster.disable, cluster.enable. More may be added.
statestringOne of new, running, success, error. More may be added.
subjectobjectWhat the Action acts on.
subject.typestringOne of cluster. More may be added.
subject.idstringThe cluster's ID.
created_atstring (date-time)When the Action started.
finished_atstring (date-time) or nullWhen it finished. null while it runs.
errorobject or nullWhy it failed. null unless state is error.
error.codestringOne of payment_failed, timed_out, action_failed. More may be added. Stable, snake_case. Branch on this, not on message. payment_failed: Stripe couldn't charge the account (no card, or a declined one), so billing for the cluster couldn't start; action_url says where to add a card. Only on Actions the legacy API started; a /v1 create answers it at once, as a 422. timed_out: the Action stopped making progress. action_failed: anything else, which Bonsai support can see.
error.messagestringWhat went wrong, for people. It can change, so don't parse it.
error.action_urlstring (URL)Set on payment_failed to a Stripe Checkout page for adding a card, valid for at least an hour after the response; fetch the Action again for a current one. Only a token whose owner may manage the account's billing (an Admin or Billing user) gets a Checkout page, since adding a card through it needs no Bonsai login; any other token, and any when Stripe can't be reached, gets the dashboard page where an account Admin or Billing user adds one instead. Absent otherwise.
resultobject or nullSet on success, for Actions that create something.
result.clusterstring or nullCluster ID.
result.credentialstring or nullCredential ID.
stepsarray of objectsCustomer-facing steps only; internal steps are left out.
steps[].statestringOne of new, running, success, error. More may be added.
steps[].messagestringWhat the step does.
steps[].atstring (date-time)When the step reached its state.
{
  "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"
    }
  ]
}

Show an Action

GET /v1/actions/{action_id}

  • Scope: clusters:read

Includes the customer-facing steps. While the Action runs, Retry-After says how long to wait before polling again.

Parameters

NameInTypeDescription
action_idpathstringRequired. Opaque Action ID.

Example request

curl https://api.bonsai.io/v1/actions/act_3k9x0q2m7v1c8b4n \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

200 OK. The Action. Returns an Action object.

HeaderDescription
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

List a cluster's Actions

GET /v1/clusters/{cluster_id}/actions

  • Scope: clusters:read

Newest first. Only customer-visible Action types are listed.

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/actions \
  -H "Authorization: Bearer $BONSAI_TOKEN"

Response

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

{
  "data": [
    {
      "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"
        }
      ]
    }
  ],
  "next_cursor": null
}

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