*Cloud*

# The deployment object

One build and rollout of a service. A deployment moves through queued, building, starting and live; it can also end failed, cancelled, superseded (a newer one went live) or rolled_back.

## Attributes

- `dep` (string): The deployment's id.
- `svc` (string): The service it deploys.
- `state` (string): queued, building, starting, live, failed, superseded, rolled_back or cancelled.
- `trigger` (string): manual, push (a GitHub push), redeploy, rollback or config.
- `branch` (string): The branch it was built from.
- `sha` (string): The commit it was built from.
- `created_at` (timestamp): When it was queued, Unix seconds.
- `finished_at` (timestamp): When it ended, Unix seconds, or 0 while running.
- `error_code` (string): The exact error code when it failed, such as DEPLOY_HEALTH_TIMEOUT or AGENT_OOM_KILLED; null otherwise.
- `failure_reason` (string): The kind of failure: health_check_timeout, crash_on_start, oom_on_start or other; null when it did not fail.
- `transitions` (array): Its state changes, oldest first: list of {state, at}.

## Example

```json
{
  "data": {
    "dep": "dep_01jdk4p7q9w1e3r5t7y9u1i3ob",
    "svc": "svc_01jdk3n2f4g6h8j0k2l4z6x8ca",
    "state": "live",
    "trigger": "push",
    "branch": "main",
    "sha": "3f2a9c1d8e7b6a5f4e3d2c1b0a9f8e7d6c5b4a39",
    "created_at": 1764324999,
    "finished_at": 1764325121,
    "error_code": "DEPLOY_HEALTH_TIMEOUT",
    "failure_reason": "health_check_timeout",
    "transitions": [{"state":"queued","at":1764324999},{"state":"live","at":1764325121}]
  }
}
```

## Endpoints

- `POST` [Cancel a deployment](https://docs.dispralabs.com/api/cancel-a-deployment.md)
- `POST` [Create a deployment](https://docs.dispralabs.com/api/create-a-deployment.md)
- `GET` [Get a deployment](https://docs.dispralabs.com/api/get-a-deployment.md)
- `GET` [List deployments](https://docs.dispralabs.com/api/list-deployments.md)
- `GET` [List logs](https://docs.dispralabs.com/api/list-logs.md)
- `GET` [List recent commits](https://docs.dispralabs.com/api/list-recent-commits.md)
- `GET` [Stream a deployment's logs](https://docs.dispralabs.com/api/stream-a-deployment-s-logs.md)
