Skip to content

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/packages

Response ​

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"
}
FieldTypeRequiredDescription
namestringYesPackage name
versionstringYesPackage 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/:name/:version

Remove an installed package.

Example ​

bash
curl -X DELETE http://localhost:3000/api/packages/iconify/0.4.0

Response ​

204 No Content


Check Missing Packages ​

POST /api/packages/check

Check template content for missing packages and optionally install them.

Request Body ​

json
{
  "templateContent": "#import \"@preview/iconify:0.4.0\": icon\n= Hello"
}
FieldTypeRequiredDescription
templateContentstringYesTypst markup content to scan for package imports

Example ​

bash
curl -X POST http://localhost:3000/api/packages/check \
  -H "Content-Type: application/json" \
  -d '\''{"templateContent": "#import \"@preview/iconify:0.4.0\": icon\n= Hello"}'\''

Response ​

json
{
  "missing": ["iconify:0.4.0"],
  "installed": ["iconify:0.4.0"]
}

When autoInstall is enabled (default), missing packages are automatically installed with up to 3 retry attempts.

Design and Dev by David Lam