> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a deployment

> Manually trigger a deployment run.

`POST /api/v1/cloud/deployments/{id}/run`

Manually triggers a deployment run. The deployment must be in `active` status (not paused or archived). If CAS cannot create a session for the run, the returned Deployment Run has `session_id: null` and an `error` object.

## Path parameters

| Parameter | Type   | Description                          |
| --------- | ------ | ------------------------------------ |
| `id`      | string | Deployment ID with the `dep_` prefix |

## Headers

| Header          | Required | Description         |
| --------------- | -------- | ------------------- |
| `Authorization` | Yes      | `Bearer $QODER_PAT` |
| `Content-Type`  | Yes      | `application/json`  |

## Request body

No request body is required. Send an empty JSON object `{}` or omit the body.

## Example request

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/deployments/dep_019ec556114c78f8b60ee34fcb98bf59/run" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json"
```

## Example response

**HTTP 200 OK**

Returns a Deployment Run object.

```json theme={null}
{
  "agent": {
    "id": "agent_019eb4d4a06d747c865d5800b9c57ae2",
    "type": "agent",
    "version": 1
  },
  "created_at": "2026-06-14T08:54:06Z",
  "deployment_id": "dep_019ec556114c78f8b60ee34fcb98bf59",
  "error": null,
  "id": "drun_019ec55694c07f2a9b402ffb4448ec18",
  "session_id": "sess_019ec55694c47605a8904c8f3d842ccb",
  "trigger_context": {
    "type": "manual"
  },
  "type": "deployment_run"
}
```

## Response fields (Deployment Run)

| Field             | Type           | Description                                                                                                  |
| ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------ |
| `id`              | string         | Run unique identifier (`drun_` prefix)                                                                       |
| `type`            | string         | Always `"deployment_run"`                                                                                    |
| `deployment_id`   | string         | Parent Deployment ID                                                                                         |
| `agent`           | object         | Agent reference: `{id, type, version}`                                                                       |
| `error`           | object or null | Error details (`{message, type}`) when the run failed to create a session; null when `session_id` is present |
| `trigger_context` | object         | Trigger source: `{"type": "manual"}` or `{"type": "schedule", "scheduled_at": "..."}`                        |
| `session_id`      | string or null | Associated Session ID. Public rows expose exactly one of `session_id` or `error`.                            |
| `created_at`      | string         | Record creation time (ISO 8601)                                                                              |

## Errors

| HTTP | Type                   | Trigger                                          |
| ---- | ---------------------- | ------------------------------------------------ |
| 401  | `authentication_error` | PAT invalid or expired                           |
| 404  | `not_found_error`      | Deployment does not exist                        |
| 409  | `conflict_error`       | Deployment is archived or not in `active` status |

See [Errors](/cloud-agents/api/conventions/errors) for the full error envelope.

## Related

<CardGroup cols={2}>
  <Card title="Get a deployment run" icon="code" href="/cloud-agents/api/deployments/get-run">
    Inspect the status and session ID of a single run.
  </Card>

  <Card title="List deployment runs" icon="clock" href="/cloud-agents/api/deployments/list-runs">
    View the run history of this deployment.
  </Card>

  <Card title="List all runs" icon="layer-group" href="/cloud-agents/api/deployments/list-all-runs">
    Query run history across all deployments.
  </Card>

  <Card title="Get a deployment" icon="rocket" href="/cloud-agents/api/deployments/get">
    Inspect deployment configuration and next scheduled time.
  </Card>
</CardGroup>
