# Hosting API reference

The deploy API v1 lives under /api/public/hosting/v1 and acts on the site its key belongs to, so no site id appears in a path. This reference is generated from the same route contract the API validates against.

## How do requests authenticate?

Send a site API key as a bearer token on every request. Keys are created on the site's **API keys** tab and shown once; see [the quickstart](/docs/developer/hosting/v1/quickstart).

Request header

```text
Authorization: Bearer shk_...
```

The budget is 120 requests / minute per key.

## What do responses look like?

Successful responses are `{ success: true, message, data }` and lists add `meta` with paging. Errors are `{ success: false, message, error_code?, errors? }`: branch on `error_code` and show `message`. Every code is listed on [Errors](/docs/developer/hosting/v1/errors).

The same contract as an OpenAPI 3.1 document: [/openapi/hosting-v1.json](/openapi/hosting-v1.json).

## Endpoints

- [GET /api/public/hosting/v1/site](#get-site)
- [GET /api/public/hosting/v1/deploys](#list-deploys)
- [POST /api/public/hosting/v1/deploys](#create-deploy)
- [GET /api/public/hosting/v1/deploys/:deployId](#get-deploy)
- [POST /api/public/hosting/v1/deploys/:deployId/finalize](#finalize-deploy)
- [POST /api/public/hosting/v1/deploys/:deployId/promote](#promote-deploy)
- [POST /api/public/hosting/v1/rollback](#rollback)

### GET /api/public/hosting/v1/site

The key's site with its production deploy and the domains pointed at it.

GET /api/public/hosting/v1/site: response 200

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object` | required |
| `data.publication_receipt` | `object \| null` | optional |
| `data.publication_receipt.event_id` | `uuid` | required |
| `data.publication_receipt.origin_product` | `"formlab" \| "arch" \| "hosting"` | required |
| `data.id` | `uuid` | required |
| `data.slug` | `string` | required |
| `data.name` | `string` | required |
| `data.status` | `"active" \| "archived"` | required |
| `data.production_deploy_id` | `uuid \| null` | required |
| `data.last_published_at` | `string \| null` | optional |
| `data.primary_domain` | `object \| null` | optional |
| `data.primary_domain.hostname` | `string` | required |
| `data.primary_domain.status` | `"pending" \| "verified" \| "failed" \| "removed"` | required |
| `data.primary_domain.cert_status` | `string \| null` | required |
| `data.arch_site_id` | `uuid \| null` | optional |
| `data.default_url` | `string` | required |
| `data.created_at` | `string` | required |
| `data.updated_at` | `string` | required |
| `data.production_deploy` | `object \| null` | required |
| `data.production_deploy.id` | `uuid` | required |
| `data.production_deploy.site_id` | `uuid` | required |
| `data.production_deploy.status` | `"uploading" \| "ready" \| "failed" \| "discarded"` | required |
| `data.production_deploy.source` | `"upload" \| "api" \| "arch"` | required |
| `data.production_deploy.file_count` | `integer` | required |
| `data.production_deploy.byte_size` | `integer` | required |
| `data.production_deploy.created_by` | `uuid` | required |
| `data.production_deploy.created_at` | `string` | required |
| `data.production_deploy.finalized_at` | `string \| null` | required |
| `data.production_deploy.failed_reason` | `string \| null` | required |
| `data.production_deploy.is_production` | `boolean` | required |
| `data.production_deploy.preview_url` | `string` | required |
| `data.production_deploy.preview` | `boolean` | optional |
| `data.domains` | `object[]` | required |
| `data.domains[].id` | `uuid` | required |
| `data.domains[].hostname` | `string` | required |
| `data.domains[].kind` | `"apex" \| "subdomain"` | required |
| `data.domains[].status` | `"pending" \| "verified" \| "failed" \| "removed"` | required |
| `data.domains[].failure_reason` | `string \| null` | required |
| `data.domains[].target_type` | `"none" \| "forms" \| "site" \| "email" \| "portal" \| "tracking" \| "members"` | required |
| `data.domains[].target_id` | `uuid \| null` | required |
| `data.domains[].cert_status` | `string \| null` | required |
| `data.domains[].records` | `object[]` | required |
| `data.domains[].records[].type` | `"TXT" \| "CNAME"` | required |
| `data.domains[].records[].name` | `string` | required |
| `data.domains[].records[].value` | `string` | required |
| `data.domains[].records[].purpose` | `"ownership" \| "routing"` | required |
| `data.domains[].records[].status` | `"pending" \| "ok" \| "failed"` | required |
| `data.domains[].records[].checked_at` | `string \| null` | required |
| `data.domains[].verified_at` | `string \| null` | required |
| `data.domains[].last_checked_at` | `string \| null` | required |
| `data.domains[].created_at` | `string` | required |
| `data.primary_domain_id` | `uuid \| null` | optional |

### GET /api/public/hosting/v1/deploys

The site's 50 newest deploys, newest first.

GET /api/public/hosting/v1/deploys: response 200

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object[]` | required |
| `data[].id` | `uuid` | required |
| `data[].site_id` | `uuid` | required |
| `data[].status` | `"uploading" \| "ready" \| "failed" \| "discarded"` | required |
| `data[].source` | `"upload" \| "api" \| "arch"` | required |
| `data[].file_count` | `integer` | required |
| `data[].byte_size` | `integer` | required |
| `data[].created_by` | `uuid` | required |
| `data[].created_at` | `string` | required |
| `data[].finalized_at` | `string \| null` | required |
| `data[].failed_reason` | `string \| null` | required |
| `data[].is_production` | `boolean` | required |
| `data[].preview_url` | `string` | required |
| `data[].preview` | `boolean` | optional |
| `meta` | `object` | required |
| `meta.current_page` | `integer` | required |
| `meta.last_page` | `integer` | required |
| `meta.per_page` | `integer` | required |
| `meta.total` | `integer` | required |
| `meta.from` | `integer \| null` | required |
| `meta.to` | `integer \| null` | required |

### POST /api/public/hosting/v1/deploys

Start a deploy from a manifest: returns one presigned PUT (15 min) per file; PUT each file with the returned headers, then finalize. 422 HOSTING\_MANIFEST\_INVALID / HOSTING\_DEPLOY\_TOO\_LARGE / HOSTING\_TOO\_MANY\_PENDING. The deploy is always recorded with source 'api' (a body \`source\` is ignored).

POST /api/public/hosting/v1/deploys: request body (JSON)

| Field | Type | Required |
| --- | --- | --- |
| `source` | `"upload" \| "api" \| "arch"` | optional |
| `cms_bindings_hash` | `string` | optional |
| `files` | `object[]` | required |
| `files[].path` | `string` | required |
| `files[].size` | `number` | required |
| `files[].content_type` | `string` | optional |

POST /api/public/hosting/v1/deploys: response 201

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object` | required |
| `data.deploy` | `object` | required |
| `data.deploy.id` | `uuid` | required |
| `data.deploy.site_id` | `uuid` | required |
| `data.deploy.status` | `"uploading" \| "ready" \| "failed" \| "discarded"` | required |
| `data.deploy.source` | `"upload" \| "api" \| "arch"` | required |
| `data.deploy.file_count` | `integer` | required |
| `data.deploy.byte_size` | `integer` | required |
| `data.deploy.created_by` | `uuid` | required |
| `data.deploy.created_at` | `string` | required |
| `data.deploy.finalized_at` | `string \| null` | required |
| `data.deploy.failed_reason` | `string \| null` | required |
| `data.deploy.is_production` | `boolean` | required |
| `data.deploy.preview_url` | `string` | required |
| `data.deploy.preview` | `boolean` | optional |
| `data.uploads` | `object[]` | required |
| `data.uploads[].path` | `string` | required |
| `data.uploads[].url` | `string` | required |
| `data.uploads[].headers` | `Record<string, string>` | required |
| `data.reused` | `string[]` | optional |

### GET /api/public/hosting/v1/deploys/:deployId

One deploy of the site.

GET /api/public/hosting/v1/deploys/:deployId: path parameters

| Field | Type | Required |
| --- | --- | --- |
| `deployId` | `uuid` | required |

GET /api/public/hosting/v1/deploys/:deployId: response 200

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object` | required |
| `data.id` | `uuid` | required |
| `data.site_id` | `uuid` | required |
| `data.status` | `"uploading" \| "ready" \| "failed" \| "discarded"` | required |
| `data.source` | `"upload" \| "api" \| "arch"` | required |
| `data.file_count` | `integer` | required |
| `data.byte_size` | `integer` | required |
| `data.created_by` | `uuid` | required |
| `data.created_at` | `string` | required |
| `data.finalized_at` | `string \| null` | required |
| `data.failed_reason` | `string \| null` | required |
| `data.is_production` | `boolean` | required |
| `data.preview_url` | `string` | required |
| `data.preview` | `boolean` | optional |

### POST /api/public/hosting/v1/deploys/:deployId/finalize

Verify every uploaded file and mark the deploy ready; 422 HOSTING\_DEPLOY\_INCOMPLETE (the deploy is then failed and its files deleted).

POST /api/public/hosting/v1/deploys/:deployId/finalize: path parameters

| Field | Type | Required |
| --- | --- | --- |
| `deployId` | `uuid` | required |

POST /api/public/hosting/v1/deploys/:deployId/finalize: response 200

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object` | required |
| `data.id` | `uuid` | required |
| `data.site_id` | `uuid` | required |
| `data.status` | `"uploading" \| "ready" \| "failed" \| "discarded"` | required |
| `data.source` | `"upload" \| "api" \| "arch"` | required |
| `data.file_count` | `integer` | required |
| `data.byte_size` | `integer` | required |
| `data.created_by` | `uuid` | required |
| `data.created_at` | `string` | required |
| `data.finalized_at` | `string \| null` | required |
| `data.failed_reason` | `string \| null` | required |
| `data.is_production` | `boolean` | required |
| `data.preview_url` | `string` | required |
| `data.preview` | `boolean` | optional |

### POST /api/public/hosting/v1/deploys/:deployId/promote

Make a ready deploy the site's production deploy.

POST /api/public/hosting/v1/deploys/:deployId/promote: path parameters

| Field | Type | Required |
| --- | --- | --- |
| `deployId` | `uuid` | required |

POST /api/public/hosting/v1/deploys/:deployId/promote: response 200

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object` | required |
| `data.publication_receipt` | `object \| null` | optional |
| `data.publication_receipt.event_id` | `uuid` | required |
| `data.publication_receipt.origin_product` | `"formlab" \| "arch" \| "hosting"` | required |
| `data.id` | `uuid` | required |
| `data.slug` | `string` | required |
| `data.name` | `string` | required |
| `data.status` | `"active" \| "archived"` | required |
| `data.production_deploy_id` | `uuid \| null` | required |
| `data.last_published_at` | `string \| null` | optional |
| `data.primary_domain` | `object \| null` | optional |
| `data.primary_domain.hostname` | `string` | required |
| `data.primary_domain.status` | `"pending" \| "verified" \| "failed" \| "removed"` | required |
| `data.primary_domain.cert_status` | `string \| null` | required |
| `data.arch_site_id` | `uuid \| null` | optional |
| `data.default_url` | `string` | required |
| `data.created_at` | `string` | required |
| `data.updated_at` | `string` | required |

### POST /api/public/hosting/v1/rollback

Instant rollback: point production at an earlier ready deploy of the site.

POST /api/public/hosting/v1/rollback: request body (JSON)

| Field | Type | Required |
| --- | --- | --- |
| `deploy_id` | `uuid` | required |

POST /api/public/hosting/v1/rollback: response 200

| Field | Type | Required |
| --- | --- | --- |
| `success` | `true` | required |
| `message` | `string` | required |
| `data` | `object` | required |
| `data.publication_receipt` | `object \| null` | optional |
| `data.publication_receipt.event_id` | `uuid` | required |
| `data.publication_receipt.origin_product` | `"formlab" \| "arch" \| "hosting"` | required |
| `data.id` | `uuid` | required |
| `data.slug` | `string` | required |
| `data.name` | `string` | required |
| `data.status` | `"active" \| "archived"` | required |
| `data.production_deploy_id` | `uuid \| null` | required |
| `data.last_published_at` | `string \| null` | optional |
| `data.primary_domain` | `object \| null` | optional |
| `data.primary_domain.hostname` | `string` | required |
| `data.primary_domain.status` | `"pending" \| "verified" \| "failed" \| "removed"` | required |
| `data.primary_domain.cert_status` | `string \| null` | required |
| `data.arch_site_id` | `uuid \| null` | optional |
| `data.default_url` | `string` | required |
| `data.created_at` | `string` | required |
| `data.updated_at` | `string` | required |

## Related pages

- [Limits and plans](/docs/developer/hosting/v1/limits)
- [Custom domains](/docs/developer/hosting/v1/custom-domains)
- [Hosting changelog](/docs/developer/hosting/v1/changelog)
