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

# Varying responses

> Choose a job receipt, binary attachment or Base64 JSON and handle a render that outlasts the synchronous wait.

## Choose the response

Send one source to [POST /v1/documents](https://docs.dockiln.io/api-reference/queue-generation.md). `format` chooses what to generate. `response` chooses how the caller receives it.

| Response | When the job finishes | If still running |
| - | - | - |
| `async` (default) | Returns a **202** job receipt upon admission | Poll the relative path in `Location` |
| `binary` (1.1) | **200** with the generated bytes | **202** job receipt after the wait |
| `base64` (1.1) | **200** JSON with `id`, `filename`, `contentType` and `base64` | **202** job receipt after the wait |

```json theme={null}
{
  "html": "<h1>Proof approved</h1>",
  "format": "pdf",
  "response": "binary",
  "filename": "proof.pdf"
}
```

## Handle a queued result

The review build waits up to four seconds for a synchronous request. Check the HTTP status **before** saving bytes to a PDF. For **202**, poll the existing job until `completed` or `failed`. Fetch the completed job's `download` path with the same bearer credential. Preserve your `Idempotency-Key` and original JSON if the submission itself must be retried.

## Read Base64 safely

For a completed job, `GET /v1/documents/{id}/file?encoding=base64` returns the same JSON envelope. Decode its `base64` field once. The limit is 3 MiB of file bytes before encoding. On **413**, retrieve the same file as binary. For event-driven delivery, see [webhook events](https://docs.dockiln.io/misc/webhook-events.md).


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