Pressa Compile API
The Compile API from Pressa — 2 operation(s) for compile.
The Compile API from Pressa — 2 operation(s) for compile.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/pressa-dev:pressa-dev-compile-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Pressa Compile API
version: 1.5.0
summary: Compile LaTeX into publication-quality PDFs over HTTP.
description: 'Pressa is document infrastructure for AI agents. Send LaTeX source, receive a PDF URL.
POST /api/v1/compile works with NO credentials, 3 successful compilations per day per IP. Failed compilations do not consume that quota, so an agent may iterate on its LaTeX until it compiles. Every other endpoint requires an API key.
Pressa is a LaTeX compiler, not a text-to-PDF converter. Callers are expected to convert markdown, plain text or structured data into LaTeX themselves. Compilation failures return a `diagnosis` object with a concrete suggested fix so a caller can correct the source and retry without human involvement.'
contact:
url: https://pressa.dev
license:
name: Proprietary
url: https://pressa.dev/terms
servers:
- url: https://api.pressa.dev
description: Production
tags:
- name: Compile
paths:
/compile:
get:
operationId: compileFromLink
summary: Compile LaTeX from a link and get the PDF itself
description: 'A compile that is a link: open it, get the PDF. Give exactly one of `text` (URL-encoded LaTeX; the whole address can be about 9 KB, roughly 4 to 6 KB of LaTeX once encoded) or `url` (an http/https address of one .tex file on the public internet, up to 30 KB without a key). The parameters are the ones latexonline.cc uses, so a link that works there needs only a new host. The answer is the PDF itself (not a URL), so `curl -o out.pdf` works without following redirects; errors are text/plain with the diagnosis first. Without a key: the anonymous tier, except that the same source is cached for about a day and served to everyone without using anyone''s allowance, a document over 3 pages comes back as its first 3 pages (X-Pressa-Total-Pages says how many it has), and a small ''Made with Pressa'' line is added. With `Authorization: Bearer ` the link compiles on the account like POST /api/v1/compile. A key is never read from the address. Anything in the address is not private; send private documents with POST /api/v1/compile. Docs: https://pressa.dev/docs/link'
security:
- {}
- bearerAuth: []
parameters:
- name: text
in: query
required: false
schema:
type: string
description: LaTeX source, URL-encoded.
- name: url
in: query
required: false
schema:
type: string
format: uri
description: Address of one .tex file. Files it \input or \includegraphics are not fetched.
- name: command
in: query
required: false
schema:
type: string
enum:
- pdflatex
- xelatex
- lualatex
default: pdflatex
description: Compiler. lualatex needs a Pro or Business plan.
- name: force
in: query
required: false
schema:
type: string
description: Accepted for latexonline.cc compatibility and ignored.
responses:
'200':
description: The PDF.
headers:
X-Pressa-Pages:
schema:
type: integer
description: Pages in the delivered PDF.
X-Pressa-Total-Pages:
schema:
type: integer
description: 'Present when the document was cut to the keyless page limit: its full length.'
X-Pressa-Note:
schema:
type: string
description: 'Present with X-Pressa-Total-Pages: what was cut and how to get the whole document.'
content:
application/pdf:
schema:
type: string
format: binary
'400':
description: Missing or conflicting parameters.
content:
text/plain:
schema:
type: string
'414':
description: The source is too long for an address; use url= or POST /api/v1/compile.
content:
text/plain:
schema:
type: string
'422':
description: The LaTeX did not compile (diagnosis and fix first, then the TeX log), or url= could not be fetched.
content:
text/plain:
schema:
type: string
'429':
description: The daily allowance without a key is used up, or too many attempts in a minute.
content:
text/plain:
schema:
type: string
tags:
- Compile
/api/v1/compile:
post:
tags:
- Compile
operationId: compile
summary: Compile LaTeX source into a PDF
description: 'Authentication is OPTIONAL. Without credentials the request is served by the anonymous tier: pdflatex or xelatex, 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.'
security:
- {}
- bearerAuth: []
- apiKeyHeader: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompileRequest'
examples:
minimal:
summary: Smallest working document
value:
latex: \documentclass{article}\begin{document}Hello\end{document}
withAssets:
summary: With an inline image (API key required)
value:
latex: \documentclass{article}\usepackage{graphicx}\begin{document}\includegraphics[width=3cm]{logo.png}\end{document}
compiler: pdflatex
assets:
logo.png: iVBORw0KGgoAAAANSUhEUgAA...
responses:
'200':
description: PDF produced.
content:
application/json:
schema:
$ref: '#/components/schemas/CompileSuccess'
'400':
description: 'The body could not be read: not valid JSON (`invalid_json`), `latex` missing (`missing_parameter`), or `latex` is not a string (`invalid_latex`). A Windows PowerShell 5.1 object made from Get-Content output ({"value": ..., "PSPath": ...}) is accepted and read as its text.'
'401':
description: A key was supplied but is invalid or revoked. Absent credentials do NOT produce this.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Requested compiler is not available on the caller's plan (`compiler_not_available`).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'413':
description: 'Source over 300 KB, or over the plan limit for an anonymous caller, or the day''s size previews used up (`preview_attempts_remaining_today: 0`), or assets over budget (`latex_too_large`, `assets_too_large`). With a key, a source over the plan''s limit but under 300 KB is otherwise compiled and returned as a 200 preview.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: The request was understood but cannot produce a PDF. Includes `not_latex_source`, `compilation_failed`, `compilation_timeout`, `page_limit_exceeded`, `pdf_too_large`, `pdf_size_unknown` (transient, retry the same request), and `assets_not_available_anonymously`. With a key, `page_limit_exceeded` is normally replaced by a 200 preview of the first pages the plan allows; it is still sent when the preview is switched off or could not be produced. When `error` is `compilation_failed`, a `diagnosis` object describes the fix.
content:
application/json:
schema:
$ref: '#/components/schemas/CompileFailure'
examples:
missingPackage:
summary: Missing \usepackage, machine-fixable
value:
error: compilation_failed
message: \toprule is undefined because the 'booktabs' package was not loaded.
line: 14
retryable: true
diagnosis:
error_class: missing_package
summary: \toprule is undefined because the 'booktabs' package was not loaded.
suggested_fix: Add \usepackage{booktabs} to the preamble, before \begin{document}.
suggested_package: booktabs
symbol: \toprule
line: 14
retryable: true
agent_hint: Add \usepackage{booktabs} to the preamble, before \begin{document}. Apply this fix to the LaTeX source and call compile again yourself - do not ask the user to fix LaTeX.
'429':
description: 'Quota exhausted (`rate_limit` for an account''s monthly limit, `anonymous_quota_exhausted` for the keyless daily limit, both with `next_step`), or `preview_in_progress`: a size preview is already compiling for this account; one runs at a time, retry in `retry_after_seconds`.'
content:
application/json:
schema:
$ref: '#/components/schemas/QuotaError'
'503':
description: 'Two transient conditions, both `retryable`. `anonymous_capacity_exhausted`: the keyless tier is at its global hourly ceiling (never sent to authenticated callers). `preview_unavailable`: the store that limits size previews to one per account is not answering, so a size preview is refused for the moment (authenticated callers only, `retry_after_seconds: 60`); a source within the plan''s size limit still compiles.'
content:
application/json:
schema:
$ref: '#/components/schemas/QuotaError'
components:
schemas:
CompileFailure:
type: object
properties:
error:
type: string
message:
type: string
log:
type: string
description: Raw compiler output. Prefer `diagnosis` for programmatic handling.
line:
type: integer
retryable:
type: boolean
diagnosis:
$ref: '#/components/schemas/Diagnosis'
agent_hint:
type: string
description: Instruction addressed to an automated caller.
plan:
type: string
usage:
type: object
QuotaError:
type: object
properties:
error:
type: string
enum:
- rate_limit
- anonymous_quota_exhausted
- anonymous_capacity_exhausted
message:
type: string
limit:
type: integer
used:
type: integer
resets_at:
type: string
format: date-time
plan:
type: string
retryable:
type: boolean
upgrade_url:
type: string
format: uri
next_step:
$ref: '#/components/schemas/NextStep'
retry_after_seconds:
type: integer
grace_allowance:
type: integer
description: Size of the plan's grace buffer, which was also exhausted.
Diagnosis:
type: object
description: Structured cause of a compilation failure. Absent when the parser could not classify the log with confidence - a confident wrong suggestion costs the caller a wasted retry, so silence is preferred.
properties:
error_class:
type: string
enum:
- missing_package
- missing_document_class
- missing_asset
- undefined_command
- undefined_environment
- mismatched_environment
- missing_math_mode
- missing_begin_document
- unsupported_unicode
- unbalanced_braces
- runaway_argument
- fatal_error
summary:
type: string
suggested_fix:
type: string
suggested_package:
type: string
description: Present when the fix is a specific \usepackage.
symbol:
type: string
description: The offending command, environment, filename or codepoint.
line:
type: integer
retryable:
type: boolean
CompileSuccess:
type: object
required:
- job_id
- pdf_url
- pages
properties:
job_id:
type: string
format: uuid
pdf_url:
type: string
format: uri
description: Signed URL. Fetchable with no credentials until it expires.
expires_at:
type: string
format: date-time
pages:
type: integer
description: Pages in the PDF at `pdf_url`. For a preview this is what was delivered; `total_pages` is what the document has.
compilation_time_ms:
type: integer
assets_count:
type: integer
font_substitutions:
type: array
description: Present when the document asked for fonts the compile image does not have (Arial, Helvetica, Times New Roman, Calibri, Cambria, Georgia and other commercial fonts) and Pressa compiled them as installed fonts with the same metrics where one exists (Arial as Arimo, Times New Roman as Tinos, Calibri as Carlito), otherwise the closest free design. xelatex and lualatex only. Also on a failed compile, whose log shows the installed names.
items:
type: object
properties:
requested:
type: string
used:
type: string
redefined_commands:
type: array
items:
type: string
description: Present when the document used \newcommand on a name LaTeX itself defines (\H, \vec, \top and a few more), which cannot compile, and Pressa let the document's own definition win (\let\H\relax before it). Names pdflatex uses to set accented letters are left alone, so their error and diagnosis stay.
studio_url:
type: string
format: uri
description: Browser editor link. Absent for anonymous compiles.
anonymous:
type: boolean
description: Present and true when the compile used the keyless tier.
remaining_today:
type: integer
description: Anonymous tier only.
note:
type: string
description: Anonymous tier only. Human- and agent-readable upgrade guidance.
next_step:
$ref: '#/components/schemas/NextStep'
usage:
type: object
description: Monthly counters for accounts; daily counters for the anonymous tier.
quota_grace:
type: boolean
description: 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_remaining:
type: integer
description: Compilations left in the grace buffer before requests start failing.
warning:
type: string
description: 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.
preview:
type: boolean
description: 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.
truncated:
type: boolean
description: '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_pages:
type: integer
description: 'With `preview`: how many pages the whole document has. `pages` is how many were delivered.'
plan_required:
type: string
nullable: true
enum:
- free
- starter
- pro
- business
description: 'With `preview`: the smallest plan whose page and source-size limits cover the whole document. Null when even Business does not.'
upgrade_url:
type: string
format: uri
Error:
type: object
required:
- error
properties:
error:
type: string
message:
type: string
plan:
type: string
upgrade_url:
type: string
format: uri
description: Present only when a bigger plan would fix the error (a limit, a timeout, a plan-only feature). A LaTeX error or bad request data has none.
limit:
type: integer
description: The limit that was applied, in the unit the error names (bytes, pages).
plan_limit:
type: integer
description: 'With `pdf_too_large`: the plan''s own PDF cap, when a larger compile ceiling was applied to the whole document before a preview slice.'
retryable:
type: boolean
retry_after_seconds:
type: integer
preview_attempts_per_day:
type: integer
description: 'With `latex_too_large` after the day''s size previews are used: how many an account gets per rolling day.'
preview_attempts_remaining_today:
type: integer
description: 'With `latex_too_large`: 0 when the day''s size previews are used; retry tomorrow rather than shrinking the document.'
CompileRequest:
type: object
required:
- latex
properties:
latex:
type: string
description: Complete LaTeX source. Must contain \documentclass, \begin{document}, \input{} or \include{}. Plain text, markdown or JSON is rejected with `not_latex_source`.
compiler:
type: string
enum:
- pdflatex
- xelatex
- lualatex
default: pdflatex
description: Anonymous callers and every plan may use pdflatex or xelatex; lualatex requires Pro or Business.
assets:
type: object
description: Filename to base64-encoded bytes. Requires an API key.
additionalProperties:
type: string
contentEncoding: base64
use_stored_assets:
type: array
items:
type: string
description: Names of assets from the account's asset library. Requires a paid plan.
NextStep:
type: object
description: What the caller should do to get past this response.
properties:
action:
type: string
enum:
- obtain_api_key
- retry_without_assets
signup_url:
type: string
format: uri
env_var:
type: string
header:
type: string
remove_fields:
type: array
items:
type: string
card_required:
type: boolean
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'Authorization: Bearer pressa_...'
apiKeyHeader:
type: apiKey
in: header
name: X-API-Key