---
title: Ask for a build
description: "Asks for a build of the default branch's head, read through the git provider, or of sha."
api_method: POST
api_path: "/v1/workspaces/{workspaceId}/sites/{siteId}/versions"
canonical_url: https://wiblo.app/docs/developers/api/sites/create-site-version
last_updated: 2026-09-28T22:17:00+02:00
md_url: https://wiblo.app/docs/developers/api/sites/create-site-version.md
---

# Ask for a build

`POST /v1/workspaces/{workspaceId}/sites/{siteId}/versions`

Asks for a build of the default branch's head, read through the git provider, or of `sha`. The queue holds one build in flight and one waiting per site: an idle site starts the build workflow at once (`building`), a busy site queues the ask (`queued`) and a newer ask supersedes an older waiting one, and a sha already `queued`, `building`, or `ready` is answered as its existing row. A sha whose row is `error` builds again on that row, which keeps its id and any number it had. About a minute later the row is `ready` at its own URL; version one at creation is promoted to the live URL by the workflow, every later version waits for a publish. Every active member and a run's workspace key may ask. Per-user rate-limited at 30/60s in its own bucket.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `workspaceId` | `string` | Yes |  |
| `siteId` | `string` | Yes |  |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `sha` | `string` | No | The commit to build: 7 to 40 lowercase hex characters. Omitted means the head of the repository's default branch. |

## Request

**curl**

```bash
curl https://api.wiblo.app/v1/workspaces/{workspaceId}/sites/{siteId}/versions \
  -X POST \
  -H "Authorization: Bearer $WIBLO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "sha": "4e1f0c2"
}'
```

**TypeScript**

```ts
import { createSdk, createSiteVersion } from "@workspace/sdk"

const sdk = createSdk({ baseUrl: "https://api.wiblo.app" })

const { data, error } = await createSiteVersion({
  client: sdk,
  path: { workspaceId: "...", siteId: "..." },
  body: {
    "sha": "4e1f0c2"
  },
})
```

## Responses

**`200`** — A row already held the sha (`queued`, `building`, or `ready`), answered as is. Returns `SiteVersionSummary`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes |  |
| `site_id` | `string` | Yes |  |
| `number` | `integer \| null` | Yes | The number on the picker, per site. The version gets it when its build is first ready, and no other version takes it. Null for a version that was never ready. A ready version whose deployment is gone turns `error` and keeps its number, also when it is built again. |
| `status` | `"queued" \| "building" \| "ready" \| "error" \| "canceled" \| "superseded"` | Yes |  |
| `commit_sha` | `string` | Yes |  |
| `commit_message` | `string \| null` | Yes | The first line of the commit message, once the build was created. |
| `url` | `string \| null` | Yes | The version's own URL. Null until the deployment exists. |
| `source` | `"create" \| "turn" \| "manual" \| "push"` | Yes |  |
| `published` | `boolean` | Yes | True when the live URL serves this version now. |
| `error` | `string \| null` | Yes | Why the version is `error`, and null for every other status. When the code failed to build, this is the build's own error message. Otherwise it is the platform's own sentence: the platform could not start the build or read its state, the build ran out of time or was lost, or its deployment is gone. |
| `created_by_run_id` | `string \| null` | Yes |  |
| `created_at` | `string` | Yes |  |
| `started_at` | `string \| null` | Yes |  |
| `ready_at` | `string \| null` | Yes |  |
| `first_published_at` | `string \| null` | Yes |  |

**`201`** — The build was queued or started: a new row, or an `error` row for the same sha built again. Returns `SiteVersionSummary`.

**`400`** — Body failed validation (`VALIDATION_FAILED`). Returns `ApiErrorEnvelope`.

**`401`** — No valid session, `wbl_*` bearer, or run token was present. Returns `ApiErrorEnvelope`.

**`404`** — Workspace not visible to the caller (`WORKSPACE_NOT_FOUND`), or no site with that id in it (`SITE_NOT_FOUND`). Returns `ApiErrorEnvelope`.

**`409`** — The site has no repository yet, so nothing can be built, or, with no `sha` given, the site's repository is gone (`SITE_NOT_READY`). Returns `ApiErrorEnvelope`.

**`422`** — Path param failed UUID validation (`INVALID_PARAMS`), or `sha` is not 7 to 40 lowercase hex characters (`COMMIT_INVALID`). Returns `ApiErrorEnvelope`.

**`429`** — Rate limit exceeded. The body's `error.code` is `RATE_LIMITED` and `error.details.retry_after` is the same number of seconds as the `Retry-After` header. Returns `ApiErrorEnvelope`.

**`502`** — The git control plane or the deploy provider is not configured, the head of the default branch could not be read, or the build workflow could not start (`UPSTREAM_UNAVAILABLE`). A build that could not start leaves its row `error` with `WORKFLOW_START_FAILED`, and the same ask builds it again. Returns `ApiErrorEnvelope`.
