Back to Docs

API Reference

Create and manage AI agents programmatically using the GoPilot API.

Base URL: https://api.gopilot.dev/v1

Authentication

Include your API key in the X-API-Key header:

X-API-Key: gopt_live_your_key_here

For OpenAI SDK compatibility, you can also use Authorization: Bearer gopt_live_...

Getting an API Key

  1. Sign in to gopilot.dev
  2. Go to Account → API Keys
  3. Click Create New Key and choose your scopes
  4. Copy the key immediately — it starts with gopt_live_ and won't be shown again

Scopes

FieldTypeDescription
agents:readscopeList and read agent details, logs
agents:writescopeCreate, update, start, stop, restart agents
agents:deletescopeDelete agents
usage:readscopeRead usage and cost metrics

Quickstart

Create your first agent with a single API call:

curl -X POST https://api.gopilot.dev/v1/agents \
  -H "X-API-Key: gopt_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Bot",
    "model": "anthropic/claude-sonnet-4-6",
    "description": "Handles customer support",
    "llm_keys": [
      { "provider": "anthropic", "api_key": "sk-ant-..." }
    ]
  }'

The agent starts provisioning immediately and returns once running (~10s). Poll GET /v1/agents/:id to check status.

Endpoints

Click any endpoint to expand its documentation.

Agent Runtimes

GoPilot supports two agent runtimes, selectable via runtime_kind on create. Both runtimes share the same v1 API surface; differences are mostly in what runs inside the VM.

Aspectopenclaw (default)hermes
RuntimeNode.js (OpenClaw)Python (Hermes by Nous Research)
Config formatJSON (/root/.openclaw/openclaw.json)YAML (/workspace/config.yaml)
Secrets fileauth-profiles.json per agent/workspace/.env
Workspace root/root/.openclaw/workspace-main/workspace
Multi-agentYes — separate workspace dirs per agentNo — single primary agent per VM
DashboardNot applicableOptional in-VM dashboard on :9119
Model field shapeProvider-prefixed (e.g. anthropic/claude-sonnet-4-6)Bare model name (e.g. claude-sonnet-4-6)
URL prefixopenclaw-<id>.agents.gopilot.devhermes-<id>.agents.gopilot.dev

If you don't specify runtime_kind, the agent will be created as openclaw. Workspace file names, channel configs, LLM keys, and chat protocol are the same across both runtimes.

Machine Sizes

SizevCPUsMemoryUse Case
small12 GBSimple chatbots, lightweight tasks
medium24 GBGeneral purpose (default)
large28 GBMulti-channel agents, heavier workloads
xlarge416 GBComplex multi-agent systems

Supported Channels

ChannelRequired Credentials
slackappToken (Socket Mode), botToken (OAuth)
discordbotToken
telegrambotToken (from @BotFather)
whatsappNone — paired via QR code after agent is running
email (gmail)OAuth pairing — start with POST /v1/agents/:id/channels/gmail/oauth/start

Error Responses

All errors return a consistent JSON structure:

{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request",
    "message": "name is required"
  }
}
StatusTypeMeaning
400invalid_request_errorMissing or invalid field
401authentication_errorMissing or invalid API key
403authorization_errorAPI key lacks required scope
404not_found_errorAgent not found
409invalid_request_errorAgent is not running (start it first)
429rate_limit_errorToo many requests
500server_errorInternal server error

Agent Lifecycle

provisioningrunningpaused (idle) → stopped (snapshot)
  • provisioning — VM is booting and gateway is starting (~8-10s)
  • running — Agent is live and accepting requests
  • paused — Idle agent with vCPUs frozen. Instant resume.
  • stopped — VM deallocated but snapshot preserved. Fast resume (~8s).
  • error — Something went wrong. Check logs.