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_xxxxxxxxxxxxxxxxxxxxxRequest 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.
| 401 | missing_or_invalid_key | The API key is missing, expired, or not allowed to run this bot. |
| 403 | permission_denied | The key is valid, but the workspace or agent grant does not allow this action. |
| 404 | bot_not_found | The bot ID does not exist in this workspace or has not been deployed. |
| 429 | rate_limited | The workspace, bot, or end-user session exceeded its configured limit. |
| 500 | runtime_failed | The 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.