Skip to content

Assets API

Endpoints for managing uploaded asset files.

List Assets

GET /api/assets

Returns all assets, optionally filtered by search query.

Query Parameters

ParameterTypeDescription
qstringSearch query (optional)

Example

bash
curl http://localhost:3000/api/assets

Response

json
[
  {
    "name": "logo.png",
    "type": "file",
    "size": 24576
  },
  {
    "name": "fonts",
    "type": "folder"
  }
]

Upload Asset

POST /api/assets/:name

Upload a file as an asset.

Path Parameters

ParameterDescription
nameAsset filename (supports subfolder paths like fonts/custom.ttf)

Request

Send the raw file content as the body with the appropriate Content-Type.

Example

bash
curl -X POST http://localhost:3000/api/assets/logo.png \
  -H "Content-Type: image/png" \
  --data-binary @logo.png

Get Asset

GET /api/assets/:name

Download an asset file.

Example

bash
curl http://localhost:3000/api/assets/logo.png -o logo.png

Delete Asset

DELETE /api/assets/:name

Delete an asset file.

Example

bash
curl -X DELETE http://localhost:3000/api/assets/old-logo.png

Response

204 No Content


Asset Folders

List Folders

GET /api/assets/folders

Create Folder

POST /api/assets/folders

json
{
  "name": "fonts"
}

Delete Folder

DELETE /api/assets/folders

json
{
  "name": "fonts"
}

Design and Dev by David Lam