L

I Love My LaTeX

Get started

Developer API

Automate PDF to LaTeX conversion with API keys

Use the I Love My LaTeX API to upload PDFs, convert scanned math documents into editable LaTeX code, check processing status, and retrieve the generated LaTeX result programmatically.

How it works

Convert PDFs from your own scripts and applications

Once you create an API key, you can integrate PDF to LaTeX conversion into your own backend, Python scripts, automation tools, educational platforms, or internal document workflows.

1. Create an API key

Go to your dashboard, open the API Keys page, and generate a new key. Copy it immediately because it is shown only once.

2. Upload a PDF

Send a multipart request to the upload endpoint with your PDF file and your API key in the request header.

3. Poll the conversion status

Large mathematical documents can take time. Poll the status endpoint until the conversion is completed.

4. Download the LaTeX result

Once the job is completed, retrieve the generated editable LaTeX code and save it as a .tex file.

API base URL

Use the following base URL for API requests:

https://app.ilovemylatex.com/api/v1

Keep your API key private

Never expose your API key in public repositories, frontend JavaScript, screenshots, videos, or shared documents. Use it only from trusted server-side code or private scripts.

Authentication header

X-API-Key: YOUR_API_KEY_HERE

Python example

Full PDF to LaTeX automation script

This example uploads a PDF, waits for conversion to finish, and saves the generated LaTeX result as a .tex file.

convert_pdf_to_latex.py

Python
import time
import requests

API_BASE = "https://app.ilovemylatex.com/api/v1"
API_KEY = "YOUR_API_KEY_HERE"

headers = {
    "X-API-Key": API_KEY,
}

# 1. Upload a PDF for conversion
with open("document.pdf", "rb") as file:
    response = requests.post(
        f"{API_BASE}/documents/upload",
        headers=headers,
        files={
            "file": ("document.pdf", file, "application/pdf"),
        },
        data={
            "strategy": "page_by_page",
        },
        timeout=120,
    )

response.raise_for_status()
document = response.json()
document_id = document["file_id"]

print(f"Document created: {document_id}")

# 2. Poll the conversion status
while True:
    response = requests.get(
        f"{API_BASE}/documents/{document_id}/status",
        headers=headers,
        timeout=30,
    )

    response.raise_for_status()
    status_data = response.json()
    status = status_data["status"]

    print(f"Status: {status}")

    if status in ["completed", "failed", "cancelled"]:
        break

    time.sleep(3)

# 3. Get the generated LaTeX result
if status == "completed":
    response = requests.get(
        f"{API_BASE}/documents/{document_id}/result",
        headers=headers,
        timeout=60,
    )

    response.raise_for_status()
    latex_content = response.text

    with open("result.tex", "w", encoding="utf-8") as output:
        output.write(latex_content)

    print("LaTeX saved to result.tex")
else:
    print(f"Conversion ended with status: {status}")

cURL examples

Test the API from your terminal

You can also test the API manually with cURL before integrating it into your own application.

Upload a document

curl -X POST "https://app.ilovemylatex.com/api/v1/documents/upload" \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -F "file=@document.pdf;type=application/pdf" \
  -F "strategy=page_by_page"

Check conversion status

curl -X GET "https://app.ilovemylatex.com/api/v1/documents/YOUR_DOCUMENT_ID/status" \
  -H "X-API-Key: YOUR_API_KEY_HERE"

Download the LaTeX result

curl -X GET "https://app.ilovemylatex.com/api/v1/documents/YOUR_DOCUMENT_ID/result" \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -o result.tex

Build automated PDF to LaTeX workflows

Use API keys to connect I Love My LaTeX with scripts, backend services, education platforms, research tools, or internal document processing pipelines.