# Pages

> Pages, articles and the blocks inside them. 17 endpoints in the Unvop API.

Pages, articles and the blocks inside them.

## List block types

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

Scope: `content:read`.

Every block the site’s pages can use, with its fields (name, type, label, options), defaults and variants. Use it to build valid blocks for pages.

### Path parameters

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

### Response 200

- `items` (array, required)
- `cursor` (string, nullable): Pass as ?cursor= to get the next page. Null when there are no more.
- `total` (integer): How many there are in all, when the list knows.

### 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/blocks \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## List pages

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

Scope: `content:read`.

Every page and article on the site, the homepage first. Entry page templates of collections are listed only with ?kind=template.

### Path parameters

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

### Query parameters

- `kind` (string): One of `page`, `post`, `template`.

### Response 200

- `items` (array of objects, required)
  - `id` (string, required)
  - `slug` (string, required): The address, like "/" or "/insights/my-post".
  - `kind` (string, required): One of `page`, `post`, `template`.
  - `title` (string, required)
  - `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.
  - `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `cursor` (string, nullable): Pass as ?cursor= to get the next page. Null when there are no more.
- `total` (integer): How many there are in all, when the list knows.

### 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 https://api.unvop.com/v1/sites/site_123/pages \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Create a page

`POST /v1/sites/{siteId}/pages`

Scope: `content:write`.

Add a page or article from a title, optionally from one of the theme’s templates. It starts as a draft with a free address made from the title (or the slug you give). To write a whole page with its blocks in one call, use PUT /sites/{siteId}/pages/{page} instead.

### Path parameters

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

### Headers

- `Idempotency-Key` (string): Send the same key to repeat this request safely; the first answer is replayed for 24 hours. (up to 200 characters)

### Request body (JSON)

- `title` (string, required): (at least 1 characters; up to 200 characters)
- `kind` (string, required): One of `page`, `post`.
- `slug` (string): (up to 200 characters)
- `templateId` (string): (up to 64 characters)

### Response 201

- `id` (string, required)
- `slug` (string, required): The address, like "/" or "/insights/my-post".
- `kind` (string, required): One of `page`, `post`, `template`.
- `title` (string, required)
- `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
- `updatedAt` (string, required): An ISO 8601 timestamp.
- `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `siteId` (string, required)
- `seo` (object, required)
- `blocks` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `post` (object)
- `createdAt` (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 https://api.unvop.com/v1/sites/site_123/pages \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "title": "About us",
    "kind": "page"
  }'
```

## List a page’s blocks

`GET /v1/sites/{siteId}/pages/{page}/blocks`

Scope: `content:read`.

The blocks of the page’s draft, in order.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Response 200

- `items` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".

### 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/pages/index/blocks \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Add a block

`POST /v1/sites/{siteId}/pages/{page}/blocks`

Scope: `content:write`.

Insert a block into the page’s draft: at the end, at a position, or before or after another block. The page is validated as a whole; nothing is published until you publish it.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Headers

- `If-Match` (string): The ETag from your last read. The write is refused with 412 if the page changed since.

### Request body (JSON)

- `type` (string, required): A block type from GET /sites/{siteId}/blocks. (at least 1 characters; up to 64 characters)
- `props` (object): Content for the block’s fields. Missing fields take the block’s defaults. (default {})
- `variant` (string): (up to 64 characters)
- `hidden` (boolean)
- `anchor` (string): (up to 64 characters)
- `id` (string): Leave out to get a fresh id. (up to 64 characters)
- `position` (integer): Where to put it, counting from 0. Default: the end. (min 0)
- `after` (string): Put it right after the block with this id. (up to 64 characters)
- `before` (string): Put it right before the block with this id. (up to 64 characters)

### Response 201

- `page` (object, required): A page with its blocks (the draft unless ?version=published).
  - `id` (string, required)
  - `slug` (string, required): The address, like "/" or "/insights/my-post".
  - `kind` (string, required): One of `page`, `post`, `template`.
  - `title` (string, required)
  - `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.
  - `publishedAt` (string, nullable): An ISO 8601 timestamp.
  - `siteId` (string, required)
  - `seo` (object, required)
  - `blocks` (array of objects, required)
    - `id` (string, required): Unique within the page.
    - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
    - `variant` (string)
    - `props` (object, required): The block’s content, shaped by its fields.
    - `hidden` (boolean)
    - `anchor` (string): An id for in-page links, like "pricing".
  - `post` (object)
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `block` (object, required): One section of a page.
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `warnings` (array, required)

