---
title: "Render a template’s example"
---

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

# Render a template’s example

Path: CloudRaker Paperwork API › Compose

`POST /v1/compose/configs/{idOrSlug}/preview`

Renders the template with one of its saved examples and returns the PDF bytes — the editor's preview button.

`example` names the example to use; without it the first one is rendered. A template with no examples at all still previews — it renders with empty data `{}`, which is what a fresh template's static content needs.

A template with no files or no `main` answers `422 config_incomplete`; a name that matches no saved example answers `404 example_not_found`.

**Learn more:** [Compose](https://docs.cloudraker.com/paperwork/capabilities/compose)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `idOrSlug` (`previewComposeTemplate.path.idOrSlug`; string, required)
  - minLength 1

## Request body

_Required._

- `example` (`previewComposeTemplate.example`; string, optional)
  - minLength 1

## Example request

```json
{
  "example": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/v1/compose/configs/<idOrSlug>/preview' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "example": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/compose/configs/<idOrSlug>/preview';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({example: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/compose/configs/<idOrSlug>/preview"

payload = { "example": "string" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The rendered PDF.

#### Example

```text
string
```

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`previewComposeTemplate.response.400.success`; boolean, required)
  - one of `false`
- `error` (`previewComposeTemplate.response.400.error`; array<unknown>, required)
- `data` (`previewComposeTemplate.response.400.data`; unknown, required)

### 404

Unknown template, or no example by that name (`example_not_found`).

### 422

The template has no files or no `main` (`config_incomplete`), or it failed to compile.

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`previewComposeTemplate.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`previewComposeTemplate.response.429.message`; string, required)
- `retryable` (`previewComposeTemplate.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`previewComposeTemplate.response.429.requestId`; string, required)
- `docUrl` (`previewComposeTemplate.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/compose/preview-compose-template/index.md
