Assets
Assets are files (images, fonts, documents) that you upload for use in your Typst templates.
Supported Asset Types
| Type | Extensions | Usage |
|---|---|---|
| Images | .png, .jpg, .jpeg, .gif, .svg, .webp | Embed in templates with image("assets/filename.png") |
| Fonts | .ttf, .otf, .ttc | Auto-detected and available in Typst templates |
| Documents | Any other file type | Stored but not processed |
Uploading Assets
Via the UI
- Navigate to Assets in the sidebar
- Click the + button or drag and drop files
- Assets appear immediately in the gallery view
Via the API
Assets can be uploaded in multiple formats:
Binary (recommended):
bash
curl -X POST http://localhost:3000/api/assets/logo.png \
-H "Content-Type: image/png" \
--data-binary @logo.pngBase64 in JSON:
bash
curl -X POST http://localhost:3000/api/assets/logo.png \
-H "Content-Type: application/json" \
-d '\''{"content": "<base64-encoded-data>"}'\''Using Assets in Templates
Images
typst
// Reference by filename
#image("assets/logo.png", width: 50%)
// With explicit path
#image("assets/reports/banner.jpg", height: 3cm)Fonts
Upload .ttf, .otf, or .ttc files to the assets folder. They are automatically detected and available in Typst:
typst
#set text(font: "My Custom Font")Folder Organization
Assets support nested folders, just like templates:
assets/
+-- logo.png
+-- logoH.png
+-- header-bg.jpg
+-- fonts/
� +-- custom-font.ttf
� +-- icon-font.ttf
+-- reports/
+-- q1-2024.png
+-- q2-2024.pngUse the ?prefix= query parameter to filter assets by folder:
bash
curl "http://localhost:3000/api/assets?prefix=fonts/"