API reference

Execute API

Run a deployed Bothive bot from your backend, pass user context, and receive the final response plus a trace you can inspect when something fails.

Endpoint

POST /api/v1/execute

Auth

Bearer API key

Best place to call

Your backend

Authentication

Include your secret API key in the Authorization header. Do not call this endpoint directly from a browser with a secret key.

Authorization: Bearer bh_live_xxxxxxxxxxxxxxxxxxxxx

Request body

Pass the bot to run, the user message or structured input, and an optional sessionId so memory, usage limits, and traces can be grouped around the same end user.

{
  "botId": "bot_123",
  "input": {
    "message": "Help me summarize today's customer issues"
  },
  "sessionId": "customer_42",
  "metadata": {
    "source": "app-dashboard"
  }
}

Response

Successful responses include the model output and a run ID. Store the run ID when you need support, observability, retries, or audit history.

{
  "success": true,
  "runId": "run_abc123",
  "sessionId": "customer_42",
  "output": "Here are the top customer issues from today...",
  "traceUrl": "https://bothive.cloud/dashboard/runs/run_abc123"
}

Example request

curl -X POST https://bothive.cloud/api/v1/execute \
  -H "Authorization: Bearer bh_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "botId": "bot_123",
    "input": { "message": "Hello" },
    "sessionId": "customer_42"
  }'

Error shape

API failures should be handled with stable error codes, not only status text. When a run fails inside the runtime, open the trace to see what context loaded, what tool was attempted, and how to recover.

401missing_or_invalid_keyThe API key is missing, expired, or not allowed to run this bot.
403permission_deniedThe key is valid, but the workspace or agent grant does not allow this action.
404bot_not_foundThe bot ID does not exist in this workspace or has not been deployed.
429rate_limitedThe workspace, bot, or end-user session exceeded its configured limit.
500runtime_failedThe run failed after validation. Open the trace to see recovery instructions.

Next step

Read API authentication for key handling, then connect a bot to your app.

Did this page help?

Not helpfulExcellent