

# Trigger a deploy

A build (a deploy, in dashboard terms) publishes your saved pages as a static site. Trigger one with this endpoint, or as part of a [create or update pages](/api/pages/post-pages) request with `"build": true`. The response arrives as soon as the deploy is queued. Poll [get deploy status](/api/builds/get-builds-latest) to know when it finished.

```sh
POST https://sitepaste.com/api/v1/public/builds
```

## Usage

```bash
curl -X POST https://sitepaste.com/api/v1/public/builds \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"siteId": "optional-site-uuid"}'
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Body

The body is optional; without it, the deploy targets your default site.

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| siteId | string | No | Target site. Unlike the other endpoints, this one accepts only the site's UUID, not the short ID. |

## Response

```json
{
  "status": "queued",
  "deployUrl": "https://yourusername.sitepaste.com",
  "message": "build queued successfully"
}
```

| Field | Type | Description |
|-------|------|-------------|
| status | string | `queued`. The deploy has been accepted but not finished. Poll [get deploy status](/api/builds/get-builds-latest) for the outcome. |
| deployUrl | string | The site's sitepaste.com address. Always the workspace subdomain, even when a [custom domain](/concepts/custom-domains) is connected. |
| message | string | Human-readable confirmation. Not intended for parsing. |

## Quotas and cooldown

The Pro plan includes 1,000 deploys per month. There is a 30-second cooldown between deploys.

## Errors

Quota exceeded returns `402`:

```json
{
  "error": "build quota exceeded",
  "message": "Monthly build limit of 1000 reached. Upgrade your plan or wait for the next billing cycle."
}
```

Cooldown active returns `429`:

```json
{
  "error": "build cooldown active",
  "message": "Please wait 20 seconds before triggering another build."
}
```

A `402` with `{"error": "invalid plan"}` means the workspace's subscription does not allow API deploys.

## Deploy via the pages endpoint

Setting `"build": true` on a [pages request](/api/pages/post-pages) queues a deploy once the page changes have been saved. If the deploy cannot start because the quota is exceeded or the cooldown is active, the pages are still saved, and the error comes back in the response's `build` field:

```json
{
  "pages": [...],
  "build": {
    "error": "build quota exceeded",
    "message": "Monthly build limit of 1000 reached."
  }
}
```
