Compilation
Compile LaTeX source to PDF in seconds. Send raw source code or reference an existing project. The response includes a signed URL to download the compiled PDF (valid for 1 hour).
Overview
The compilation endpoint accepts either inline LaTeX source or a project UID. When a project UID is provided, the API pulls the latest saved files from that project and compiles them together. Compilation logs are always returned in the response, so check the logs field for warnings or errors if the build fails. The pdf_url in a successful response is a signed URL that expires after 1 hour; fetch or share it before then.
POST /compile
Compile LaTeX source to PDF. You can send raw source code directly, or reference a project by its UID to compile its current files.
Auth: Bearer token or API key
Compile from raw source
curl -X POST https://api.texer.org/compile \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"source": "\\documentclass{article}\n\\begin{document}\nHello, world!\n\\end{document}"
}'Compile from a project
curl -X POST https://api.texer.org/compile \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"project_uid": "prj_n7w3q8"}'Success response
{
"status": "success",
"pdf_url": "https://cdn.texer.org/compiled/cmp_a2b4c6.pdf",
"expires_at": "2025-06-15T10:10:00Z",
"logs": "This is pdfTeX, Version 3.14159265...",
"compile_time_ms": 2340
}Error response
If the LaTeX source contains errors, the API returns a 422 status with diagnostic information:
{
"status": "error",
"logs": "! Undefined control sequence.\nl.4 \\invalid\n",
"compile_time_ms": 980
}