Skip to content

Check a document before rendering

POST /v1/check runs layout and reports findings. Use it to test a template during development, detect regressions in CI, or give an author a precise fix.

Check HTML

jq -n --rawfile html invoice.html '{version: 1, html: $html}' |
  curl --fail-with-body http://127.0.0.1:8080/v1/check \
    -H "Authorization: Bearer $PRESSJET_API_KEY" \
    -H 'Content-Type: application/json' \
    --data-binary @- -o layout-report.json

jq '{ok, pageCount, diagnostics}' layout-report.json

For a native document, use the version and layout fields from your render request. Include the same fonts and other resources as in the real render.

Interpret the result

A valid request returns HTTP 200 with a report, even when the document has a layout error. Check the report's ok field and decide how to handle warnings. A malformed API request returns an HTTP problem instead.

The report includes a diagnostic code, message, and suggested fix. When present, page (one-based) and pointer identify where to inspect. Use the diagnostic reference for individual codes and the error reference for request errors.