Skip to content

API Reference

Use the API when you need code-level control.

The Agent execution APIs use four related resources:

  1. define versioned Agents
  2. create stateful Sessions and exchange events
  3. expose Agents through callable Endpoints
  4. create a Schedule through the Deployments API and inspect DeploymentRuns and linked Sessions

Common APIs

AreaUse it forStart here
ModelsCall LLM, image, audio, video, and embedding modelsChat Completions
Task costsPoll recent async model task settlement, final cost, estimates, and usageGet Task Cost
AgentsCreate and version reusable Agent definitionsAgents API
SessionsRun an Agent statefully and exchange eventsSessions API
EndpointsPublish and invoke an Agent over RESTEndpoints API
DeploymentsSchedule or manually trigger repeatable Agent workDeployments API
DeploymentRunsInspect each Deployment trigger and its nullable Session resultDeploymentRuns
SkillsCreate and manage reusable Agent instruction bundlesSkills API
WebhooksReceive notifications when async work completes or failsWebhooks

Task cost lookup is intended for recent task-level settlement polling. Older task execution records may be archived and become unavailable from this endpoint; use billing records or billing exports for long-term reconciliation.

Authentication

Most API requests use a SandBase API key:

http
Authorization: Bearer sk-sb-YOUR_KEY

Some Anthropic-compatible clients use:

http
x-api-key: sk-sb-YOUR_KEY

Learn more: Authentication.

Resource relationships

  • An Agent is configuration and does not execute by itself.
  • A Session is a stateful Agent execution. Input and output are persisted as Session events.
  • A Service is backed by an Endpoint resource. Calling POST /v1/endpoints/{id}/run creates or continues a Session.
  • A Schedule is managed through a Deployment resource and stores repeatable input with an optional cron expression. Every trigger creates a drun_* DeploymentRun and, on success, a new linked Session.

Next steps