Repository navigation
v0.1.0
Typst API v0.1.0
This is the initial release of a library that provides a dockerized REST API for compiling Typst documents into PDFs.
Features
- Compile Typst files through
POST /compile. - Compile inline Typst source through
POST /compile/source. - Support multipart uploads for typst files, images and custom fonts or other files (like json or yaml).
- Load custom fonts in the mounted
fonts/directory, usePOST /fonts/refreshto reload them to the cache. - Support ephemeral fonts uploaded per request (dynamic custom fonts).
- Download Typst packages and templates from the Typst Universe on demand.
- Return complete error messages and diagnostics.
- Optional Bearer-token authentication for the API.
- Configurable server port, API limits (max payload size, compilation timeout and max concurrent compilations), custom font path and authentication token.
- CORS support.
- Health check endpoint at
GET /health. - Example requests for different Typst documents using curl and PowerShell.
Current endpoints
GET /health
POST /compile
POST /compile/source
GET /fonts
POST /fonts/refresh
The main POST /compile endpoint returns a PDF as a response when the compilation is successful and a JSON with the error message and diagnostics if the compilation fails.
Deployment
The API can be run locally with Docker Compose or using the docker image published at Docker Hub. The end goal is that anyone can easily self-host a Typst API server so that then it can be used in client-side websites or automated tasks.