### 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.
- `412`: The page changed since you read it (If-Match).
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/pages/index/blocks \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "richText",
    "props": {
      "body": "<p>Open every day from 8.</p>"
    },
    "after": "b_hero"
  }'
```

## Get a block

`GET /v1/sites/{siteId}/pages/{page}/blocks/{blockId}`

Scope: `content:read`.

One block of the page’s draft.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.
- `blockId` (string, required)

### Response 200

- `id` (string, required): Unique within the page.
- `type` (string, required): A block type from GET /sites/{siteId}/blocks.
- `variant` (string)
- `props` (object, required): The block’s content, shaped by its fields.
- `hidden` (boolean)
- `anchor` (string): An id for in-page links, like "pricing".

### 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/pages/index/blocks/b_hero \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Change a block

`PATCH /v1/sites/{siteId}/pages/{page}/blocks/{blockId}`

Scope: `content:write`.

Change a block’s props, variant, visibility or anchor in the page’s draft. Props you leave out are kept.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.
- `blockId` (string, required)

### Headers

- `If-Match` (string): The ETag from your last read. The write is refused with 412 if the page changed since.

### Request body (JSON)

- `props` (object): Props to change. Others are kept. Send null for a prop to remove it.
- `variant` (string, nullable): (up to 64 characters)
- `hidden` (boolean)
- `anchor` (string, nullable): (up to 64 characters)

### Response 200

- `page` (object, required): A page with its blocks (the draft unless ?version=published).
  - `id` (string, required)
  - `slug` (string, required): The address, like "/" or "/insights/my-post".
  - `kind` (string, required): One of `page`, `post`, `template`.
  - `title` (string, required)
  - `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.
  - `publishedAt` (string, nullable): An ISO 8601 timestamp.
  - `siteId` (string, required)
  - `seo` (object, required)
  - `blocks` (array of objects, required)
    - `id` (string, required): Unique within the page.
    - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
    - `variant` (string)
    - `props` (object, required): The block’s content, shaped by its fields.
    - `hidden` (boolean)
    - `anchor` (string): An id for in-page links, like "pricing".
  - `post` (object)
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `block` (object, required): One section of a page.
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `warnings` (array, required)

### 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.
- `412`: The page changed since you read it (If-Match).
- `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/pages/index/blocks/b_hero \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "props": {
      "heading": "Fresh bread from 7am"
    }
  }'
```

## Remove a block

`DELETE /v1/sites/{siteId}/pages/{page}/blocks/{blockId}`

Scope: `content:write`.

Remove a block from the page’s draft.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.
- `blockId` (string, required)

### Headers

- `If-Match` (string): The ETag from your last read. The write is refused with 412 if the page changed since.

### Response 200

- `page` (object, required): A page with its blocks (the draft unless ?version=published).
  - `id` (string, required)
  - `slug` (string, required): The address, like "/" or "/insights/my-post".
  - `kind` (string, required): One of `page`, `post`, `template`.
  - `title` (string, required)
  - `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.
  - `publishedAt` (string, nullable): An ISO 8601 timestamp.
  - `siteId` (string, required)
  - `seo` (object, required)
  - `blocks` (array of objects, required)
    - `id` (string, required): Unique within the page.
    - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
    - `variant` (string)
    - `props` (object, required): The block’s content, shaped by its fields.
    - `hidden` (boolean)
    - `anchor` (string): An id for in-page links, like "pricing".
  - `post` (object)
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `warnings` (array, required)

### 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.
- `412`: The page changed since you read it (If-Match).
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl -X DELETE https://api.unvop.com/v1/sites/site_123/pages/index/blocks/b_hero \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Move a block

`POST /v1/sites/{siteId}/pages/{page}/blocks/{blockId}/move`

Scope: `content:write`.

Move a block to a position, or before or after another block.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.
- `blockId` (string, required)

### Headers

- `If-Match` (string): The ETag from your last read. The write is refused with 412 if the page changed since.

### Request body (JSON)

- `position` (integer): Where to put it, counting from 0. Default: the end. (min 0)
- `after` (string): Put it right after the block with this id. (up to 64 characters)
- `before` (string): Put it right before the block with this id. (up to 64 characters)

### Response 200

- `page` (object, required): A page with its blocks (the draft unless ?version=published).
  - `id` (string, required)
  - `slug` (string, required): The address, like "/" or "/insights/my-post".
  - `kind` (string, required): One of `page`, `post`, `template`.
  - `title` (string, required)
  - `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.
  - `publishedAt` (string, nullable): An ISO 8601 timestamp.
  - `siteId` (string, required)
  - `seo` (object, required)
  - `blocks` (array of objects, required)
    - `id` (string, required): Unique within the page.
    - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
    - `variant` (string)
    - `props` (object, required): The block’s content, shaped by its fields.
    - `hidden` (boolean)
    - `anchor` (string): An id for in-page links, like "pricing".
  - `post` (object)
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `warnings` (array, required)

