Skip to content

Quickstart

The fastest way to see the Pagr API in action is to get a key, POST some JSON to an existing template, and get a PDF back.

Don’t have a Pagr account yet? See Create an account first. You will need a workspace and at least one template before the steps below will produce anything.

Generate a test key in the workspace under Settings → API Keys — test keys produce watermarked output and don’t consume page credits, so they’re safe to experiment with. See API Keys for the full walkthrough.

You need a template’s id (open the template in the workspace and copy it from the URL or the template list). Then call the render endpoint with your key and some data — raw HTTP, or with one of the official SDKs:

Terminal window
curl -X POST "https://pagr-prd-api-public.azurewebsites.net/v1/render/8bec66ff-6f3d-4c1e-9a2b-1f0e5d7c4a90" \
-H "Authorization: Bearer pagr_test_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"documents": [
{ "Title": "Acme Q3 Invoice", "Amount": 42 }
],
"includeDocument": true
}'

A JSON envelope reporting the outcome, with the rendered document’s metadata — and, because includeDocument was true, the PDF itself as Base64:

{
"status": "ok",
"requestedCount": 1,
"renderedCount": 1,
"missingCount": 0,
"issues": [],
"documents": [
{
"documentName": "Acme Q3 Invoice",
"pageCount": 1,
"viewUrl": "https://…",
"documentBase64": "JVBERi0xLjcK…"
}
]
}

Inspect status rather than the HTTP status code — a document that fails validation is a normal outcome, not a request error. See Render a document → Response for every field.