Casa Daily — Render

Render Pdf

Render HTML+CSS to a PDF byte stream.

Auth: X-API-Key (server-to-server, never browser-facing).

Response: application/pdf stream. Body starts with %PDF- magic bytes (asserted in tests). Caller pipes the response straight into Supabase Storage; the endpoint itself is stateless.

Failure modes:

  • 413 Payload Too Large — body exceeded MAX_BODY_BYTES.
  • 422 Unprocessable Entity — Pydantic validation (e.g. empty html, unknown page_size).
  • 504 Gateway Timeout — WeasyPrint took longer than RENDER_TIMEOUT_SECONDS.
  • 500 Internal Server Error — WeasyPrint raised (malformed HTML, unparseable CSS, missing font, etc.). Message includes the exception class so the caller can show a diagnostic.

Body-size guard runs as a Header-only dependency (see _enforce_body_size) so we 413 before parsing a 50MB envelope.

post/api/v1/render/pdf

Request

  • Base URL: https://api.casaintelligence.com.au (the document declares no server; this is the origin it was published from)
  • URL: https://api.casaintelligence.com.au/api/v1/render/pdf
  • Auth: API key in header X-API-Key

Headers

content-lengthstring nullable

Request body

htmlstring required

Full HTML document — DOCTYPE through </html>.

base_cssstring nullable

Optional extra stylesheet, appended to the document.

page_size'A4' | 'Letter'

WeasyPrint page size — A4 or Letter.

orientation'portrait' | 'landscape'

Page orientation — portrait or landscape.

Response

Successful Response

unknown required

Changes

No recorded changes to this operation across all 1 revision of this API.