# Settings

> Site settings. 5 endpoints in the Unvop API.

Site settings.

## Get settings

`GET /v1/sites/{siteId}/settings`

Scope: `content:read`.

The site with its settings, theme tokens, public address and launch checklist, as the dashboard’s Settings shows them: with any unpublished site-wide draft applied, and draft naming what is waiting (null when the live site matches). GET /sites/{siteId} returns the live settings.

### Path parameters

- `siteId` (string, required): The site’s id.

### Response 200

- `site` (object, required): A website.
  - `id` (string, required)
  - `name` (string, required)
  - `hostnames` (array of strings, required): The web addresses the site answers at.
  - `theme` (string, required)
  - `settings` (object, required): Navigation, footer, organization, SEO, tokens, design and more.
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `theme` (object, required)
  - `id` (string, required)
  - `name` (string, required)
  - `tokens` (array, required)
- `url` (string, required): The site’s public address.
- `launch` (any, required): The launch checklist.
- `draft` (object, nullable): Site-wide changes saved but not live yet (site style, logo, menu, footer), or null. site.settings already includes them; publishing any page or POST /sites/{siteId}/publish puts them live.
  - `areas` (array of strings, required): One of `style`, `logo`, `menu`, `footer`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/settings \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Change settings

`PATCH /v1/sites/{siteId}/settings`

Scope: `settings:write`, as a site owner or admin.

Change the site’s name, addresses or settings (nav, footer, organization, seo, tokens, locations, menu, articles, design fonts). Settings you send replace those keys; others are kept. Same checks as the dashboard. The site style (tokens, logo, favicon, theme, design css, fonts and view transitions) and the menu and footer (nav, menu, footer) save as a site-wide draft: the live site is unchanged until you publish (POST /sites/{siteId}/publish or any page publish), and POST /sites/{siteId}/settings/discard throws the draft away. The name, addresses, organization (contact details), seo, locations, map and articles apply at once. Owners and admins only.

### Path parameters

- `siteId` (string, required): The site’s id.

### Request body (JSON)

- `name` (string): (up to 120 characters)
- `hostnames` (array of strings): (up to 10 items)
- `settings` (object)

### Response 200

- `site` (object, required): A website.
  - `id` (string, required)
  - `name` (string, required)
  - `hostnames` (array of strings, required): The web addresses the site answers at.
  - `theme` (string, required)
  - `settings` (object, required): Navigation, footer, organization, SEO, tokens, design and more.
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `theme` (object, required)
  - `id` (string, required)
  - `name` (string, required)
  - `tokens` (array, required)
- `url` (string, required): The site’s public address.
- `launch` (any, required): The launch checklist.
- `draft` (object, nullable): Site-wide changes saved but not live yet (site style, logo, menu, footer), or null. site.settings already includes them; publishing any page or POST /sites/{siteId}/publish puts them live.
  - `areas` (array of strings, required): One of `style`, `logo`, `menu`, `footer`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl -X PATCH https://api.unvop.com/v1/sites/site_123/settings \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ana",
    "hostnames": [
      "harbour-bakery.unvop.dev"
    ]
  }'
```

## Discard site-wide changes

`POST /v1/sites/{siteId}/settings/discard`

Scope: `settings:write`, as a site owner or admin.

Throw away the unpublished site-wide draft (site style, logo, menu and footer changes) so the settings match the live site again. Pages’ drafts are not touched. Owners and admins only.

### Path parameters

- `siteId` (string, required): The site’s id.

### Response 200

- `site` (object, required): A website.
  - `id` (string, required)
  - `name` (string, required)
  - `hostnames` (array of strings, required): The web addresses the site answers at.
  - `theme` (string, required)
  - `settings` (object, required): Navigation, footer, organization, SEO, tokens, design and more.
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `theme` (object, required)
  - `id` (string, required)
  - `name` (string, required)
  - `tokens` (array, required)
- `url` (string, required): The site’s public address.
- `launch` (any, required): The launch checklist.
- `draft` (object, nullable): Site-wide changes saved but not live yet (site style, logo, menu, footer), or null. site.settings already includes them; publishing any page or POST /sites/{siteId}/publish puts them live.
  - `areas` (array of strings, required): One of `style`, `logo`, `menu`, `footer`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl -X POST https://api.unvop.com/v1/sites/site_123/settings/discard \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## List site-wide versions

`GET /v1/sites/{siteId}/settings/revisions`

Scope: `content:read`.

The last 50 published versions of the site style, logo, menu and footer, newest first, with the parts each publish changed (areas). The oldest may be what was live before the first site-wide publish.

### Path parameters

- `siteId` (string, required): The site’s id.

### Response 200

- `items` (array of objects, required)
  - `id` (string, required)
  - `note` (string)
  - `areas` (array of strings, required)
  - `createdAt` (string, required)
  - `userName` (string)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/settings/revisions \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Restore a site-wide version

`POST /v1/sites/{siteId}/settings/revisions/{revisionId}/restore`

Scope: `settings:write`, as a site owner or admin.

Make a published version of the site style, logo, menu and footer the site-wide draft again. Publish to put it live; this is how a site-wide publish is undone. Owners and admins only.

### Path parameters

- `siteId` (string, required): The site’s id.
- `revisionId` (string, required): A revision id from GET /sites/{siteId}/settings/revisions.

### Response 200

- `site` (object, required): A website.
  - `id` (string, required)
  - `name` (string, required)
  - `hostnames` (array of strings, required): The web addresses the site answers at.
  - `theme` (string, required)
  - `settings` (object, required): Navigation, footer, organization, SEO, tokens, design and more.
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `theme` (object, required)
  - `id` (string, required)
  - `name` (string, required)
  - `tokens` (array, required)
- `url` (string, required): The site’s public address.
- `launch` (any, required): The launch checklist.
- `draft` (object, nullable): Site-wide changes saved but not live yet (site style, logo, menu, footer), or null. site.settings already includes them; publishing any page or POST /sites/{siteId}/publish puts them live.
  - `areas` (array of strings, required): One of `style`, `logo`, `menu`, `footer`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl -X POST https://api.unvop.com/v1/sites/site_123/settings/revisions/rev_123/restore \
  -H "Authorization: Bearer $UNVOP_KEY"
```
