# Deployments

Read [Publishing](/concepts/publishing) for what a deployment is, and
[The publish contract](/api/publish) for the upload flow.

## Publish

```sh
curl -X POST https://api.heyclave.party/v1/sites/<site id>/publish \
  -H "Authorization: Bearer $CLAVE_API_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"scope":"site"}'
```

`POST /v1/sites/{id}/publish` builds the source and activates the result.

| `scope` | Builds |
|---|---|
| `site` | the head of both repositories. The default. |
| `posts` | the **live** site's commit, with the posts of now |

A body that does not mention `scope` is a site publish.

## Read them back

| Call | What it does |
|---|---|
| `GET /v1/sites/{id}/deployments` | the site's deployments, newest first |
| `GET /v1/deployments/{id}` | one deployment, with what changed in it |

The list is paginated. Read [Pagination](/api/pagination).

A deployment reports `restorable`, its file count, its total bytes, and
the two commits it was built from.

## Restore

`POST /v1/deployments/{id}/restore` puts an earlier deployment back on the
address.

It needs no upload. Clave holds every byte it ever published.

A restore is not a publish, and Clave's messages say so. Restoring does
not move any branch in git: it changes what is served.

---

## Where this page sits

This is one page of the Clave documentation.
Read it as a web page at https://docs.heyclave.party/api/deployments.
Every page has a `.md` address, and https://docs.heyclave.party/llms.txt lists them all.

- Previous: [Site source](https://docs.heyclave.party/api/source.md)
- Next: [Previews](https://docs.heyclave.party/api/previews.md)
- Index: [Overview](https://docs.heyclave.party/index.md)
