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.

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

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.