---
title: Deployments API
---

## Trigger Deployment

```
POST /v1/services/:serviceId/deployments
```

**Response:**
```json
{
  "id": "uuid",
  "serviceId": "uuid",
  "status": "building",
  "triggeredBy": "manual",
  "createdAt": "2026-03-28T00:00:00Z"
}
```

## Roll Back

```
POST /v1/services/:serviceId/deployments
```

Send the commit to roll back to:

```json
{
  "commitSha": "a1b2c3d..."
}
```

If a build of that commit is still stored, the rollback is instant and nothing is rebuilt. If it isn't, services built with a Dockerfile rebuild that commit, and other services return an error: push a revert commit to the branch instead.

## List Rollback Targets

```
GET /v1/services/:serviceId/deployments/rollback-targets
```

Returns the commits this service can roll back to instantly, and the commit currently deployed.

```json
{
  "commits": ["9f3c2a1e7b...", "4d81b0c5aa..."],
  "current": "9f3c2a1e7b..."
}
```

`commits` lists commit SHAs. `current` is `null` when it can't be determined. A commit missing from the list can still be rolled back on a Dockerfile service, by rebuilding it.

## Cancel Deployment

```
POST /v1/services/:serviceId/deployments/:deploymentId/cancel
```

Cancels a `queued` or running deployment. The service keeps serving its previous version.

## List Deployments

```
GET /v1/services/:serviceId/deployments?page=1&limit=20
```

## Get Deployment

```
GET /v1/services/:serviceId/deployments/:deploymentId
```

## Get Build Logs

```
GET /v1/services/:serviceId/deployments/:deploymentId/logs
```

Returns build/deployment logs as sanitized text.

## Deployment Statuses

| Status | Description |
|--------|-------------|
| `queued` | Waiting to build |
| `building` | Build in progress |
| `deploying` | Build complete, deploying container |
| `running` | Successfully deployed and live |
| `failed` | Build or deployment failed |
| `cancelled` | Cancelled by user |
