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

# PDFLess API reference

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

## Pdfs

### generate

`pdfs.generate`

Render a PDF from a document template and return its download link. Uses one document from the workspace quota.

**Risk:** `destructive`

```ts theme={null}
await corsair.pdfless.api.pdfs.generate({
	template_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
	payload: {
		customer: { name: 'Ada Lovelace' },
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `template_id` | `string` | Yes | Template id from templates.list. |
| `payload` | `Record<string, any>` | Yes | Values for the template variables, e.g. \{ "customer": \{ "name": "Ada" } }. |
| `reference_id` | `string` | No | Your own reference for the document, returned with it. |
| `workspaceId` | `number` | No | Workspace id. The API key already selects a workspace, so this is rarely needed. |
| `encryption_user_password` | `string` | No | Password needed to open the PDF. |
| `encryption_owner_password` | `string` | No | Owner password that controls the permissions below. |
| `encryption_allow_printing` | `boolean` | No | — |
| `encryption_allow_modifying` | `boolean` | No | — |
| `encryption_allow_modify_annotations` | `boolean` | No | — |
| `encryption_allow_content_copying` | `boolean` | No | — |
| `encryption_allow_screenreaders` | `boolean` | No | — |
| `encryption_allow_form_filling` | `boolean` | No | — |
| `encryption_allow_document_assembly` | `boolean` | No | — |

POST /v1/pdfs. `payload` fills the template's variables. The optional `encryption_*` fields password-protect the PDF and set its permissions.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string \| null` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reference_id?: string | null,
>   template_id?: string | null,
>   download_url: string | null,
>   expires?: string | null,
>   created_at?: string | null
> }
> ```

***

## Templates

### list

`templates.list`

List document templates in the PDFLess workspace.

**Risk:** `read`

```ts theme={null}
await corsair.pdfless.api.templates.list({ page: 1, pageSize: 25 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `page` | `number` | No | — |
| `pageSize` | `number` | No | — |

GET /v1/document-templates. Query names are Page and PageSize. Official fields are id, name, imagePreviewUrl, pdfPreviewUrl, created, and modified.

**Output**

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

> [accordion] templates full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string | null,
>   imagePreviewUrl?: string | null,
>   pdfPreviewUrl?: string | null,
>   created?: string | null,
>   modified?: string | null
> }[]
> ```

***

## Workspace

### get

`workspace.get`

Read the PDFLess workspace for the connected API key.

**Risk:** `read`

```ts theme={null}
await corsair.pdfless.api.workspace.get({});
```

**Input:** *empty object*

GET /v1/workspaces. Official fields are name, active, created, modified, quota, and remainingQuota.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | — |
| `active` | `boolean \| null` | No | — |
| `created` | `string \| null` | No | — |
| `modified` | `string \| null` | No | — |
| `quota` | `number \| null` | No | — |
| `remainingQuota` | `number \| null` | No | — |

***


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