Skip to Content
API ReferenceDeployments

Deployments

All endpoints require Authorization: Bearer TOKEN.

Create Deployment

Upload a tar.gz archive of your source code to trigger a build and deploy.

POST /api/v1/deployments Content-Type: multipart/form-data

Form fields:

FieldTypeDescription
project_idstringProject ID
filefileSource code as .tar.gz

Response: 201

{ "id": "dpl_abc123", "project_id": "prj_abc123", "status": "building", "created_at": "2025-01-15T10:30:00Z" }

Deployment statuses: building → deploying → running / failed

Deploy a Linked Repository

Deploy a site’s linked GitHub repository on demand, without waiting for a push.

POST /api/v1/projects/:id/sites/:siteId/repo/deploy

Body (optional):

{ "sha": "9f2c1b8e4a7d0c3f6b5e2a1d8c7b4f3e0a9d6c2b" }
FieldTypeDescription
shastring?A 40-character commit hash. Omit it to deploy the linked branch’s head, resolved live from GitHub

Response: 202 — the deployment, queued:

{ "deployment": { "id": "dpl_abc123", "status": "queued" } }

Poll Get Deployment for the outcome; a GitHub-side failure lands on the deployment row as failed with the reason in the build logs. The deployment carries the git_manual trigger.

The site’s auto-deploy setting is deliberately ignored — it governs pushes, not this call. See Deploy on demand for the full status table.

This route takes an account token (gh_…) or a dashboard session. A project API key (gsk_…) answers 403: a key able to deploy a site’s linked branch could run arbitrary code as that site’s owner.

List Deployments

GET /api/v1/deployments/project/:projectId

Every deployment in the list carries rollback_available (boolean) — whether Rollback can still restore it. Only the last 10 successful deployments of a site can be restored, so older rows are listed with rollback_available: false.

Get Deployment

GET /api/v1/deployments/:id

Rollback

Roll back to a specific deployment. Only the last 10 successful deployments of a site can be restored; List Deployments marks which rows qualify with rollback_available.

POST /api/v1/deployments/:id/rollback

Response: 200

{ "message": "Rollback initiated", "deployment_id": "dpl_abc123" }

Response: 409 when the deployment cannot be restored. Nothing is applied — no deployment is created and the site keeps serving. error is one of:

ReasonMessage
Outside the windowThis deployment is outside the rollback window: only the last 10 successful deployments of a site can be restored. Deploy again from source instead.
Image no longer storedThis deployment's image is no longer stored in the registry, so it can't be restored. Deploy again from source instead.

Show error to the user as it is.