> ## 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.

# Ragie API reference

> API reference for the Ragie plugin in Corsair: every `ragie.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).

## Authenticators

### create

`authenticators.create`

Register your own OAuth app (client id and secret) for a provider's connections

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.authenticators.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `provider` | `string` | Yes | OAuth provider: google, atlassian, dropbox, hubspot, microsoft, notion, salesforce or slack |
| `name` | `string` | Yes | — |
| `client_id` | `string` | Yes | — |
| `client_secret` | `string` | Yes | — |
| `domain` | `string \| null` | No | — |
| `project_number` | `string \| null` | No | — |

Registers your own OAuth app for a provider; the client secret is sent once and never logged.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `provider` | `string` | Yes | — |

***

### createConnection

`authenticators.createConnection`

Create a connection through your own OAuth app; it starts syncing and processing pages, which is billed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.authenticators.createConnection({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `authenticator_id` | `string` | Yes | The authenticator id |
| `connection` | `Record<string, any>` | Yes | The provider connection: provider, data and the user's OAuth credentials |
| `partition_strategy` | `hi_res \| fast \| agentic_ocr \| object` | Yes | hi\_res, fast or agentic\_ocr (sent as \{ static: ... }), or a per-media-type mode object |
| `partition` | `string \| null` | No | — |
| `page_limit` | `number \| null` | No | — |
| `config` | `Record<string, any> \| null` | No | — |
| `metadata` | `Record<string, any>` | No | — |
| `workflow` | `string \| null` | No | — |
| `sync_filter` | `Record<string, any>` | No | — |

> [accordion] partition\_strategy full type
>
> ```ts theme={null}
> hi_res | fast | agentic_ocr | {
>   static?: hi_res | fast | agentic_ocr | null,
>   audio?: boolean | null,
>   video?: audio_only | video_only | audio_video | null
> }
> ```

**Output:** `Record<string, any>`

***

### delete

`authenticators.delete`

Delete an OAuth app registration

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.authenticators.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `authenticator_id` | `string` | Yes | The authenticator id |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | No | — |

***

### list

`authenticators.list`

List your own OAuth apps registered for connections, paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.authenticators.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string` | No | Cursor from the previous page |
| `page_size` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `authenticators` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] authenticators full type
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   provider: string
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

## Connections

### create

`connections.create`

