API Overview
All API endpoints are prefixed with /api. The server listens on port 3000 by default.
Base URL
http://localhost:3000/apiContent Types
| Direction | Content-Type |
|---|---|
| Request (JSON) | application/json |
| Request (Typst) | text/typst |
| Request (Binary) | application/octet-stream |
| Response (PDF) | application/pdf |
| Response (JSON) | application/json |
Authentication
If enabled, all requests require HTTP Basic Auth:
bash
curl -u "username:password" http://localhost:3000/api/templatesRate Limiting
| Limit Type | Window | Max Requests |
|---|---|---|
| General | 60s | 100 |
| Compilation | 60s | 30 |
Rate limit headers are included in responses:
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset
Standard Responses
Success
json
{
"status": "ok",
"data": { ... }
}Error
json
{
"status": "error",
"error": "Description of what went wrong"
}HTTP Status Codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Created |
204 | Deleted (no content) |
400 | Bad request / validation error |
401 | Unauthorized (auth required) |
404 | Not found |
413 | Payload too large |
429 | Rate limited |
500 | Internal server error |
Endpoints Summary
| Method | Path | Description |
|---|---|---|
| POST | /api/preview | Compile inline Typst to PDF |
| POST | /api/report | Compile saved template to PDF |
| GET | /api/templates | List all templates |
| POST | /api/templates | Create a template folder |
| GET | /api/templates/:name | Get template content |
| PUT | /api/templates/:name | Create or update template |
| DELETE | /api/templates/:name | Delete a template |
| GET | /api/folders | List template folders |
| POST | /api/folders | Create a template folder |
| DELETE | /api/folders | Delete a template folder |
| GET | /api/assets | List all assets |
| POST | /api/assets | Create asset folder |
| GET | /api/assets/:name | Get asset file |
| POST | /api/assets/:name | Upload asset |
| DELETE | /api/assets/:name | Delete asset |
| GET | /api/assets/folders | List asset folders |
| POST | /api/assets/folders | Create asset folder |
| DELETE | /api/assets/folders | Delete asset folder |
| GET | /api/packages | List installed packages |
| POST | /api/packages | Install a package |
| DELETE | /api/packages | Delete a package |
| POST | /api/packages/check | Check for missing packages |
| GET | /api/health | Health check |
| GET | /api/metrics | Server metrics |