143 docs
Reference

External API

Service-account API authentication, scopes, idempotency, rate limits, and endpoint coverage.

The external API uses /api/v1 resource paths with service-account Bearer tokens. Create tokens from Settings -> API keys.

API keys are built for CI systems, internal tools, and coding agents. Each key belongs to a durable integration identity. Each secret token under that integration is disposable and shown only once.

Authentication

Send the token in Authorization:

curl https://your-143.example.com/api/v1/sessions \
  -H "Authorization: Bearer 143_live_..." \
  -H "143-Version: 2026-06-01"

Recommended headers:

HeaderRequiredNotes
Authorization: Bearer <token>YesUse the one-time token value copied from Settings.
Content-Type: application/jsonFor JSON bodiesRequired for JSON POST and PATCH requests.
Idempotency-KeyFor retried POST requestsRequired by well-behaved automation for create/run operations.
143-VersionRecommendedLogged for client compatibility and debugging.

Disabled integrations, revoked tokens, expired tokens, missing scopes, and source IPs outside a token allowlist cannot authenticate.

Creating Keys

Admins create keys in Settings -> API keys:

  1. Name the integration, for example Cursor, GitHub Actions, or Deploy bot.
  2. Choose Full external API access or Custom access.
  3. Optionally restrict repositories.
  4. Choose an expiration.
  5. Optionally restrict source IP addresses or CIDR ranges.
  6. Copy the one-time token into a secret manager.

The token value is never shown again. Rotate by creating a replacement token under the same integration, deploying it, and revoking the old token.

Scopes

Use the narrowest scope set that lets the caller do its job.

ScopeAllows
sessions:readList sessions and read session details, logs, messages, threads, usage, diffs, previews, and related read-only session resources.
sessions:createCreate sessions through POST /api/v1/sessions.
sessions:writeSend session or thread messages and retry session work.
sessions:cancelCancel or end sessions and threads.
sessions:publishCreate PRs or branches from sessions.
sessions:allAll current session scopes above.
automations:readList automations and read automation details, runs, and stats.
automations:createCreate automations through POST /api/v1/automations.
automations:writeEdit, pause, resume, or delete automations.
automations:runTrigger automation runs.
automations:allAll current automation scopes above.
previews:readList and read previews.
previews:createCreate previews through POST /api/v1/previews.
previews:stopStop or restart previews.
previews:allAll current preview scopes above.

There is no global wildcard scope. The dashboard's Full external API access preset expands to explicit operation scopes.

Repository Restrictions

Tokens can be limited to repository IDs. An empty repository list means all repositories in the organization. When a request names or resolves a repository, the token must be allowed for that repository.

Source IP Restrictions

Tokens can be limited to source IPs or CIDR ranges:

203.0.113.10/32
198.51.100.7
2001:db8::/32

An empty IP allowlist means any source IP is accepted.

Idempotency

Send Idempotency-Key on retried POST requests. Keys are scoped to the API client, method, and path, and retained for 24 hours.

Idempotent POST routes:

RouteScope
POST /api/v1/sessionssessions:create or sessions:all
POST /api/v1/sessions/{id}/messagessessions:write or sessions:all
POST /api/v1/sessions/{id}/retrysessions:write or sessions:all
POST /api/v1/sessions/{id}/cancelsessions:cancel or sessions:all
POST /api/v1/sessions/{id}/endsessions:cancel or sessions:all
POST /api/v1/sessions/{id}/prsessions:publish or sessions:all
POST /api/v1/sessions/{id}/branchsessions:publish or sessions:all
POST /api/v1/automationsautomations:create or automations:all
POST /api/v1/automations/{id}/runautomations:run or automations:all
POST /api/v1/automations/{id}/pauseautomations:write or automations:all
POST /api/v1/automations/{id}/resumeautomations:write or automations:all
POST /api/v1/previewspreviews:create or previews:all
POST /api/v1/previews/{id}/stoppreviews:stop or previews:all
POST /api/v1/previews/{id}/restartpreviews:stop or previews:all

Example:

curl https://your-143.example.com/api/v1/sessions \
  -X POST \
  -H "Authorization: Bearer 143_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: deploy-2026-06-01-001" \
  -d '{
    "message": "Fix the failing deployment check",
    "repository_id": "00000000-0000-0000-0000-000000000000",
    "metadata": {"caller": "deploy-bot", "deployment_id": "dep_123"}
  }'

Reusing a key with different request content returns 409 IDEMPOTENCY_KEY_REUSED.

Rate Limits

