Skip to main content
The POST /api/upload-asset endpoint lets you upload images and other media files directly through Studio or custom tooling. The endpoint accepts a JSON body carrying the file’s name, MIME type, and base64-encoded content. Uploaded files are saved to the project’s public assets images directory and are immediately available as image URLs you can reference in any image field. Studio calls this endpoint when you drag-and-drop or select a file in the image picker. You can also call it from scripts to seed your project with images.

Request

  • Method: POST
  • Path: /api/upload-asset
  • Content-Type: application/json
string
required
The target filename including extension (e.g., "readme-first.jpg"). The file will be saved under this name in the assets images directory.
string
required
The file content as a base64-encoded string (without a data-URL prefix). The endpoint decodes this string and writes the binary file to disk.
string
Optional MIME type of the file (e.g., "image/jpeg", "image/png"). Used for validation and metadata. If omitted, the type is inferred from the filename extension.

Response

200 OK — The file was saved successfully. The response contains the public URL you can use in image fields.
string
The public path to the uploaded file (e.g., "/assets/images/readme-first.jpg"). Use this value as the url in any ImageSelectionSchema field — for example in a hero or content-block section’s image.url.

Supported formats

The endpoint accepts common image formats. Examples include:

Error responses