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.pdf

Authentication

All requests require an API key passed via the X-API-KEY header.

  1. Go to API Keys
  2. Create a new API key
  3. Store it securely – it will not be shown again

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 | lualatex
  • mainFile: main .tex filename

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.pdf