The Replica API and Automations are the only sanctioned channels for programmatic use of Replicas. Scripting against the dashboard, automating the CLI, or driving interactive surfaces from headless browsers is prohibited under our Terms of Service.
Authentication
Organization admins can generate an API key from Settings > API Keys in the dashboard. Include it as a Bearer token in requests:Quick Start
1. List Available Repositories
Before creating a replica, list the repositories available in your organization:2. Create a Replica
Thename field must not contain whitespace (e.g. fix-auth-bug, not fix auth bug).
lifecycle_policy controls what happens when work is done:
default- workspace sleeps after inactivity (default)delete_when_done- workspace is deleted when the agent finishes (useful for CI/CD)delete_after_inactivity- workspace is deleted after a period of inactivity
size picks the compute envelope and per-minute price for this replica:
size | Compute | Price |
|---|---|---|
small | 2 vCPU, 8 GB memory, 20 GB disk | $0.008 / min |
large | 4 vCPU, 16 GB memory, 32 GB disk | $0.016 / min |
size to keep the legacy behaviour: the workspace inherits your org’s sandbox tier (including any team-plan auto-bump) and is billed at the standard rate. Pick small to opt into the lower per-minute price for cheap, frequent jobs; pick large for memory or CPU-bound work. Mixed fleets bill correctly; each workspace charges at its own rate.
Optional config controls per-workspace behavior. API-created replicas default to capabilities.pr_followups: true, meaning Replicas will auto-reply to CI failures and review comments on matching PRs created or touched by that workspace; set it to false for a read-only replica. Set preferences.keep_open_on_pr_merge: true when that workspace should remain open after its tracked PR merges. See Automations: Pull request management for how this default flips for automation-created workspaces.
The replica boots asynchronously and the message is delivered once ready.
3. Send a Follow-up Message
4. Check Status
include=environment to get detailed environment info, or include=diffs for full git diffs.
5. Delete a Replica
200 OK with { "success": true }. IDs that never existed or belong to another organization return 404.
6. Stream Events (SSE)
7. Webhook Callbacks (alternative to polling)
Passwebhook_url when creating a replica to receive status updates without polling:
webhook_url accepts either a bare URL string ("https://...") or an object { url, secret }.
The platform POSTs a JSON body for every event with these headers:
| Header | Description |
|---|---|
X-Replicas-Event | Event type, e.g. replica.turn_completed |
X-Replicas-Event-Id | Stable per-event ID. Reuse for idempotent processing. |
X-Replicas-Delivery | Unique delivery ID for this event delivery. Retry attempts reuse the same value. |
X-Replicas-Replica-Id | The replica’s workspace ID |
X-Replicas-Signature | sha256=<hex HMAC-SHA256(secret, raw body)> (only present when a secret is set) |
replica.ready: the workspace finished provisioning (or finished waking) and is reachable. Use this as the “your replica is ready” signal instead of pollingGET /v1/replica/:id.replica.turn_completed: the coding agent finished a turn. Payload includes per-repository branches and any newly opened PR URLs.replica.deleted: the workspace was deleted. Payload data is empty.replica.error: the workspace went into an unrecoverable terminal state. The replica is being soft-deleted; the payload includes the failure message.
replica.turn_completed body:
2xx within 10 seconds.
To verify the signature in Node:
Key Concepts
Environments
Workspaces are created from environments. Each environment can be bound to a repository or repository set and carries the runtime configuration for the workspace (variables, files, skills, MCPs, warm hooks). The full environment management surface is available via the API — see Environments API below.Chat Management
Each workspace can have multiple chat sessions with different coding agents:Queue Management
Messages queue automatically when the agent is busy. You can inspect, reorder, and remove queued messages:Plan Mode
Send a message in plan mode to get a plan before execution:Thinking Level
Control how much reasoning the agent applies withthinking_level:
| Level | Claude | Codex | Description |
|---|---|---|---|
low | low | low | Minimal thinking, fastest responses |
medium | medium | medium | Moderate reasoning depth |
high | high | high | Deep reasoning |
max | max | xhigh | Maximum effort |
high, Codex = medium.
Also supported in POST /v1/replica when creating a replica.
Images
Attach images (screenshots, diagrams) to messages:Chat History
Read the message history for a chat (replaces the deprecated/read endpoint):
Hooks
View warm and start hook execution logs:Canvas
Read files the agent drops into the workspace Canvas (~/.replicas/canvas/). Supported kinds: markdown, html, image, video, audio, other. Per-item size is capped at 5MB; use replicas media upload for anything larger.
List items:
{ filename, kind, sizeBytes }.
Get a single item:
markdown, html) return content (UTF-8 string). Binary kinds return base64. Items over the size cap return tooLarge: true with no payload.
Environments API
Environments are the primitive that ties together a repository binding plus the runtime configuration (variables, files, skills, MCPs, warm hooks) applied to every workspace created from them. See Environments for feature details. Every organization has a singleton Global environment that applies to every workspace. You can address it in any URL by passing the literal stringglobal instead of a UUID — there’s no need to look up its ID first.
List Environments
Get an Environment
Create an Environment
repository_id and repository_set_id are mutually exclusive; both can be omitted if you want an unbound environment.
Update an Environment
Delete an Environment
Variables
{environmentId} accepts global for the Global environment.
Files
Files are placed inside workspaces at the configured path. Max content size is 64 KB.PATCH / DELETE / GET shape as variables.
Skills
Skills come from skills.sh. Search the catalog, then enable a skill on a specific environment.MCPs
transport may be stdio, http, or sse. PATCH and DELETE work on /v1/environments/{environmentId}/mcps/{id}.
Warm Hooks
Each environment has at most one active warm hook (a shell script that runs while pre-warming workspaces). The Global environment’s warm hook applies to every pool.POST /v1/environments, so this PUT is only needed to disable a pool or re-enable one that was previously turned off. Existing environments are unaffected.
There are three mutation endpoints: test-only (runs without persisting), save-only (persists and activates immediately without testing), and save-and-test (persists only if the test passes). The test and save-test endpoints spin up a real isolated sandbox and run your script there. The streaming endpoint (POST .../warm-hooks/save-test/stream) returns Server-Sent Events so the connection stays alive during long-running hooks — use it instead of the synchronous save-test endpoint to avoid gateway timeouts. Events include progress (status messages), output (captured stdout/stderr), and complete (final exit_code, timed_out, and the saved warm_hook record on success). The mode field can be "save_test" (default, persists on success) or "test_only".
Start Hooks
Each environment has at most one active start hook (a shell script that runs at workspace startup, before repository-level start hooks). The Global environment’s start hook applies to every workspace. See Start Hooks for feature details.{ test: { exit_code, output, timed_out } } once the hook finishes - use it from CLI tooling and short-lived clients. The streaming endpoint emits SSE events (progress, output, complete, error) and is recommended for long-running hooks to avoid gateway timeouts. The Global environment can be addressed as "global" in any URL, no UUID lookup required.
Automations API
Automations let you trigger replicas on a schedule or in response to GitHub events. The full CRUD is available via the API. See Automations for feature details.List Automations
Create an Automation
Create a cron-triggered automation that runs every weekday at 9am:high thinking:
workspace_size picks the compute envelope (and per-minute price) for every workspace the automation fires off. Accepts small (2 vCPU, 8 GB, 20 GB; $0.008/min) or large (4 vCPU, 16 GB, 32 GB; $0.016/min). Defaults to small. The same field is accepted on PATCH /v1/automations/:id.
agent_provider, model, and thinking_level are all optional. Omit any of them to inherit the organization’s default agent and the agent’s own defaults. Valid agent_provider values are claude and codex. model must be one of the models supported by the chosen provider (e.g. opus[1m], claude-fable-5, sonnet, haiku for Claude; gpt-5, gpt-5.5, etc. for Codex). thinking_level is one of low, medium, high, max.
Optional debounce_seconds sets a per-automation debounce window (0-86400 seconds, where 0 or null disables debouncing). When greater than 0, bursty trigger events update one pending run and the latest payload fires after the automation stops receiving events for the configured window. Accepts integers or null. Defaults to null (disabled). The same field is accepted on PATCH /v1/automations/:id.
Get an Automation
Update an Automation
agent_provider, model, and thinking_level are also patchable. Send null for any field to clear the override and fall back to the default. Note that changing agent_provider without also providing a new model clears the stored model, since the previous model may not be valid for the new provider.
Delete an Automation
Manually Trigger an Automation
Only works for automations with a cron trigger:List Execution History
Workspace Lifecycle
| Status | Description |
|---|---|
preparing | Workspace is being created and initialized |
active | Workspace is running and ready for messages |
sleeping | Workspace is paused (auto-wakes on interaction) |
error | Terminal state: the underlying sandbox died unrecoverably (e.g. OOM during a heavy build). The workspace cannot be woken or messaged. See the workspaces overview for next steps. |
waking: true. When a warm pool is configured for the target repository or repository set, expect setup times under 10 seconds. Otherwise, expect 10-60 seconds depending on repository size.
POST /v1/replica/{id}/wake and the engine-proxy endpoints (messages, chats, history, canvas, logs, previews, events) return 409 Conflict when the workspace is in sleeping or error, so clients can branch on that status instead of retrying indefinitely. To distinguish the recoverable (sleeping, can wake) and terminal (error) cases, read the workspace’s status field from GET /v1/replica/:id rather than parsing the 409 body.
API Versioning
POST /v1/replica supports an optional dated version header:
| Header value | Behavior |
|---|---|
| (omitted) | Legacy. Request blocks until the workspace reaches active, then returns. Engine details are populated in the response. |
2026-05-17 | Fire-and-forget. Request returns immediately with a preparing workspace. The initial message is still delivered to the agent in the background; poll GET /v1/replica/:id or stream GET /v1/replica/:id/events to follow progress. |
Prerequisites
Before using the API:- Add your repository in the dashboard
- Configure credentials for your coding agent (Claude or Codex)
Use Cases
- CI/CD Integration - Trigger replicas from GitHub Actions or other pipelines
- Batch Operations - Create multiple replicas for parallel task execution
- Custom Workflows - Build internal tools that leverage AI coding agents
- Monitoring - Stream events and poll workspace state for dashboards