Packages API
Endpoints for managing Typst community packages.
List Installed Packages
GET /api/packages
Returns all installed packages with their metadata.
Example
bash
curl http://localhost:3000/api/packagesResponse
json
[
{
"name": "iconify",
"version": "0.4.0",
"description": "Iconify icon collection for Typst",
"license": "MIT",
"size": 245760
}
]Install Package
POST /api/packages
Install a Typst community package from the registry.
Request Body
json
{
"name": "iconify",
"version": "0.4.0"
}| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Package name |
version | string | Yes | Package version (e.g., 0.4.0) |
Example
bash
curl -X POST http://localhost:3000/api/packages \
-H "Content-Type: application/json" \
-d '{"name": "iconify", "version": "0.4.0"}'Response
json
{
"name": "iconify",
"version": "0.4.0"
}Delete Package
DELETE /api/packages
Remove an installed package.
Request Body
json
{
"name": "iconify",
"version": "0.4.0"
}Example
bash
curl -X DELETE http://localhost:3000/api/packages \
-H "Content-Type: application/json" \
-d '{"name": "iconify", "version": "0.4.0"}'Response
204 No Content
Check Missing Packages
POST /api/packages/check
Check a template for missing packages and optionally install them.
Request Body
json
{
"template": "my-report"
}| Field | Type | Required | Description |
|---|---|---|---|
template | string | Yes | Template name to check |
Example
bash
curl -X POST http://localhost:3000/api/packages/check \
-H "Content-Type: application/json" \
-d '{"template": "my-report"}'Response
json
{
"missing": ["iconify:0.4.0"],
"installed": ["iconify:0.4.0"]
}When autoInstall is enabled (default), missing packages are automatically installed.