Create a non-OAuth connector such as S3, GCS, Freshdesk, Zendesk, Intercom or a web crawler, with its settings and credentials

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.connections.create({ connection: { provider: 'gcs', data: { bucket: 'acme-docs' }, credentials: { service_account_json: '...' } } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection` | `object` | Yes | — |
| `partition_strategy` | `object` | Yes | How files are processed, per media type (PublicCreateConnection requires it), e.g. \{ static: "hi\_res" }. |
| `page_limit` | `number \| null` | No | Monthly page cap for this connection. |

The path is singular: POST /connection, while every other connection route is plural. Non-OAuth providers only.

> [accordion] connection full type
>
> ```ts theme={null}
> {
>   provider: string,
>   data: Record<string, any>,
>   credentials?: Record<string, any>
> }
> ```

> [accordion] partition\_strategy full type
>
> ```ts theme={null}
> {
>   static?: hi_res | fast | agentic_ocr | null,
>   audio?: boolean | null,
>   video?: audio_only | video_only | audio_video | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `type` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `source` | `string \| string[] \| Record<string, any> \| null` | No | — |
| `enabled` | `boolean` | Yes | — |
| `disabled_by_system_reason` | `connection_over_total_page_limit \| authentication_failed \| tenant_account_disabled \| null` | Yes | — |
| `last_synced_at` | `string \| null` | No | — |
| `syncing` | `boolean \| null` | No | — |
| `partition` | `string \| null` | No | — |
| `page_limit` | `number \| null` | Yes | — |
| `sync_filter` | `Record<string, any>` | Yes | — |
| `disabled_by_system` | `boolean` | Yes | — |

***

### createOAuthRedirectUrl

`connections.createOAuthRedirectUrl`

Start an OAuth connector flow (Google Drive, Notion and the like) and get the short-lived redirect URL to send the user to

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.connections.createOAuthRedirectUrl({ redirect_uri: 'https://app.example.com/oauth/ragie', source_type: 'google_drive' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `redirect_uri` | `string` | Yes | Where Ragie sends the user back. |
| `source_type` | `string` | Yes | An OAuth connector, such as google\_drive or notion. |
| `partition` | `string` | No | — |
| `page_limit` | `number \| null` | No | — |

Returns a short-lived OAuth redirect URL; it is an auth artifact, so the operation is a write.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | The short-lived URL to open the OAuth flow at. |

***

### delete

`connections.delete`

Delete a connection. With keep\_files false its documents are deleted too and cannot be recovered; with true the documents survive unlinked

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.ragie.api.connections.delete({ connection_id: 'f83f5c92-1fae-4a37-8f3e-23914e2b9c1d', keep_files: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |
| `keep_files` | `boolean` | Yes | Keep the ingested documents when the connection is removed. With false every document from this connection is deleted and cannot be recovered. |

A POST to /connections/\{id}/delete, not a DELETE method. With keep\_files false the documents are deleted irreversibly; deletion runs asynchronously, so files can linger briefly either way.

**Output:** `Record<string, string>`

***

### get

`connections.get`

Read one connection, including its sync state and limits

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.connections.get({ connection_id: 'f83f5c92-1fae-4a37-8f3e-23914e2b9c1d' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | The connection's `id`. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `type` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `source` | `string \| string[] \| Record<string, any> \| null` | No | — |
| `enabled` | `boolean` | Yes | — |
| `disabled_by_system_reason` | `connection_over_total_page_limit \| authentication_failed \| tenant_account_disabled \| null` | Yes | — |
| `last_synced_at` | `string \| null` | No | — |
| `syncing` | `boolean \| null` | No | — |
| `partition` | `string \| null` | No | — |
| `page_limit` | `number \| null` | Yes | — |
| `sync_filter` | `Record<string, any>` | Yes | — |
| `disabled_by_system` | `boolean` | Yes | — |

***

### getStats

`connections.getStats`

Read a connection's document and page counts

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.connections.getStats({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | The connection id |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_count` | `number` | Yes | — |
| `page_count` | `number` | Yes | — |

***

### list

`connections.list`

List managed data connectors, paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.connections.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string` | No | The next page cursor from a previous response. |
| `page_size` | `number` | No | Page size; Ragie documents 100 as the maximum. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `connections` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] connections full type
>
> ```ts theme={null}
> {
>   id: string,
>   created_at: string,
>   updated_at: string,
>   metadata: Record<string, string | number | boolean | string[]>,
>   type: string,
>   name: string,
>   source?: string | string[] | Record<string, any> | null,
>   enabled: boolean,
>   disabled_by_system_reason: connection_over_total_page_limit | authentication_failed | tenant_account_disabled | null,
>   last_synced_at?: string | null,
>   syncing?: boolean | null,
>   partition?: string | null,
>   page_limit: number | null,
>   sync_filter: Record<string, any>,
>   disabled_by_system: boolean
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### listSourceTypes

`connections.listSourceTypes`

List the connector types Ragie supports, with the metadata each needs

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.connections.listSourceTypes({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `connectors` | `object[]` | Yes | — |

> [accordion] connectors full type
>
> ```ts theme={null}
> {
>   source_type: string,
>   display_name?: string | null,
>   icon_url?: string | null,
>   docs_url?: string | null
> }[]
> ```

***

### setEnabled

`connections.setEnabled`

Enable or disable a connection syncing

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.connections.setEnabled({ connection_id: 'f83f5c92-1fae-4a37-8f3e-23914e2b9c1d', enabled: false });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |
| `enabled` | `boolean` | Yes | Whether the connection syncs. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `type` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `source` | `string \| string[] \| Record<string, any> \| null` | No | — |
| `enabled` | `boolean` | Yes | — |
| `disabled_by_system_reason` | `connection_over_total_page_limit \| authentication_failed \| tenant_account_disabled \| null` | Yes | — |
| `last_synced_at` | `string \| null` | No | — |
| `syncing` | `boolean \| null` | No | — |
| `partition` | `string \| null` | No | — |
| `page_limit` | `number \| null` | Yes | — |
| `sync_filter` | `Record<string, any>` | Yes | — |
| `disabled_by_system` | `boolean` | Yes | — |

***

### setLimits

`connections.setLimits`

Set the monthly page limit on a connection; null removes the limit

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.connections.setLimits({ connection_id: 'f83f5c92-1fae-4a37-8f3e-23914e2b9c1d', page_limit: 1000 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |
| `page_limit` | `number \| null` | Yes | Monthly pages the connection may sync. Sending null removes the limit. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `type` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `source` | `string \| string[] \| Record<string, any> \| null` | No | — |
| `enabled` | `boolean` | Yes | — |
| `disabled_by_system_reason` | `connection_over_total_page_limit \| authentication_failed \| tenant_account_disabled \| null` | Yes | — |
| `last_synced_at` | `string \| null` | No | — |
| `syncing` | `boolean \| null` | No | — |
| `partition` | `string \| null` | No | — |
| `page_limit` | `number \| null` | Yes | — |
| `sync_filter` | `Record<string, any>` | Yes | — |
| `disabled_by_system` | `boolean` | Yes | — |

***

### sync

`connections.sync`

Schedule a connector to sync as soon as possible; the sync itself runs in the background

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.connections.sync({ connection_id: 'f83f5c92-1fae-4a37-8f3e-23914e2b9c1d' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | The connection's `id`. |

**Output:** *empty object*

***

### update

`connections.update`

Update a connection metadata, mode, partition strategy or page limit

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.connections.update({ connection_id: 'f83f5c92-1fae-4a37-8f3e-23914e2b9c1d', metadata: { team: 'support' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | No | — |
| `mode` | `string` | No | Sync mode; the reachable sources document no value list, so it is sent unchanged. |
| `partition_strategy` | `hi_res \| fast \| agentic_ocr \| object` | Yes | hi\_res, fast, agentic\_ocr, or a per-media-type object (ConnectionBase requires it). |
| `page_limit` | `number \| null` | No | — |

Sends partition\_strategy and page\_limit flat beside metadata and mode, per the saved SDK evidence; that body arrangement is unverified until a live key confirms it.

> [accordion] partition\_strategy full type
>
> ```ts theme={null}
> hi_res | fast | agentic_ocr | {
>   static?: hi_res | fast | agentic_ocr | null,
>   audio?: boolean | null,
>   video?: audio_only | video_only | audio_video | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `type` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `source` | `string \| string[] \| Record<string, any> \| null` | No | — |
| `enabled` | `boolean` | Yes | — |
| `disabled_by_system_reason` | `connection_over_total_page_limit \| authentication_failed \| tenant_account_disabled \| null` | Yes | — |
| `last_synced_at` | `string \| null` | No | — |
| `syncing` | `boolean \| null` | No | — |
| `partition` | `string \| null` | No | — |
| `page_limit` | `number \| null` | Yes | — |
| `sync_filter` | `Record<string, any>` | Yes | — |
| `disabled_by_system` | `boolean` | Yes | — |

***

## Documents

### create

`documents.create`

Upload a file for ingestion. Processing runs in the background: poll documents.get until status is ready or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.documents.create({ file: { url: 'https://example.com/handbook.pdf' }, name: 'handbook.pdf' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `file` | `string \| object \| custom` | Yes | The file: a public URL, \{url, filename?, contentType?}, or \{base64, filename?, contentType?}; or a Blob or File from TypeScript. |
| `mode` | `fast \| hi_res` | No | How PDFs are processed. Defaults to fast. |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | No | — |
| `name` | `string` | No | — |
| `external_id` | `string` | No | — |
| `partition` | `string` | No | — |

Multipart upload; a metadata object is JSON-stringified inside its form field, the way the official SDK sends it. Returns at once with status pending; poll documents.get until ready or failed.

> [accordion] file full type
>
> ```ts theme={null}
> string | {
>   url: string,
>   filename?: string,
>   contentType?: string
> } | {
>   base64: string,
>   filename?: string,
>   contentType?: string
> } | custom
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `status` | `string \| null` | No | — |
| `name` | `string` | Yes | — |
| `external_id` | `string \| null` | No | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `partition` | `string` | Yes | — |
| `chunk_count` | `number \| null` | No | — |
| `page_count` | `number \| null` | No | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |

***

### createFromUrl

`documents.createFromUrl`

Fetch a URL and ingest its content. Processing runs in the background: poll documents.get until status is ready or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.documents.createFromUrl({ url: 'https://example.com/handbook.pdf' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | The URL to fetch and ingest. |
| `mode` | `fast \| hi_res` | No | How PDFs are processed. Defaults to fast. |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | No | — |
| `name` | `string` | No | — |
| `external_id` | `string` | No | — |
| `partition` | `string` | No | — |

Returns at once with status pending; poll documents.get until ready or failed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `status` | `string \| null` | No | — |
| `name` | `string` | Yes | — |
| `external_id` | `string \| null` | No | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `partition` | `string` | Yes | — |
| `chunk_count` | `number \| null` | No | — |
| `page_count` | `number \| null` | No | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |

***

### createRaw

`documents.createRaw`

Ingest raw text. Processing runs in the background: poll documents.get until status is ready or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.documents.createRaw({ data: 'The refund window is thirty days.', name: 'refund policy' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `string` | Yes | The raw text to ingest. |
| `mode` | `fast \| hi_res` | No | How PDFs are processed. Defaults to fast. |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | No | — |
| `name` | `string` | No | — |
| `external_id` | `string` | No | — |
| `partition` | `string` | No | — |

Returns at once with status pending; poll documents.get until ready or failed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `status` | `string \| null` | No | — |
| `name` | `string` | Yes | — |
| `external_id` | `string \| null` | No | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `partition` | `string` | Yes | — |
| `chunk_count` | `number \| null` | No | — |
| `page_count` | `number \| null` | No | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |

***

### delete

`documents.delete`

Delete a document and its chunks. There is no restore call

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.ragie.api.documents.delete({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document's `id`. |
| `partition` | `string` | No | The partition the document is in; omit for the default partition |

**Output:** *empty object*

***

### get

`documents.get`

Read one document, including its processing status: pending, partitioning, partitioned, refined, chunked, indexed, summary\_indexed, keyword\_indexed, ready or failed

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.get({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document's `id`. |
| `partition` | `string` | No | The partition the document is in; omit for the default partition |

The job status read. Status walks pending, partitioning, partitioned, refined, chunked, indexed, summary\_indexed, keyword\_indexed, then ready or failed; the document is searchable from indexed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `status` | `pending \| partitioning \| partitioned \| refined \| chunked \| indexed \| summary_indexed \| keyword_indexed \| ready \| failed` | Yes | — |
| `name` | `string` | Yes | — |
| `external_id` | `string \| null` | No | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `partition` | `string` | Yes | — |
| `chunk_count` | `number \| null` | No | — |
| `page_count` | `number \| null` | No | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |

***

### getChunk

`documents.getChunk`

Read one chunk of a document: its text, metadata and links

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.getChunk({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document id |
| `chunk_id` | `string` | Yes | The chunk id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `index` | `number` | No | — |
| `text` | `string` | Yes | — |
| `metadata` | `Record<string, any>` | No | — |
| `links` | `Record<string, any>` | No | — |
| `modality_data` | `Record<string, any> \| null` | No | — |

***

### getChunkContent

`documents.getChunkContent`

Download one chunk as text, audio, video or image (media\_type), returned as a file

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.getChunkContent({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document id |
| `chunk_id` | `string` | Yes | The chunk id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |
| `media_type` | `text/plain \| audio/mpeg \| video/mp4 \| image/webp \| image/heic \| image/bmp \| image/png \| image/jpeg \| image/tiff` | No | The format to return; defaults to the chunk text |
| `range` | `string` | No | HTTP Range for audio and video, e.g. bytes=0-1023 |

Returns the chunk as a file in `media_type` (text/plain by default; audio/mpeg, video/mp4 or an image type for media chunks). `range` asks for part of an audio or video stream.

**Output:** *empty object*

***

### getChunks

`documents.getChunks`

List the chunks a document was split into, paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.getChunks({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `partition` | `string` | No | The partition the document is in; omit for the default partition |
| `document_id` | `string` | Yes | — |
| `cursor` | `string` | No | The next page cursor from a previous response. |
| `page_size` | `number` | No | Page size; Ragie documents 100 as the maximum. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `chunks` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] chunks full type
>
> ```ts theme={null}
> {
>   id: string,
>   index?: number | null,
>   text: string,
>   metadata?: Record<string, any> | null,
>   links?: Record<string, any> | null
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### getContent

`documents.getContent`

Read a document processed content as JSON. Audio and video media-type streaming is not wrapped

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.getContent({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document's `id`. |
| `partition` | `string` | No | The partition the document is in; omit for the default partition |

Returns the default JSON answer with the extracted text. For audio and video media use documents.getChunkContent, which returns files.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `status` | `string \| null` | No | — |
| `name` | `string` | Yes | — |
| `external_id` | `string \| null` | No | — |
| `metadata` | `Record<string, string \| number \| boolean \| string[]>` | Yes | — |
| `partition` | `string` | Yes | — |
| `chunk_count` | `number \| null` | No | — |
| `page_count` | `number \| null` | No | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `content` | `string \| null` | No | — |

***

### getSource

`documents.getSource`

Download the original file a document was made from

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.getSource({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |

Returns the original uploaded or fetched file as core file output.

**Output:** *empty object*

***

### getSummary

`documents.getSummary`

Read the LLM summary of a document; unavailable for spreadsheets, JSON and documents over a million tokens

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.getSummary({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document's `id`. |
| `partition` | `string` | No | The partition the document is in; omit for the default partition |

Beta. Unavailable for xls, xlsx, csv and json documents and documents over a million tokens.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `summary` | `string \| null` | No | — |

***

### list

`documents.list`

List documents with their processing status, paged by cursor; filter by a JSON metadata filter or partition

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.list({ page_size: 25 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `filter` | `string` | No | A metadata filter as a JSON string, such as '\{"department":"sales"}'. |
| `partition` | `string` | No | — |
| `cursor` | `string` | No | The next page cursor from a previous response. |
| `page_size` | `number` | No | Page size; Ragie documents 100 as the maximum. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `documents` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] documents full type
>
> ```ts theme={null}
> {
>   id: string,
>   status?: string | null,
>   name: string,
>   external_id?: string | null,
>   metadata: Record<string, string | number | boolean | string[]>,
>   partition: string,
>   chunk_count?: number | null,
>   page_count?: number | null,
>   created_at: string,
>   updated_at: string
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### listElements

`documents.listElements`

List the structural elements Ragie parsed from a document (titles, text, tables, images), paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.listElements({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |
| `type` | `string[]` | No | Only these element types (text, table, image, title...) |
| `index_start` | `number` | No | — |
| `index_end` | `number` | No | — |
| `cursor` | `string` | No | Cursor from the previous page |
| `page_size` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_elements` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] document\_elements full type
>
> ```ts theme={null}
> {
>   id: string,
>   document_id?: string,
>   type?: string,
>   index?: number
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### listEntities

`documents.listEntities`

List the entities instructions extracted from one document, paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.documents.listEntities({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | The document id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |
| `cursor` | `string` | No | Cursor from the previous page |
| `page_size` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `entities` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] entities full type
>
> ```ts theme={null}
> {
>   id: string,
>   created_at?: string,
>   updated_at?: string,
>   instruction_id: string,
>   document_id: string,
>   chunk_id?: string | null,
>   data: Record<string, any>
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### patchMetadata

`documents.patchMetadata`

Merge metadata onto a document; a null value deletes that key

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.documents.patchMetadata({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882', metadata: { department: 'support', old_tag: null } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | — |
| `partition` | `string` | No | The partition the document is in; omit for the default partition |
| `metadata` | `Record<string, string \| number \| boolean \| string[] \| null>` | Yes | Metadata to merge; a null value deletes that key. |

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   metadata: Record<string, string | number | boolean | string[]>
> } | {
>   status: string
> }
> ```

***

### updateFile

`documents.updateFile`

Replace a document with a new file. Reprocessing runs in the background: poll documents.get until status is ready or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.documents.updateFile({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882', file: { url: 'https://example.com/handbook-v2.pdf' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | — |
| `file` | `string \| object \| custom` | Yes | The file: a public URL, \{url, filename?, contentType?}, or \{base64, filename?, contentType?}; or a Blob or File from TypeScript. |
| `partition` | `string` | No | — |

Replaces the content and reprocesses; poll documents.get until ready or failed.

> [accordion] file full type
>
> ```ts theme={null}
> string | {
>   url: string,
>   filename?: string,
>   contentType?: string
> } | {
>   base64: string,
>   filename?: string,
>   contentType?: string
> } | custom
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | Yes | — |

***

### updateFromUrl

`documents.updateFromUrl`

Replace a document with content fetched from a URL. Reprocessing runs in the background: poll documents.get until status is ready or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.documents.updateFromUrl({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882', url: 'https://example.com/handbook-v2.pdf' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | — |
| `url` | `string` | Yes | The URL to fetch as the replacement content. |
| `partition` | `string` | No | — |

Replaces the content and reprocesses; poll documents.get until ready or failed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | Yes | — |

***

### updateRaw

`documents.updateRaw`

Replace a document with new raw text. Reprocessing runs in the background: poll documents.get until status is ready or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.documents.updateRaw({ document_id: 'b5331205-e0ee-4bb9-9d01-6d9a01d9e882', data: 'Updated policy text.' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `document_id` | `string` | Yes | — |
| `data` | `string` | Yes | The replacement raw text. |
| `partition` | `string` | No | — |

Replaces the content and reprocesses; poll documents.get until ready or failed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | Yes | — |

***

## Elements

### get

`elements.get`

Read one parsed document element

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.elements.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `element_id` | `string` | Yes | The element id |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `document_id` | `string` | No | — |
| `type` | `string` | No | — |
| `index` | `number` | No | — |

***

## Instructions

### create

`instructions.create`

Create an entity extraction instruction; it runs on matching documents and their extraction is billed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.instructions.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Unique instruction name |
| `prompt` | `string` | Yes | What to extract |
| `entity_schema` | `Record<string, any>` | Yes | JSON schema of each extracted entity |
| `partition` | `string` | No | — |
| `active` | `boolean` | No | — |
| `scope` | `document \| chunk` | No | Run once per document, or once per chunk |
| `context_template` | `string` | No | — |
| `filter` | `Record<string, any>` | No | Metadata filter for which documents it runs on |

Runs on every matching document (and new ones while active); extraction is billed per page. `scope: chunk` runs once per chunk.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | No | — |
| `updated_at` | `string` | No | — |
| `name` | `string` | Yes | — |
| `active` | `boolean` | No | — |
| `scope` | `string` | No | — |
| `prompt` | `string` | No | — |
| `context_template` | `string \| null` | No | — |
| `entity_schema` | `Record<string, any>` | No | — |
| `filter` | `Record<string, any> \| null` | No | — |
| `partition` | `string \| null` | No | — |

***

### delete

`instructions.delete`

Delete an instruction and the entities it extracted

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.ragie.api.instructions.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `instruction_id` | `string` | Yes | The instruction id |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | No | — |

***

### list

`instructions.list`

List entity extraction instructions

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.instructions.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `instructions` | `object[]` | Yes | — |

> [accordion] instructions full type
>
> ```ts theme={null}
> {
>   id: string,
>   created_at?: string,
>   updated_at?: string,
>   name: string,
>   active?: boolean,
>   scope?: string,
>   prompt?: string,
>   context_template?: string | null,
>   entity_schema?: Record<string, any>,
>   filter?: Record<string, any> | null,
>   partition?: string | null
> }[]
> ```

***

### listEntities

`instructions.listEntities`

List the entities one instruction extracted, paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.instructions.listEntities({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `instruction_id` | `string` | Yes | The instruction id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |
| `cursor` | `string` | No | Cursor from the previous page |
| `page_size` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `entities` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] entities full type
>
> ```ts theme={null}
> {
>   id: string,
>   created_at?: string,
>   updated_at?: string,
>   instruction_id: string,
>   document_id: string,
>   chunk_id?: string | null,
>   data: Record<string, any>
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### listExtractionLogs

`instructions.listExtractionLogs`

List extraction attempts for an instruction with status and reasons, filterable by document, status and date

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.instructions.listExtractionLogs({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `instruction_id` | `string` | Yes | The instruction id |
| `partition` | `string` | No | The partition to read from; omit for the default partition |
| `document_ids` | `string[]` | No | — |
| `status` | `extracted \| not_found \| error` | No | — |
| `created_after` | `string` | No | ISO 8601 datetime |
| `created_before` | `string` | No | ISO 8601 datetime |
| `cursor` | `string` | No | Cursor from the previous page |
| `page_size` | `number` | No | — |

Filter by `document_ids`, `status` (extracted, not\_found, error) and `created_after` / `created_before` (ISO 8601).

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   id: string,
>   instruction_id?: string,
>   document_id?: string,
>   scope?: string,
>   chunk_index?: number | null,
>   status: string,
>   reason_code?: string | null,
>   reason?: string | null,
>   errors?: string[],
>   page_count?: number
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### update

`instructions.update`

Change an instruction's prompt, schema, filter or active flag

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.instructions.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `instruction_id` | `string` | Yes | The instruction id |
| `name` | `string` | No | — |
| `prompt` | `string` | No | — |
| `entity_schema` | `Record<string, any>` | No | — |
| `active` | `boolean` | No | — |
| `scope` | `document \| chunk` | No | Run once per document, or once per chunk |
| `context_template` | `string` | No | — |
| `filter` | `Record<string, any>` | No | Metadata filter for which documents it runs on |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | No | — |
| `updated_at` | `string` | No | — |
| `name` | `string` | Yes | — |
| `active` | `boolean` | No | — |
| `scope` | `string` | No | — |
| `prompt` | `string` | No | — |
| `context_template` | `string \| null` | No | — |
| `entity_schema` | `Record<string, any>` | No | — |
| `filter` | `Record<string, any> \| null` | No | — |
| `partition` | `string \| null` | No | — |

***

## Partitions

### create

`partitions.create`

Create a partition with optional page and media limits and a metadata schema

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.partitions.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Partition name: lowercase letters, numbers, \_ and - |
| `description` | `string \| null` | No | — |
| `metadata_schema` | `Record<string, any> \| null` | No | JSON schema for document metadata in this partition |
| `pages_hosted_limit_monthly` | `number \| null` | No | — |
| `pages_processed_limit_monthly` | `number \| null` | No | — |
| `pages_hosted_limit_max` | `number \| null` | No | — |
| `pages_processed_limit_max` | `number \| null` | No | — |
| `audio_processed_limit_monthly` | `number \| null` | No | — |
| `audio_processed_limit_max` | `number \| null` | No | — |
| `video_processed_limit_monthly` | `number \| null` | No | — |
| `video_processed_limit_max` | `number \| null` | No | — |
| `media_streamed_limit_monthly` | `number \| null` | No | — |
| `media_streamed_limit_max` | `number \| null` | No | — |
| `media_hosted_limit_monthly` | `number \| null` | No | — |
| `media_hosted_limit_max` | `number \| null` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `is_default` | `boolean` | No | — |
| `limit_exceeded_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `context_aware` | `boolean` | No | — |
| `metadata_schema` | `Record<string, any> \| null` | No | — |
| `limits` | `object` | No | — |
| `stats` | `Record<string, any>` | No | — |

> [accordion] limits full type
>
> ```ts theme={null}
> {
>   pages_hosted_limit_monthly?: number | null,
>   pages_processed_limit_monthly?: number | null,
>   pages_hosted_limit_max?: number | null,
>   pages_processed_limit_max?: number | null,
>   audio_processed_limit_monthly?: number | null,
>   audio_processed_limit_max?: number | null,
>   video_processed_limit_monthly?: number | null,
>   video_processed_limit_max?: number | null,
>   media_streamed_limit_monthly?: number | null,
>   media_streamed_limit_max?: number | null,
>   media_hosted_limit_monthly?: number | null,
>   media_hosted_limit_max?: number | null
> }
> ```

***

### delete

`partitions.delete`

Delete a partition and every document in it

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.ragie.api.partitions.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `partition_id` | `string` | Yes | Partition name: lowercase letters, numbers, \_ and - |
| `async` | `boolean` | No | Delete in the background and answer at once |

Deletes the partition and every document in it; it cannot be undone. `async: true` answers at once and deletes in the background.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | No | — |

***

### get

`partitions.get`

Read a partition with its limits and usage stats

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.partitions.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `partition_id` | `string` | Yes | Partition name: lowercase letters, numbers, \_ and - |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `is_default` | `boolean` | No | — |
| `limit_exceeded_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `context_aware` | `boolean` | No | — |
| `metadata_schema` | `Record<string, any> \| null` | No | — |
| `limits` | `object` | No | — |
| `stats` | `Record<string, any>` | No | — |

> [accordion] limits full type
>
> ```ts theme={null}
> {
>   pages_hosted_limit_monthly?: number | null,
>   pages_processed_limit_monthly?: number | null,
>   pages_hosted_limit_max?: number | null,
>   pages_processed_limit_max?: number | null,
>   audio_processed_limit_monthly?: number | null,
>   audio_processed_limit_max?: number | null,
>   video_processed_limit_monthly?: number | null,
>   video_processed_limit_max?: number | null,
>   media_streamed_limit_monthly?: number | null,
>   media_streamed_limit_max?: number | null,
>   media_hosted_limit_monthly?: number | null,
>   media_hosted_limit_max?: number | null
> }
> ```

***

### list

`partitions.list`

List partitions with their limits, paged by cursor

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.partitions.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string` | No | Cursor from the previous page |
| `page_size` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `partitions` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] partitions full type
>
> ```ts theme={null}
> {
>   name: string,
>   is_default?: boolean,
>   limit_exceeded_at?: string | null,
>   description?: string | null,
>   context_aware?: boolean,
>   metadata_schema?: Record<string, any> | null,
>   limits?: {
>     pages_hosted_limit_monthly?: number | null,
>     pages_processed_limit_monthly?: number | null,
>     pages_hosted_limit_max?: number | null,
>     pages_processed_limit_max?: number | null,
>     audio_processed_limit_monthly?: number | null,
>     audio_processed_limit_max?: number | null,
>     video_processed_limit_monthly?: number | null,
>     video_processed_limit_max?: number | null,
>     media_streamed_limit_monthly?: number | null,
>     media_streamed_limit_max?: number | null,
>     media_hosted_limit_monthly?: number | null,
>     media_hosted_limit_max?: number | null
>   },
>   stats?: Record<string, any>
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### setLimits

`partitions.setLimits`

Set a partition's monthly and maximum page and media limits

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.partitions.setLimits({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `partition_id` | `string` | Yes | Partition name: lowercase letters, numbers, \_ and - |
| `pages_hosted_limit_monthly` | `number \| null` | No | — |
| `pages_processed_limit_monthly` | `number \| null` | No | — |
| `pages_hosted_limit_max` | `number \| null` | No | — |
| `pages_processed_limit_max` | `number \| null` | No | — |
| `audio_processed_limit_monthly` | `number \| null` | No | — |
| `audio_processed_limit_max` | `number \| null` | No | — |
| `video_processed_limit_monthly` | `number \| null` | No | — |
| `video_processed_limit_max` | `number \| null` | No | — |
| `media_streamed_limit_monthly` | `number \| null` | No | — |
| `media_streamed_limit_max` | `number \| null` | No | — |
| `media_hosted_limit_monthly` | `number \| null` | No | — |
| `media_hosted_limit_max` | `number \| null` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `is_default` | `boolean` | No | — |
| `limit_exceeded_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `context_aware` | `boolean` | No | — |
| `metadata_schema` | `Record<string, any> \| null` | No | — |
| `limits` | `object` | No | — |
| `stats` | `Record<string, any>` | No | — |

> [accordion] limits full type
>
> ```ts theme={null}
> {
>   pages_hosted_limit_monthly?: number | null,
>   pages_processed_limit_monthly?: number | null,
>   pages_hosted_limit_max?: number | null,
>   pages_processed_limit_max?: number | null,
>   audio_processed_limit_monthly?: number | null,
>   audio_processed_limit_max?: number | null,
>   video_processed_limit_monthly?: number | null,
>   video_processed_limit_max?: number | null,
>   media_streamed_limit_monthly?: number | null,
>   media_streamed_limit_max?: number | null,
>   media_hosted_limit_monthly?: number | null,
>   media_hosted_limit_max?: number | null
> }
> ```

***

### update

`partitions.update`

Change a partition's description, context awareness or metadata schema

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.partitions.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `partition_id` | `string` | Yes | Partition name: lowercase letters, numbers, \_ and - |
| `context_aware` | `boolean \| null` | No | — |
| `description` | `string \| null` | No | — |
| `metadata_schema` | `Record<string, any> \| null` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `is_default` | `boolean` | No | — |
| `limit_exceeded_at` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `context_aware` | `boolean` | No | — |
| `metadata_schema` | `Record<string, any> \| null` | No | — |
| `limits` | `object` | No | — |
| `stats` | `Record<string, any>` | No | — |

> [accordion] limits full type
>
> ```ts theme={null}
> {
>   pages_hosted_limit_monthly?: number | null,
>   pages_processed_limit_monthly?: number | null,
>   pages_hosted_limit_max?: number | null,
>   pages_processed_limit_max?: number | null,
>   audio_processed_limit_monthly?: number | null,
>   audio_processed_limit_max?: number | null,
>   video_processed_limit_monthly?: number | null,
>   video_processed_limit_max?: number | null,
>   media_streamed_limit_monthly?: number | null,
>   media_streamed_limit_max?: number | null,
>   media_hosted_limit_monthly?: number | null,
>   media_hosted_limit_max?: number | null
> }
> ```

***

## Responses

### create

`responses.create`

Generate a grounded answer with the deep-search model. Bills LLM usage; poll responses.get until status is completed or failed

**Risk:** `destructive`

```ts theme={null}
await corsair.ragie.api.responses.create({ input: 'What is the refund window?' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `input` | `string` | Yes | What to answer, grounded in retrieved documents. |

Bills LLM usage with the deep-search model. Plan exhaustion answers 402 and is never retried. Poll responses.get until completed or failed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `object` | `string \| null` | No | — |
| `created_at` | `number` | Yes | — |
| `status` | `in_progress \| completed \| failed \| cancelled` | Yes | — |
| `error` | `string \| null` | No | — |
| `incomplete_details` | `any \| null` | No | — |
| `instructions` | `string \| null` | No | — |
| `max_output_tokens` | `any \| null` | No | — |
| `model` | `string \| null` | No | — |
| `output` | `any[]` | Yes | — |
| `output_parsed` | `any \| null` | No | — |
| `tools` | `any[] \| null` | No | — |
| `reasoning` | `any \| null` | No | — |
| `parallel_tool_calls` | `boolean \| null` | No | — |
| `store` | `boolean \| null` | No | — |
| `temperature` | `number \| null` | No | — |
| `previous_response_id` | `string \| null` | No | — |
| `tool_choice` | `string \| null` | No | — |
| `top_p` | `number \| null` | No | — |
| `truncation` | `string \| null` | No | — |
| `usage` | `object` | Yes | — |
| `user` | `any \| null` | No | — |
| `metadata` | `Record<string, any> \| null` | No | — |

> [accordion] usage full type
>
> ```ts theme={null}
> {
>   input_tokens?: number | null,
>   output_tokens?: number | null,
>   total_tokens?: number | null
> }
> ```

***

### get

`responses.get`

Read a generated response, including its status and the final answer

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.responses.get({ response_id: 'e613d0b7-4c9a-45ed-b32c-302d7f1c5daf' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `response_id` | `string` | Yes | The response's `id`. |

The job status read: in\_progress, completed or failed.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `object` | `string \| null` | No | — |
| `created_at` | `number` | Yes | — |
| `status` | `in_progress \| completed \| failed \| cancelled` | Yes | — |
| `error` | `string \| null` | No | — |
| `incomplete_details` | `any \| null` | No | — |
| `instructions` | `string \| null` | No | — |
| `max_output_tokens` | `any \| null` | No | — |
| `model` | `string \| null` | No | — |
| `output` | `any[]` | Yes | — |
| `output_parsed` | `any \| null` | No | — |
| `tools` | `any[] \| null` | No | — |
| `reasoning` | `any \| null` | No | — |
| `parallel_tool_calls` | `boolean \| null` | No | — |
| `store` | `boolean \| null` | No | — |
| `temperature` | `number \| null` | No | — |
| `previous_response_id` | `string \| null` | No | — |
| `tool_choice` | `string \| null` | No | — |
| `top_p` | `number \| null` | No | — |
| `truncation` | `string \| null` | No | — |
| `usage` | `object` | Yes | — |
| `user` | `any \| null` | No | — |
| `metadata` | `Record<string, any> \| null` | No | — |

> [accordion] usage full type
>
> ```ts theme={null}
> {
>   input_tokens?: number | null,
>   output_tokens?: number | null,
>   total_tokens?: number | null
> }
> ```

***

## Retrievals

### retrieve

`retrievals.retrieve`

Search ingested documents and return scored chunks, optionally reranked and filtered by metadata operators

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.retrievals.retrieve({ query: 'what is the refund window', top_k: 8, rerank: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `query` | `string` | Yes | The text to search for. |
| `top_k` | `number` | No | Maximum chunks to return. Defaults to 8. |
| `filter` | `Record<string, any>` | No | A metadata filter object using $eq, $ne, $gt, $gte, $lt, $lte, $in or $nin. |
| `rerank` | `boolean` | No | Rerank chunks for semantic relevancy after retrieval. Slower but sharper. |
| `max_chunks_per_document` | `number` | No | Beta. Cap per document to widen the set of documents returned. |
| `partition` | `string` | No | — |
| `recency_bias` | `boolean` | No | Favor more recent documents over older ones. |

A read, and not documented as metered. filter takes the metadata operators $eq, $ne, $gt, $gte, $lt, $lte, $in and $nin.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `scored_chunks` | `object[]` | Yes | — |

> [accordion] scored\_chunks full type
>
> ```ts theme={null}
> {
>   text: string,
>   score: number,
>   id: string,
>   index: number,
>   metadata?: Record<string, any> | null,
>   document_id: string,
>   document_name: string,
>   document_metadata: Record<string, string | number | boolean | string[]>,
>   links?: Record<string, any> | null
> }[]
> ```

***

## Webhook Endpoints

### create

`webhookEndpoints.create`

Register a webhook endpoint. The answer carries its signing secret (reads of the endpoint return it too); keep it somewhere safe

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.webhookEndpoints.create({ name: 'document status', url: 'https://example.com/hooks/ragie' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | A name for the endpoint (required by Ragie) |
| `url` | `string` | Yes | Where Ragie POSTs tenant events. |
| `partition_pattern` | `string` | No | Pattern choosing which partitions a delivery is for; leave it out to receive every partition. |

The answer carries the signing secret for deliveries to this endpoint, so it is a write, never a read.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `url` | `string` | Yes | — |
| `partition_pattern` | `string \| null` | Yes | — |
| `active` | `boolean` | Yes | — |
| `secret` | `string` | Yes | — |

***

### delete

`webhookEndpoints.delete`

Delete a webhook endpoint registration; its signing secret stops working

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.ragie.api.webhookEndpoints.delete({ endpoint_id: '70a542b9-871a-42f4-a4a2-9f03a857e785' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpoint_id` | `string` | Yes | The webhook endpoint's `id`. |

**Output:** *empty object*

***

### get

`webhookEndpoints.get`

Read one webhook endpoint registration

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.webhookEndpoints.get({ endpoint_id: '70a542b9-871a-42f4-a4a2-9f03a857e785' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpoint_id` | `string` | Yes | The webhook endpoint's `id`. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `url` | `string` | Yes | — |
| `partition_pattern` | `string \| null` | Yes | — |
| `active` | `boolean` | Yes | — |
| `secret` | `string` | Yes | — |

***

### list

`webhookEndpoints.list`

List the webhook endpoints registered to receive tenant events, paged by cursor. This plugin verifies and handles the deliveries (see webhooks)

**Risk:** `read`

```ts theme={null}
await corsair.ragie.api.webhookEndpoints.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string` | No | The next page cursor from a previous response. |
| `page_size` | `number` | No | Page size; Ragie documents 100 as the maximum. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhook_endpoints` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] webhook\_endpoints full type
>
> ```ts theme={null}
> {
>   id: string,
>   created_at: string,
>   updated_at: string,
>   name: string,
>   url: string,
>   partition_pattern: string | null,
>   active: boolean,
>   secret: string
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   next_cursor?: string | null,
>   total_count?: number | null
> }
> ```

***

### update

`webhookEndpoints.update`

Update a webhook endpoint name, URL, partition pattern or active flag

**Risk:** `write`

```ts theme={null}
await corsair.ragie.api.webhookEndpoints.update({ endpoint_id: '70a542b9-871a-42f4-a4a2-9f03a857e785', active: false });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpoint_id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `url` | `string` | No | — |
| `partition_pattern` | `string \| null` | No | — |
| `active` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `url` | `string` | Yes | — |
| `partition_pattern` | `string \| null` | Yes | — |
| `active` | `boolean` | Yes | — |
| `secret` | `string` | Yes | — |

***


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