compile

Compile LaTeX source into a PDF

Authentication is OPTIONAL. Without credentials the request is served by the anonymous tier: pdflatex only, 3 pages, 30 KB of source, no assets, 3 successful compilations per day per IP, and PDF links that expire after 1 hour.

An absent key selects the anonymous tier. An invalid or revoked key returns 401 rather than downgrading, so a broken configuration fails loudly instead of appearing to work intermittently.

With a key, a document over the plan's page limit, or over its source-size limit but under 300 KB (at most 5 such previews per day), is not rejected: the response is 200 with preview: true, a PDF of the first pages the plan allows, total_pages, and plan_required naming the smallest plan that covers the whole document. Show the user the preview and relay warning; never drop pages silently.

post/api/v1/compile

Request

  • Base URL: https://api.pressa.dev
  • URL: https://api.pressa.dev/api/v1/compile
  • Auth: one of:
    • none
    • HTTP bearer
    • API key in header X-API-Key

Request body

latexstring required

Complete LaTeX source. Must contain \documentclass, \begin{document}, \input{} or \include{}. Plain text, markdown or JSON is rejected with not_latex_source.

compiler'pdflatex' | 'xelatex' | 'lualatex'

Anonymous callers may use pdflatex only. xelatex requires any account; lualatex requires Pro or Business.

assetsobject

Filename to base64-encoded bytes. Requires an API key.

use_stored_assetsstring[]

Names of assets from the account's asset library. Requires a paid plan.

Response

PDF produced.

job_idstring uuid required
pdf_urlstring uri required

Signed URL. Fetchable with no credentials until it expires.

expires_atstring date-time
pagesinteger required

Pages in the PDF at pdf_url. For a preview this is what was delivered; total_pages is what the document has.

compilation_time_msinteger
assets_countinteger
studio_urlstring uri

Browser editor link. Absent for anonymous compiles.

anonymousboolean

Present and true when the compile used the keyless tier.

remaining_todayinteger

Anonymous tier only.

notestring

Anonymous tier only. Human- and agent-readable upgrade guidance.

usageobject

Monthly counters for accounts; daily counters for the anonymous tier.

quota_graceboolean

Present and true when this compilation exceeded the plan's monthly limit and drew on the paid-plan grace buffer. Grace compilations are not charged.

grace_remaininginteger

Compilations left in the grace buffer before requests start failing.

warningstring

Present with quota_grace (capacity is about to run out) and with preview (what was delivered and which plan covers the whole document). Human- and agent-readable; relay it.

previewboolean

Present and true when the document exceeded the plan's page or source-size limit. The PDF at pdf_url is what the plan delivers of it. Accounts only; anonymous callers get 413/422 instead.

truncatedboolean

With preview: true when the PDF holds only the first pages of a total_pages document, false when the source was over the plan's size limit but every page fit.

total_pagesinteger

With preview: how many pages the whole document has. pages is how many were delivered.

plan_required'free' | 'starter' | 'pro' | 'business' nullable

With preview: the smallest plan whose page and source-size limits cover the whole document. Null when even Business does not.

upgrade_urlstring uri

Changes

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