Rate limits are per token:

Request kindLimit
Reads: GET, HEAD, OPTIONS600 requests per minute
Mutations: every other method120 requests per minute

Responses include:

HeaderMeaning
X-RateLimit-LimitLimit for the current bucket.
X-RateLimit-RemainingRequests remaining in the current minute.
X-RateLimit-ResetUnix timestamp when the bucket resets.
Retry-AfterSeconds to wait after 429 RATE_LIMITED.

Errors

Errors use the standard API envelope:

{
  "error": {
    "code": "FORBIDDEN",
    "message": "API token is missing required scope",
    "details": {
      "required_scope": "sessions:create"
    }
  }
}

Common external API errors:

HTTPCodeMeaning
401UNAUTHORIZEDMissing, invalid, expired, or revoked token.
403FORBIDDENToken is missing the required scope or route is not external-API enabled.
409IDEMPOTENCY_KEY_REUSEDSame idempotency key was reused with different content.
429RATE_LIMITEDToken exceeded its read or mutation budget.

Endpoint Coverage

Only routes in this table accept external API tokens. Other protected app/admin routes return 403 FORBIDDEN.

RouteMethodsRequired scopeFamily scope
/api/v1/sessionsGETsessions:readsessions:all
/api/v1/sessions/{id} and nested read routesGETsessions:readsessions:all
/api/v1/sessionsPOSTsessions:createsessions:all
/api/v1/sessions/{id}/messagesPOSTsessions:writesessions:all
/api/v1/sessions/{id}/retryPOSTsessions:writesessions:all
/api/v1/sessions/{id}/cancelPOSTsessions:cancelsessions:all
/api/v1/sessions/{id}/endPOSTsessions:cancelsessions:all
/api/v1/sessions/{id}/prPOSTsessions:publishsessions:all
/api/v1/sessions/{id}/branchPOSTsessions:publishsessions:all
/api/v1/automationsGETautomations:readautomations:all
/api/v1/automations/{id} and nested read routesGETautomations:readautomations:all
/api/v1/automationsPOSTautomations:createautomations:all
/api/v1/automations/{id}PATCH, DELETEautomations:writeautomations:all
/api/v1/automations/{id}/pausePOSTautomations:writeautomations:all
/api/v1/automations/{id}/resumePOSTautomations:writeautomations:all
/api/v1/automations/{id}/runPOSTautomations:runautomations:all
/api/v1/previews and nested preview read routesGETpreviews:readpreviews:all
/api/v1/previewsPOSTpreviews:createpreviews:all
/api/v1/previews/{id}/stopPOSTpreviews:stoppreviews:all
/api/v1/previews/{id}/restartPOSTpreviews:stoppreviews:all

Sessions

Create a session:

{
  "message": "Investigate the checkout error",
  "repository_id": "00000000-0000-0000-0000-000000000000",
  "target_branch": "main",
  "agent_type": "codex",
  "metadata": {
    "caller": "support-workflow",
    "ticket_id": "SUP-123"
  }
}

Required scope: sessions:create or sessions:all.

Automations

Create an automation:

{
  "name": "Nightly dependency review",
  "goal": "Review dependency updates and open pull requests for safe upgrades.",
  "repository_id": "00000000-0000-0000-0000-000000000000",
  "schedule": {
    "type": "cron",
    "cron": "0 2 * * *",
    "timezone": "UTC"
  },
  "identity": {"scope": "org"},
  "metadata": {
    "caller": "platform",
    "workflow_id": "deps-nightly"
  }
}

Required scope: automations:create or automations:all. External API automations must use identity.scope=org.

Previews

Create a preview:

{
  "repository_id": "00000000-0000-0000-0000-000000000000",
  "branch": "main",
  "source": {
    "type": "automation",
    "external_id": "nightly-preview"
  }
}

Required scope: previews:create or previews:all.

Coding Agents

For coding agents and automation runners:

  • Store the token in the platform secret manager, not in prompts or repository files.
  • Send Idempotency-Key for every retried POST.
  • Set metadata.caller and a stable workflow or run identifier on create requests.
  • Prefer family scopes such as sessions:all for agents that operate within one product area.
  • Prefer repository restrictions for single-repository agents.
  • Use 143-Version so logs identify the client behavior during debugging.

Schema And OpenAPI

The canonical schema is the route behavior documented here and the JSON examples above. If generated OpenAPI output is unavailable in your deployment, coding agents should use this page, /llms.txt, and the raw docs route at /api/docs/raw/reference/external-api as the source of truth.

On this page