Skip to content

Validate data

Run the same checks a render would run, without actually rendering — so you can surface problems to a user (or reject a submission) before spending a page credit. Validation consumes no render credit.

POST /v1/render/{templateId}/validate
POST /v1/render/{templateId}/versions/{version}/validate

Validate against the latest published version, or a specific one.

Terminal window
curl -X POST "https://pagr-prd-api-public.azurewebsites.net/v1/render/8bec66ff-6f3d-4c1e-9a2b-1f0e5d7c4a90/validate" \
-H "Authorization: Bearer pagr_test_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"documents": [
{ "Title": "Acme Q3 Invoice", "Amount": 42 }
]
}'
Parameter Type Required Description
templateId string (UUID) Yes The template to validate against.
version integer Only for the specific-version form The version number. Omit the whole segment to validate against the latest published version.

None. Validation has no persist or language parameter — it never produces output.

Field Type Required Description
documents array of objects Yes One object per document. Validate a batch in one call the same way you’d render one.
{
"documents": [
{ "Title": "Acme Q3 Invoice", "Amount": 42 }
]
}

Every call returns HTTP 200 with a flat list of issues across the whole batch:

{
"issues": [
{
"type": "MissingBinding",
"severity": "Error",
"description": "No value bound for 'total'.",
"elementId": "total-amount",
"documentIndex": 0
}
]
}

An empty issues array means every document is clean.

Field Type Description
type string The issue category — see Errors → Render issues for every value.
severity string Information, Warning, or Error.
description string Human-readable explanation. Don’t parse it; switch on type.
elementId string or null The template element the issue attaches to, when it maps to one.
documentIndex number or null Which document in the batch the issue belongs to. null for a batch-wide issue not scoped to one document.
SDK Method Result accessors
Python await client.validate(template_id, json_data, *, version=None) .is_valid, .errors, .warnings, .issues_for(i), iterable
TypeScript await client.validate(templateId, data, { version }) .isValid, .errors, .warnings, .issuesFor(i), iterable
Java client.validate(templateId, data[, version])data is a JSON String, JsonObject or Map .isValid(), .getErrors(), .getWarnings(), .issuesFor(i), iterable
C# await client.ValidateAsync(templateId, data, version, cancellationToken) .IsValid, .Errors, .Warnings, .IssuesFor(i), IReadOnlyList<RenderIssue>
Ruby client.validate(template_id, json_data, version:) .valid?, .errors, .warnings, .issues_for(i), Enumerable
C++ client.validate(template_id, json_data, version) / validate_async(…) .is_valid(), .errors(), .warnings(), .issues_for(i)

issues_for(i) returns the issues for document i plus every batch-wide issue (those whose documentIndex is null) — so a per-document error report is never missing a batch-level cause.

Status code When
404 TemplateNotFound, VersionNotFound, NoPublishedVersion The template or version doesn’t exist, or nothing is published yet.
422 BindingError The request body couldn’t be parsed or bound.

See Errors for the full table.