API Documentation
Learn how to use the Texapi compile API to programmatically compile LaTeX documents to PDF.
Texapi – PDF Compilation API
Texapi is a stateless REST API for compiling LaTeX documents into PDFs. It is designed for automation, backend services, CI pipelines, and SaaS products.
Texapi is not a LaTeX editor. You send templates and data, and receive a production-ready PDF in return.
Quick Start (30 seconds)
Generate a PDF from LaTeX in a single API call.
curl -X POST https://texapi.ovh/api/latex/compile \
-H "X-API-KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"content": "\\documentclass{article}\n\\begin{document}\nHello PDF!\n\\end{document}"
}' \
--output result.pdfAuthentication
All requests require an API key passed via the X-API-KEY header.
- Go to API Keys
- Create a new API key
- Store it securely – it will not be shown again
Security
Treat your API key like a password. Never expose it in client-side code or public repositories.
Compile LaTeX to PDF
Option 1: Compile from JSON (simple templates)
Best for single-file LaTeX documents without external assets.
curl -X POST https://texapi.ovh/api/latex/compile \
-H "X-API-KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"content": "\\documentclass{article}\n\\begin{document}\nHello World!\n\\end{document}"
}'Option 2: Compile from Files (real projects)
Use this for multiple files, images, fonts, bibliographies, and styles.
curl -X POST "https://texapi.ovh/api/latex/compile/file?compiler=lualatex&mainFile=main.tex" \
-H "X-API-KEY: your-api-key-here" \
-F "files=@main.tex" \
-F "files=@image.png" \
-F "files=@font.ttf"Query parameters:
compiler: pdflatex | xelatex | lualatexmainFile: main .tex filename
Error handling model
Compilation errors return HTTP 200 with
status: "error" in the response body. This allows clients to always retrieve logs and output files.Response schema (guaranteed)
{
"status": "success | error",
"errors": string[],
"resultPath": string | null,
"outputFiles": {
"type": string,
"content": string
}[] | null
}Downloading the PDF
When compilation succeeds, use resultPath to download the PDF.
curl -X GET https://texapi.ovh/api/latex/files/{file-key} \
-H "X-API-KEY: your-api-key-here" \
--output document.pdfTemporary storage
PDF files are stored for 10 minutes only. This keeps the service stateless
and prevents long-term storage of user data.
Rate limits
20 requests per minute per user. Limits protect the service and ensure consistent performance.
OpenAPI / Swagger
Full API reference and interactive testing available in the Swagger UI.