Skip to content

Assets ​

Assets are files (images, fonts, documents) that you upload for use in your Typst templates.

Supported Asset Types ​

TypeExtensionsUsage
Images.png, .jpg, .jpeg, .gif, .svg, .webpEmbed in templates with image("assets/filename.png")
Fonts.ttf, .otf, .ttcAuto-detected and available in Typst templates
DocumentsAny other file typeStored but not processed

Uploading Assets ​

Via the UI ​

  1. Navigate to Assets in the sidebar
  2. Click the + button or drag and drop files
  3. 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.png

Base64 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.png

Use the ?prefix= query parameter to filter assets by folder:

bash
curl "http://localhost:3000/api/assets?prefix=fonts/"

Design and Dev by David Lam