> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.butterix.com/en/llms.txt
> - v0: https://docs.butterix.com/en/v0/llms.txt

> For the MDX source of any page, append .mdx to the page URL.
> For a complete documentation index, see https://docs.butterix.com/en/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.butterix.com/_mcp/server.
> If something on this page is wrong or missing, POST JSON {"page": "<page URL>", "message": "<what is wrong>"} to https://docs.butterix.com/_biti/feedback/agent.

# Promote to production (roll back)

`POST /deployments/{id}/promote`

Requires the `editor` role. Makes any `ready` deployment (including previews and earlier production deployments) the production one. It only switches a pointer: it takes effect immediately, without a rebuild.

Base URL: https://api.butterix.com/v1

Authentication: bearer token in Authorization header or API key in cookie `biti_session`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |

## Example request

```bash
curl -X POST https://api.butterix.com/v1/deployments/dpl_01jd8x2k7q/promote \
     -H "Authorization: Bearer <token>"
```

## Responses

### 200

New production deployment

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | no |  |
| `siteId` | string | no |  |
| `kind` | enum | no | Allowed: `production`, `preview`. |
| `status` | enum | no | Allowed: `queued`, `building`, `ready`, `failed`, `canceled`. |
| `source` | string | no | `cli` (upload), `hosted` (hosted repository), or `git` |
| `branch` | string | no |  |
| `commitSha` | string | no |  |
| `message` | string | no |  |
| `createdBy` | object | no | Who triggered it; with an API key, the person who created the key |
| `createdBy.id` | string | no |  |
| `createdBy.name` | string | no |  |
| `apiKey` | object | no | The name, start and end of the key, when triggered with an API key (CLI / CI) |
| `apiKey.name` | string | no |  |
| `apiKey.prefix` | string | no | First 10 characters of the key |
| `apiKey.suffix` | string | no | Last 10 characters of the key |
| `error` | string | no | Reason for failure |
| `pageCount` | integer | no |  |
| `sizeBytes` | integer | no |  |
| `durationMs` | integer | no |  |
| `url` | URL | no | Present after success. Production deployments have the site's URL; previews use a `<site>--<last 8 characters of the id>` subdomain |
| `isCurrent` | boolean | no | Whether this is the current production deployment |
| `createdAt` | integer | no |  |
| `finishedAt` | integer | no |  |

### 400

Invalid request parameters

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string | yes | Human-readable error message |
| `code` | string | no | Machine-readable error code (some endpoints) |

### Example response (200)

```json
{
  "id": "dpl_01jd8x2k7q",
  "siteId": "site_2m4k8p",
  "kind": "production",
  "status": "queued",
  "source": "git",
  "branch": "main",
  "commitSha": "9fceb02d0ae598e95dc970b74767f19372d61af8",
  "message": "docs: update quickstart",
  "createdBy": {
    "id": "string",
    "name": "string"
  },
  "apiKey": {
    "name": "GitHub Actions",
    "prefix": "biti_a1B2c",
    "suffix": "Kd82mQx0Zt"
  },
  "error": "string",
  "pageCount": 94,
  "sizeBytes": 5832110,
  "durationMs": 6120,
  "url": "https://acme-payments--8x2k7q-sites.butterix.com",
  "isCurrent": true,
  "createdAt": 1,
  "finishedAt": 1
}
```
