Skip to content

Templates

Base: /v1/templates

POST /v1/templates — Create · Auth: Clerk session only

Section titled “POST /v1/templates — Create · Auth: Clerk session only”

Body: {name: string (1-200 chars), html: string, is_public?: boolean (default false)} Response 201: PdfTemplateResponse Errors: 422 INVALID_TEMPLATE_NAME

GET /v1/templates — List my templates · Auth: Clerk session only

Section titled “GET /v1/templates — List my templates · Auth: Clerk session only”

Query: limit, offset. Returns PdfTemplateResponse[].

GET /v1/templates/public — List community templates · Auth: API key or session

Section titled “GET /v1/templates/public — List community templates · Auth: API key or session”

Query: limit, offset. Returns PdfTemplateResponse[].

GET /v1/templates/{id} — Get one · Auth: API key or session

Section titled “GET /v1/templates/{id} — Get one · Auth: API key or session”

Errors: 404 PDF_TEMPLATE_NOT_FOUND (not yours and not public).

PATCH /v1/templates/{id} — Update · Auth: Clerk session only, owner only

Section titled “PATCH /v1/templates/{id} — Update · Auth: Clerk session only, owner only”

Body: {name?: string, html?: string} — both optional, partial update.

PATCH /v1/templates/{id}/visibility — Change visibility · Auth: Clerk session only, owner only

Section titled “PATCH /v1/templates/{id}/visibility — Change visibility · Auth: Clerk session only, owner only”

Body: {is_public: boolean}

DELETE /v1/templates/{id} — Delete · Auth: Clerk session only, owner only

Section titled “DELETE /v1/templates/{id} — Delete · Auth: Clerk session only, owner only”

Response: 204, no body. Irreversible.

Returned by every endpoint above:

{
"id": "string",
"owner_user_id": "string",
"name": "string",
"html": "string",
"is_public": "boolean",
"created_at": "datetime",
"updated_at": "datetime"
}