### 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.
- `412`: The page changed since you read it (If-Match).
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/pages/index/blocks/b_hero/move \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "position": 0,
    "after": "…"
  }'
```

## Publish a page

`POST /v1/sites/{siteId}/pages/{page}/publish`

Scope: `content:write`.

Make the page’s draft live. Any waiting site-wide changes (site style, logo, menu and footer, saved through the settings or design endpoints) go live with it; sitePublished lists them when there were some. A revision is kept, so it can be restored later.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Request body (JSON)

- `note` (string): (up to 200 characters)

### Response 200

- `id` (string, required)
- `slug` (string, required): The address, like "/" or "/insights/my-post".
- `kind` (string, required): One of `page`, `post`, `template`.
- `title` (string, required)
- `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
- `updatedAt` (string, required): An ISO 8601 timestamp.
- `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `siteId` (string, required)
- `seo` (object, required)
- `blocks` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `post` (object)
- `createdAt` (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 https://api.unvop.com/v1/sites/site_123/pages/index/publish \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "New opening hours"
  }'
```

## Unpublish a page

`POST /v1/sites/{siteId}/pages/{page}/unpublish`

Scope: `content:write`.

Take the page off the live site. The draft is kept. The homepage can’t be unpublished.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Response 200

- `id` (string, required)
- `slug` (string, required): The address, like "/" or "/insights/my-post".
- `kind` (string, required): One of `page`, `post`, `template`.
- `title` (string, required)
- `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
- `updatedAt` (string, required): An ISO 8601 timestamp.
- `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `siteId` (string, required)
- `seo` (object, required)
- `blocks` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `post` (object)
- `createdAt` (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/pages/index/unpublish \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Duplicate a page

`POST /v1/sites/{siteId}/pages/{page}/duplicate`

Scope: `content:write`.

Copy the page’s draft to a new draft page at a free address.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Response 201

- `id` (string, required)
- `slug` (string, required): The address, like "/" or "/insights/my-post".
- `kind` (string, required): One of `page`, `post`, `template`.
- `title` (string, required)
- `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
- `updatedAt` (string, required): An ISO 8601 timestamp.
- `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `siteId` (string, required)
- `seo` (object, required)
- `blocks` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `post` (object)
- `createdAt` (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/pages/index/duplicate \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## List revisions

`GET /v1/sites/{siteId}/pages/{page}/revisions`

Scope: `content:read`.

The page’s last 50 published versions, newest first.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Response 200

- `items` (array of objects, required)
  - `id` (string, required)
  - `pageId` (string, required)
  - `note` (string)
  - `createdAt` (string, required): An ISO 8601 timestamp.
  - `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/pages/index/revisions \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Restore a revision

`POST /v1/sites/{siteId}/pages/{page}/revisions/{revisionId}/restore`

Scope: `content:write`.

Put a published version back as the page’s draft. Publish it to make it live again.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.
- `revisionId` (string, required)

### Response 200

- `id` (string, required)
- `slug` (string, required): The address, like "/" or "/insights/my-post".
- `kind` (string, required): One of `page`, `post`, `template`.
- `title` (string, required)
- `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
- `updatedAt` (string, required): An ISO 8601 timestamp.
- `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `siteId` (string, required)
- `seo` (object, required)
- `blocks` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `post` (object)
- `createdAt` (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/pages/index/revisions/rev_123/restore \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Get a page

`GET /v1/sites/{siteId}/pages/{page}`

Scope: `content:read`.

A page with all its blocks: the draft, or the live version with ?version=published. The ETag header can be sent back as If-Match when you save.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Query parameters

- `version` (string): One of `draft`, `published`.

### Response 200

- `id` (string, required)
- `slug` (string, required): The address, like "/" or "/insights/my-post".
- `kind` (string, required): One of `page`, `post`, `template`.
- `title` (string, required)
- `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
- `updatedAt` (string, required): An ISO 8601 timestamp.
- `publishedAt` (string, nullable): An ISO 8601 timestamp.
- `siteId` (string, required)
- `seo` (object, required)
- `blocks` (array of objects, required)
  - `id` (string, required): Unique within the page.
  - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
  - `variant` (string)
  - `props` (object, required): The block’s content, shaped by its fields.
  - `hidden` (boolean)
  - `anchor` (string): An id for in-page links, like "pricing".
- `post` (object)
- `createdAt` (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 https://api.unvop.com/v1/sites/site_123/pages/index \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Create or replace a page

`PUT /v1/sites/{siteId}/pages/{page}`

Scope: `content:write`.

Write a whole page at an address: its title, SEO and every block. Creates the page when nothing is there. The blocks are checked against the theme’s block types; errors name the exact path (pages[0].blocks[2].props.heading). Saved as a draft unless publish is true (which also puts any waiting site-wide changes live). Send If-Match with the ETag you read to avoid overwriting someone else’s change.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Headers

- `If-Match` (string): The ETag from your last read. The write is refused with 412 if the page changed since.

### Request body (JSON)

- `title` (string, required): (at least 1 characters; up to 200 characters)
- `kind` (string): One of `page`, `post`.
- `seo` (object): title, description, ogImage, canonical, noindex.
- `post` (object): Articles only: excerpt, author, cover, tags.
- `blocks` (array of objects, required): (up to 250 items)
- `publish` (boolean): Publish straight away. Default: save as a draft. (default false)

### Response 200

- `page` (object, required): A page with its blocks (the draft unless ?version=published).
  - `id` (string, required)
  - `slug` (string, required): The address, like "/" or "/insights/my-post".
  - `kind` (string, required): One of `page`, `post`, `template`.
  - `title` (string, required)
  - `status` (string, required): changed: live, with draft edits not yet published. One of `draft`, `published`, `changed`.
  - `updatedAt` (string, required): An ISO 8601 timestamp.
  - `publishedAt` (string, nullable): An ISO 8601 timestamp.
  - `siteId` (string, required)
  - `seo` (object, required)
  - `blocks` (array of objects, required)
    - `id` (string, required): Unique within the page.
    - `type` (string, required): A block type from GET /sites/{siteId}/blocks.
    - `variant` (string)
    - `props` (object, required): The block’s content, shaped by its fields.
    - `hidden` (boolean)
    - `anchor` (string): An id for in-page links, like "pricing".
  - `post` (object)
  - `createdAt` (string, required): An ISO 8601 timestamp.
- `created` (boolean, required)
- `warnings` (array, required)

### 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.
- `412`: The page changed since you read it (If-Match).
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl -X PUT https://api.unvop.com/v1/sites/site_123/pages/index \
  -H "Authorization: Bearer $UNVOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "About us",
    "blocks": [
      {
        "id": "b1",
        "type": "richText",
        "props": {
          "body": "<p>We bake every morning.</p>"
        }
      }
    ],
    "publish": false
  }'
```

## Delete a page

`DELETE /v1/sites/{siteId}/pages/{page}`

Scope: `content:write`.

Delete a page and take it off the live site. The homepage can’t be deleted; replace it with PUT instead.

### Path parameters

- `siteId` (string, required): The site’s id.
- `page` (string, required): A page id (pg_…) or its address: "index" for the homepage, "about" for /about, "insights/my-post" for /insights/my-post.

### Response 200

- `ok` (true, required)

### 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.
- `412`: The page changed since you read it (If-Match).
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

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