POST /v1/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_PAT |
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. |
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, system.message. |
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 key-value metadata (max 16 keys, key ≤64 chars, value ≤512 chars). The reserved key cas_config is exempt from limits and controls CAS-specific execution parameters. |
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") |
metadata.cas_config (CAS extension)
Thecas_config key within metadata controls CAS-specific execution behavior:
| Field | Type | Default | Description |
|---|---|---|---|
session_strategy | string | "new_session" | Session reuse strategy |
config.max_retries | integer | 0 | Max retry attempts on failure |
config.timeout_ms | integer | 300000 | Run timeout in milliseconds |
config.max_concurrent | integer | 1 | Max concurrent runs |
Example request
Example response
HTTP 200 OKResponse fields
| Field | Type | Description |
|---|---|---|
id | string | Deployment unique identifier (dep_ prefix) |
type | string | Always "deployment" |
name | string | Deployment name |
description | string | 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 | Metadata including cas_config with execution config and stats |
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 CMAPOST /v1/deployments spec. Key differences:
- The
agentfield accepts both string and object forms (CMA requires object only). metadata.cas_configis a CAS extension for execution tuning (not in CMA spec), containingsession_strategy,config(retries/timeout/concurrency), andstats(run counts/timestamps).- 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, invalid cron expression, unknown event type, or referenced Agent/Environment is archived |
| 401 | authentication_error | PAT invalid or expired |
| 404 | not_found_error | Agent or Environment does not exist |
Related
List deployments
Page through all deployments under the account.
Get a deployment
Retrieve details for a single deployment.
Update a deployment
Modify name, schedule, resources, and other mutable fields.
Errors reference
All API error codes and the error envelope convention.