Create a new Deployment that runs an Agent on a cron schedule or manually.
POST /api/v1/cloud/deployments
Creates a new Deployment. A Deployment binds an Agent to a cron schedule (or manual-only trigger), an Environment, and an initial set of events delivered at each run. The newly created deployment is in the active status and will begin firing according to its schedule immediately.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $QODER_ACCESS_TOKEN |
Content-Type | Yes | application/json |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Deployment name (max 256 characters) |
description | string | No | Human-readable description |
agent | string or object | Yes | Agent reference. Either a plain string "agent_xxx" (uses latest version) or an object {"id": "agent_xxx", "type": "agent", "version": 2} to pin a specific version. Object form must include type: "agent". |
environment_id | string | Yes | Environment ID (env_ prefix) |
schedule | object | No | Cron schedule configuration. If omitted, the deployment is manual-only (schedule will be null in response). See Schedule object below. |
initial_events | array | Yes | Array of events (1–50) delivered to the Agent on each run. Each event must have a type field. Allowed types: user.message, user.define_outcome. |
resources | array | No | Resources attached to each session (e.g., github_repository, file, memory_store). Default []. |
vault_ids | array | No | List of Vault IDs to inject credentials. Default []. Max 50. |
metadata | object | No | Custom string key-value metadata (max 16 keys, key ≤64 chars, value ≤512 chars). Values must be strings. |
environment_variables | string | No | Deployment-level environment variables to inject into sessions created by this deployment, formatted as KEY=VALUE pairs separated by ; or newlines. Not supported on self-hosted environments. |
Schedule object
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be "cron" |
expression | string | Yes | Standard 5-field cron expression (e.g., "0 9 * * *") |
timezone | string | Yes | IANA timezone (e.g., "Asia/Shanghai") |
Environment variables
environment_variables uses the same validation as Session creation: variable names must match [A-Za-z_][A-Za-z0-9_]*, reserved names/prefixes are rejected, duplicate keys are rejected, and the total payload is limited. The response returns a normalized string sorted by key and joined with newlines.
Example request
Example response
HTTP 200 OK
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Deployment unique identifier (dep_ prefix) |
type | string | Always "deployment" |
name | string | Deployment name |
description | string or null | Description |
agent | object | Agent reference: {id, type, version} |
environment_id | string | Associated Environment ID |
schedule | object or null | Schedule config with upcoming_runs_at (null for manual-only) |
schedule.expression | string | Cron expression |
schedule.timezone | string | IANA timezone |
schedule.type | string | Always "cron" |
schedule.upcoming_runs_at | array | Next 5 scheduled fire times (UTC, ISO 8601) |
schedule.last_run_at | string | Last execution time (appears after first run) |
initial_events | array | Events delivered on each run |
resources | array | Attached resources |
vault_ids | array | Associated Vault IDs |
metadata | object | Custom string key-value metadata |
environment_variables | string | Normalized KEY=VALUE lines injected into sessions created by this deployment |
status | string | "active" or "paused" |
paused_reason | object or null | Structured pause reason (e.g., {"type":"manual"}) |
archived_at | string or null | Archive timestamp (ISO 8601) or null |
created_at | string | Creation time (ISO 8601) |
updated_at | string | Last update time (ISO 8601) |
CMA alignment
This endpoint aligns with the Anthropic CMA POST /v1/deployments spec. Key differences:
- The
agentfield accepts both string and object forms (CMA requires object only). environment_variablesis a Qoder extension on deployments. It is stored on the deployment template and copied into sessions created by deployment runs.- Response includes
upcoming_runs_atin the schedule object (up to 5 future fire times).
Errors
| HTTP | Type | Trigger |
|---|---|---|
| 400 | invalid_request_error | Missing required field, object-form agent without type: "agent", invalid cron expression, invalid metadata or environment variables, unknown event type, or referenced Agent/Environment is archived |
| 401 | authentication_error | PAT or SAT invalid or expired |
| 404 | not_found_error | Agent or Environment does not exist |