> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Prismic API reference

> API reference for the Prismic plugin in Corsair: every `prismic.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Documents

### get

`documents.get`

Read one published document by id, at the master ref or a given one

**Risk:** `read`

```ts theme={null}
await corsair.prismic.api.documents.get({ id: 'ZMI65RQAADkECUFM' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | The document id. |
| `ref` | `string` | No | Pins the query to a ref, such as a release preview. Defaults to the repository's master ref, which the plugin reads from the repository metadata first. |
| `lang` | `string` | No | Only a document in this locale, such as `en-us`. Defaults to `*`, any locale. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `uid` | `string \| null` | No | — |
| `type` | `string \| null` | No | The custom type id. |
| `lang` | `string \| null` | No | — |
| `tags` | `string[] \| null` | No | — |
| `data` | `Record<string, JsonValue> \| null` | No | — |
| `slugs` | `string[] \| null` | No | — |
| `href` | `string \| null` | No | — |
| `url` | `string \| null` | No | Absent on a document with no route set. |
| `first_publication_date` | `string \| null` | No | — |
| `last_publication_date` | `string \| null` | No | — |
| `alternate_languages` | `object[] \| null` | No | — |
| `linked_documents` | `JsonValue[] \| null` | No | — |

> [accordion] alternate\_languages full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   lang?: string | null,
>   type?: string | null,
>   uid?: string | null
> }[] | null
> ```

***

### search

`documents.search`

Query published documents with Prismic predicates, ordering, tags and locale at the master ref or a given one, paged by number or by `next_page`

**Risk:** `read`

```ts theme={null}
await corsair.prismic.api.documents.search({ pageSize: 20, orderings: '[my.page.date desc]' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | 1-based page number. |
| `pageSize` | `number` | No | Documents per page. Prismic caps this at 100 on most plans, so a full page means another page may exist. |
| `orderings` | `string` | No | An ordering such as `[my.page.date desc]`; several fields go comma-separated in one pair of brackets, such as `[my.page.date desc,my.page.title]`. |
| `q` | `string` | No | A Prismic predicate expression such as `[[at(document.type, "page")]]`. |
| `lang` | `string` | No | Only documents in this locale, such as `en-us`. Also accepts `*`. |
| `tags` | `string[]` | No | Only documents carrying every one of these tags. Sent as an `at(document.tags, [...])` predicate added to `q`. |
| `after` | `string` | No | The `id` of the last document on the previous page; returns the documents after it, with the same `q`, `orderings` and other filters. More reliable than `page` for a changing dataset. |
| `ref` | `string` | No | Pins the query to a ref, such as a release preview. Defaults to the repository's master ref, which the plugin reads from the repository metadata first. |
| `nextPage` | `string` | No | The previous answer's `next_page`. It already carries the ref and every filter, so the other fields are ignored when it is set. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number \| null` | No | — |
| `results_per_page` | `number \| null` | No | — |
| `results_size` | `number \| null` | No | — |
| `total_results_size` | `number \| null` | No | — |
| `total_pages` | `number \| null` | No | — |
| `next_page` | `string \| null` | No | The absolute next page URL. Absent on the last page. |
| `prev_page` | `string \| null` | No | — |
| `results` | `object[]` | Yes | — |

> [accordion] results full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   uid?: string | null,
>   type?: string | null,
>   lang?: string | null,
>   tags?: string[] | null,
>   data?: Record<string, JsonValue> | null,
>   slugs?: string[] | null,
>   href?: string | null,
>   url?: string | null,
>   first_publication_date?: string | null,
>   last_publication_date?: string | null,
>   alternate_languages?: {
>     id?: string | null,
>     lang?: string | null,
>     type?: string | null,
>     uid?: string | null
>   }[] | null,
>   linked_documents?: JsonValue[] | null
> }[]
> ```

***

## Migration

### create

`migration.create`

Create one page as a draft in a migration release. It is not published until the release is published, and Prismic accepts one page per request at one request per second

**Risk:** `write`

```ts theme={null}
await corsair.prismic.api.migration.create({ title: 'Example page', type: 'page', uid: 'example-page', lang: 'en-us', tags: ['Red'], data: {} });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | Yes | The display title shown in the page list. |
| `type` | `string` | Yes | The custom type id. |
| `uid` | `string` | No | The document UID, unique within its type. Required if the type has one. |
| `lang` | `string` | Yes | The locale code, such as `en-us`. |
| `data` | `Record<string, JsonValue>` | Yes | The document's fields and slices. Each key is a field or slice zone on the type. |
| `tags` | `string[]` | No | — |
| `alternate_language_id` | `string` | No | The document this one translates. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `uid` | `string \| null` | No | — |
| `type` | `string \| null` | No | — |
| `lang` | `string \| null` | No | — |
| `title` | `string \| null` | No | — |

***

### update

`migration.update`

Update one existing page. The type, locale and translation link cannot be changed, and omitting `tags` deletes them all

**Risk:** `write`

```ts theme={null}
await corsair.prismic.api.migration.update({ id: 'ZMI65RQAADkECUFM', title: 'Updated title', data: { summary: 'Updated text' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | The id of the document to update. |
| `uid` | `string` | No | The document UID, unique within its type. Required if the type has one. |
| `data` | `Record<string, JsonValue>` | Yes | The document's full content. Prismic requires it on every update and replaces the stored content with it. |
| `title` | `string` | No | — |
| `tags` | `string[]` | No | Replaces the existing tags; omitting it deletes them all. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `uid` | `string \| null` | No | — |
| `type` | `string \| null` | No | — |
| `lang` | `string \| null` | No | — |
| `title` | `string \| null` | No | — |

***

## Repository

### info

`repository.info`

Read the repository's refs, custom types, languages and tags. Document reads use the master ref unless given another one

**Risk:** `read`

```ts theme={null}
await corsair.prismic.api.repository.info({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `repository` | `string` | No | Overrides the plugin option for this call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `refs` | `object[]` | Yes | Every ref, including `master` and any open releases. |
| `bookmarks` | `Record<string, string> \| null` | No | Saved queries by name. |
| `types` | `Record<string, string> \| null` | No | Custom type ids to their display labels. |
| `languages` | `object[] \| null` | No | — |
| `tags` | `string[] \| null` | No | — |
| `integrationFieldsRef` | `string \| null` | No | — |
| `license` | `string \| null` | No | — |
| `version` | `string \| null` | No | — |

> [accordion] refs full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   ref?: string | null,
>   label?: string | null,
>   isMasterRef?: boolean | null
> }[]
> ```

> [accordion] languages full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null
> }[] | null
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.