Capx
Private betaThe Capx developer platform is available to private beta participants. Join the waitlist for access.
API Reference

API Overview

The Capx API gives you programmatic control over every aspect of your agent-run companies. Create companies, configure agents, execute playbooks, and monitor costs through a single REST interface.

Base URL

All API requests are made to the following base URL. Every endpoint described in this documentation is relative to this base.

Base URL
text
https://api.capx.ai/v1

Authentication

Authenticate every request by including your API key in the Authorization header as a Bearer token. Keys are provisioned from the Capx Casa dashboard and follow the format shown below.

Authorization Header
http
Authorization: Bearer capx_sk_live_abc123...
Warning
Never expose your secret key in client-side code or public repositories. Use environment variables and server-side calls exclusively.

For detailed guidance on key scoping, rotation, and best practices, see the Authentication page.

Response Format

Every successful response is wrapped in a standard envelope. The top-level object always contains a boolean success field, a data object with the resource payload, and a meta object with credit usage information.

Success Response
json
{
  "success": true,
  "data": {
    "id": "co_abc123",
    "name": "Acme Research",
    "status": "running"
  },
  "meta": {
    "credits_used": 12,
    "credits_remaining": 9988
  }
}
Envelope fields
successbooleanrequired
True when the request succeeded, false when it failed.
dataobject
The resource payload. Present on successful responses.
metaobject
Credit usage information for the request.
meta.credits_usedinteger
Credits consumed by this request.
meta.credits_remaininginteger
Credits remaining after this request.

Error Format

When a request fails, the response follows the same envelope but with success set to false and an error object in place of data. The error object includes a machine-readable code, a human-readable message, and a link to the relevant documentation.

Error Response
json
{
  "success": false,
  "error": {
    "code": "rate_limit_exceeded",
    "message": "You have exceeded 60 requests per minute.",
    "docs": "https://capx.ai/docs/api#rate-limits"
  }
}
Error object
error.codestring
Machine-readable error code. See the table below for every code.
error.messagestring
Human-readable description of what went wrong.
error.docsstring
Link to the relevant documentation.
HTTP StatusCodeMeaning
400invalid_requestMalformed request body or missing required fields
401unauthorizedMissing or invalid API key
403forbiddenKey does not have permission for this action
404not_foundResource does not exist
409conflictResource state conflict (e.g. pausing an already paused company)
422validation_errorRequest body failed schema validation
429rate_limit_exceededToo many requests in the current window
500internal_errorUnexpected server error

Rate Limits

Rate limits are applied per API key on a rolling one-minute window. When you exceed the limit, you will receive a 429 response. The response headers include your current usage and the time until your window resets.

PlanRequests / MinuteBurst
Starter6010 concurrent
Pro30050 concurrent
EnterpriseCustomCustom
Rate Limit Headers
http
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1716700000

Pagination

All list endpoints use cursor-based pagination. Pass a limit parameter to control the page size and use the cursor returned in the response meta to fetch the next page. When there are no more results, the cursor field will be null.

ParameterTypeDescription
limitintegerPage size. Default 25, max 100.
cursorstringCursor from the previous response meta. Null when there are no more results.
Paginated Request
bash
curl "https://api.capx.ai/v1/companies?limit=10&cursor=eyJpZCI6ImNvXzk5OSJ9" \
  -H "Authorization: Bearer capx_sk_live_abc123"
Paginated Response
json
{
  "success": true,
  "data": [ ... ],
  "meta": {
    "cursor": "eyJpZCI6ImNvXzEwMDkifQ",
    "has_more": true,
    "credits_used": 1,
    "credits_remaining": 9987
  }
}

Idempotency Keys

For any mutating request (POST, PATCH, DELETE), you can include an Idempotency-Key header to safely retry the request without creating duplicate resources. Keys are scoped to your API key and expire after 24 hours.

Idempotency Header
http
Idempotency-Key: req_unique_abc123
Tip
Use UUIDs or request-specific identifiers as idempotency keys. If a duplicate key is received, the API will return the original response without re-executing the operation.

Webhook Events

Capx can send webhook events to a URL you configure in the dashboard. Events are delivered as POST requests with a JSON body and a signature header for verification. Configure your webhook endpoint under Company Settings in the Capx Casa dashboard.

EventDescription
company.createdA new company was created
company.status_changedCompany status changed (running, paused, stopped)
agent.heartbeatAn agent completed a heartbeat cycle
agent.errorAn agent encountered an error
task.createdA new task was created
task.completedA task was completed
task.approval_requiredA task requires human approval
playbook.run_startedA playbook run began
playbook.run_completedA playbook run finished
costs.threshold_reachedSpend reached a configured threshold

Streaming (SSE)

Certain endpoints support Server-Sent Events for real-time streaming. To enable streaming, include the Accept header set to text/event-stream. The server will hold the connection open and push events as they occur.

Streaming Request
bash
curl "https://api.capx.ai/v1/companies/co_abc123/activity?stream=true" \
  -H "Authorization: Bearer capx_sk_live_abc123" \
  -H "Accept: text/event-stream"
SSE Event Format
text
event: activity
data: {"type":"agent.heartbeat","agent_id":"ag_xyz","timestamp":"2026-05-25T10:00:00Z"}

event: activity
data: {"type":"task.completed","task_id":"tsk_456","timestamp":"2026-05-25T10:00:05Z"}
Note
Streaming connections are subject to the same authentication and rate limiting as standard requests. Each SSE connection counts as one request against your rate limit at the time of connection.

API Resources

Each resource has its own reference page covering endpoints, request fields, and response examples.