Upload media
Upload a single file of up to 100 MB outside of a page request. This is useful when you want the URL up front to reference in content later. To attach files to a page request instead, see inline media. For a file over 100 MB, or an upload you want to be able to retry, use a direct upload.
POST https://sitepaste.com/api/v1/public/media
Requires the media scope.
Usage
curl -X POST https://sitepaste.com/api/v1/public/media \
-H "Authorization: Bearer $TOKEN" \
-F file=@photo.jpg
Authorizations
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication. |
Body
multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | The file to upload: up to 100 MB on a paid plan, 10 MB on the free plan (a larger file is a 413). |
| siteId | string | No | Site whose protection settings the file inherits, as a short ID or the literal default. Omitted, the default site’s settings apply. |
| pageId | string | No | Page whose protection settings the file inherits, on top of the site’s, as a short ID. It must be a page of the site the file inherits from: the one siteId names, or the default site when siteId is omitted. |
| note | string | No | A note stored with the file (max 200 bytes). |
| highQuality | boolean | No | Compress images at a higher quality setting. |
| preserveMetadata | boolean | No | Keep EXIF and other metadata instead of stripping it. |
Response
201 Created with the stored file, and a Location header naming it in the media library.
{
"url": "https://media.example.com/media/.../f8e2a1b3c4d5.webp",
"filename": "f8e2a1b3c4d5.webp"
}
| Field | Type | Description |
|---|---|---|
| url | string | Where the file is served from, ready to use in page content. An unprotected file gets an absolute URL. A protected file’s URL is a /media/... path that opens only for visitors who can open a page that shows it. |
| filename | string | The file’s generated name. Images are renamed and converted, so this rarely matches the name you uploaded. |
Use the url directly in page content:

Processing
Images (JPEG, PNG, GIF, WebP) are converted to WebP at their original dimensions. Metadata is stripped from images, videos, and PDFs unless preserveMetadata is set. MOV files are transcoded to MP4. Large files finish processing shortly after the request returns. The filename you are given is permanent: a transcoded MOV keeps it, and only its url and mimeType change to the MP4 when transcoding finishes.
Limits
This route spends from the upload budget of 600 a minute, which it shares with POST /uploads/{uploadId}/complete and nothing else. Unlike the other budgets it charges on arrival, so a refused upload still costs a unit.
Attaching the files to a page write as inline media is still the better path when the pages are being written anyway: it stores the files and the pages referencing them in one call.
A request body over 100 MB is refused with a 413 on every plan. Upload a larger file with a direct upload, which takes files up to the paid plans’ per-file limit of 10 GB: call POST /uploads to start it, upload to the URLs it returns, then POST /uploads/{uploadId}/complete to finish.
Uploads over 10 MB (paid plans only) are limited further: 4 at a time per workspace, refused with a 429 (“Too many large uploads”) beyond that. Direct uploads are not subject to this limit, so use them for a bulk import.
Supported file types
| Category | Extensions |
|---|---|
| Images | .jpg, .jpeg, .png, .gif, .webp (SVG is not accepted) |
| Documents | .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .txt, .csv, .md |
| Archives | .zip |
| Audio | .mp3 |
| Video | .mp4, .webm, .mov |
Both the file’s extension and its contents must be one of the types above. The same types apply to inline uploads.
Errors
| Code | Meaning |
|---|---|
| 400 | No file part in the form, a file type that is not allowed, a note over 200 bytes, or a siteId or pageId that is not a short ID. |
| 402 | The upload would exceed your plan’s remaining storage. Delete media from the dashboard or add storage. |
| 404 | The siteId names no site in this workspace, or the pageId names no page of the site the file inherits from. In a workspace with no default site, a siteId of default and a pageId sent without a siteId are refused with the code no_default_site. Nothing is stored. |
| 413 | The file is over the size limit: 10 MB on the free plan, 100 MB on paid plans. On a paid plan, upload the file with POST /uploads instead. A request body over 100 MB can be refused before it reaches the API, in which case the 413 has no JSON body. |
| 422 | An Idempotency-Key header was sent. This route does not support one. Remove the header, or use POST /uploads for a retryable upload. |
| 429 | The upload budget is spent, or too many large uploads are in flight (see Limits). |
| 503 | Uploads are temporarily unavailable. Retry after a few seconds. |