Skip to content

Render statelessly

Render a document from a template you pass in the request body, instead of one stored in your workspace. Nothing is persisted — no template, no document, no entry in Renders — and the response is the raw PDF binary rather than a JSON envelope.

Useful for one-off documents that don’t belong in your template catalogue, and for iterating on a template’s DSL before publishing it.

POST /v1/render

No template id in the path — the template travels in the body. Every request must carry a bearer API key; the key’s prefix still decides test vs. production behaviour (a test key watermarks the output).

Terminal window
curl -X POST "https://pagr-prd-api-public.azurewebsites.net/v1/render" \
-H "Authorization: Bearer pagr_prod_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"template": { "…": "the template DSL" },
"data": { "Title": "Acme Q3 Invoice", "Amount": 42 }
}' \
--output invoice.pdf

None.

Parameter Type Default Description
language string Language variant to render. Only meaningful together with translations in the body.

There is no persist parameter — a stateless render never stores anything.

Field Type Required Description
template object Yes The template DSL itself. It doesn’t need to exist in Pagr.
data object Yes The document data the template binds to. Same limits as a normal render: 50 MB of JSON, nested at most 32 levels deep.
translations object No Translation strings, for rendering a language variant.
{
"template": { "…": "the template DSL" },
"data": { "Title": "Acme Q3 Invoice", "Amount": 42 },
"translations": null
}

200 OK with Content-Type: application/pdf — the response body is the PDF itself. No headers carry metadata (unlike Render a raw PDF), because there is no stored document to describe.

Every SDK returns the bytes directly:

SDK Return type
Python bytes
TypeScript Uint8Array
Java byte[]
C# byte[]
Ruby String (binary)
C++ std::vector<std::uint8_t>
SDK Method
Python await client.render_stateless(template, data, translations=None, *, language=None, timeout=None)
TypeScript await client.renderStateless(template, data, { translations, language, timeoutMs })
Java client.renderStateless(template, data) / client.renderStateless(template, data, translations, language)
C# await client.RenderStatelessAsync(templateJson, jsonData, translationsJson, language, timeout, cancellationToken)
Ruby client.render_stateless(template, data, translations = nil, language:, timeout:)
C++ client.render_stateless(template, data, translations, language, timeout) / render_stateless_async(…)
Status code When
413 PayloadTooLarge The payload exceeds 50 MB.
422 BindingError template or data couldn’t be parsed or bound — malformed JSON, wrong types, an invalid DSL.
500 RenderTimeout The render exceeded its 60-second budget.

See Errors for the full table.