Uploading media
A post can only use media stored in Postra. Get a file into Postra in one of three ways:
| Way | Route | Best for |
|---|---|---|
| Upload the file | POST /upload |
Files on your computer or server |
| Give Postra a link | POST /upload-from-url |
Files already online, and videos over 50 MB |
| Reuse a file | GET /media |
Files already in your Postra media library |
Each way gives you a media item with an id and a path. You put those two values in the post.
File types
Postra checks what the file really is, not its name. It accepts:
- Images: JPEG, PNG, GIF, WebP, AVIF, BMP, TIFF
- Video: MP4
Anything else is refused with 400 and Unsupported file type. A post can only use JPEG, PNG, GIF, WebP and MP4 files: AVIF, BMP and TIFF stay in your library but are refused when you attach them to a post.
Each platform has its own media rules too, for example how many images a post can have. See Platforms and settings.
Upload a file
POST /upload takes multipart/form-data with the file in a field called file.
curl https://app.postra.co.uk/api/public/v1/upload \
-H "Authorization: YOUR_API_KEY" \
-F "file=@sourdough.jpg"
Limits:
| Limit | Value |
|---|---|
| Image size | 10 MB |
| Whole request | 50 MB. A bigger request is refused with 413. |
| Rate | 30 uploads per 5 minutes |
So a video sent this way must fit in the 50 MB request. For a bigger video, use POST /upload-from-url.
Files over 12 MB upload two at a time per workspace. A third one at the same moment gets 429 with a Retry-After header: wait that many seconds and send it again.
Postra stores every file under a new random name (name) and keeps your file name as originalName.
Upload from a link
POST /upload-from-url asks Postra to download the file for you.
| Body field | Required | Meaning |
|---|---|---|
url |
yes | Where the file is |
curl https://app.postra.co.uk/api/public/v1/upload-from-url \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/media/autumn-menu.mp4"}'
The link must:
- be public and start with
https:// - end in
.png,.jpg,.jpeg,.gif,.webpor.mp4(a query string after it is fine) - point to a file of 100 MB or less
Postra waits up to 60 seconds for the download. The rate limit is 30 requests per 5 minutes.
| Error | Cause |
|---|---|
400 with a list of messages |
The link is not public HTTPS, or its ending is not on the list |
400 {"msg": "Failed to fetch URL"} |
The server behind the link did not return the file |
400 {"msg": "The file is larger than 100 MB"} |
The file is too big |
400 {"msg": "Unsupported file type."} |
The file is not one of the accepted types |
402 with "code": "MEDIA_STORAGE_FULL" |
Your media library is full (see below) |
Media storage
Every file you upload counts towards your plan’s media storage: 20 GB on Starter, 50 GB on Pro and 100 GB on Business, 2 GB during the free trial. Both routes refuse a file that does not fit with 402:
{
"statusCode": 402,
"code": "MEDIA_STORAGE_FULL",
"used": 10200547328,
"limit": 10737418240,
"message": "Your media library is full: 9.5 GB of 10 GB on your plan. Delete files you no longer need, or upgrade your plan for more space."
}
used and limit are in bytes. Deleting files in Media in the app frees their space at once.
What comes back
Both routes answer 201 with the new media item. The fields you need are id and path:
{
"id": "0c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
"name": "k3j9x2m1qa.jpg",
"path": "https://cdn.postra.co.uk/2026/10/08/k3j9x2m1qa.jpg",
"type": "image",
"createdAt": "2026-10-08T10:15:00.000Z"
}
The answer has a few more fields. You can ignore them.
Reuse a file from your media library
GET /media lists the files in your media library, newest first, 18 per page.
| Query field | Required | Meaning |
|---|---|---|
page |
no | Page number, from 1 |
search |
no | Part of the original file name |
curl "https://app.postra.co.uk/api/public/v1/media?page=1" \
-H "Authorization: YOUR_API_KEY"
{
"pages": 3,
"results": [
{
"id": "0c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
"name": "k3j9x2m1qa.jpg",
"originalName": "summer-sale.jpg",
"path": "https://cdn.postra.co.uk/2026/10/08/k3j9x2m1qa.jpg",
"createdAt": "2026-10-08T10:15:00.000Z"
}
]
}
search looks at originalName: the name of the file you sent to POST /upload, or the last part of the address you gave POST /upload-from-url. name is the name Postra stored the file under.
Add media to a post
Put the id and path of each item in the image list of a post part. The list can hold up to 20 items, videos included.
curl https://app.postra.co.uk/api/public/v1/posts \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "schedule",
"date": "2026-11-02T09:30:00.000Z",
"shortLink": false,
"tags": [],
"posts": [
{
"integration": { "id": "8d3f1c2a-5b6e-4f7a-9c0d-1e2f3a4b5c6d" },
"value": [
{
"content": "Fresh sourdough every Saturday.",
"image": [
{
"id": "0c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
"path": "https://cdn.postra.co.uk/2026/10/08/k3j9x2m1qa.jpg"
}
]
}
],
"settings": { "post_type": "post" }
}
]
}'
A path that does not point to Postra’s own storage is refused with 400. Upload the file first, even if it is already online.
Each item can also carry alt, a text description of the image for people who use screen readers (Instagram, Bluesky, Mastodon and Slack publish it; Instagram takes up to 1,000 characters), thumbnail, the URL of a JPEG or PNG from your library used as a video’s cover, and thumbnailTimestamp, the video frame to use as the cover, in milliseconds (Instagram Reels, TikTok).
More about creating posts: Endpoints.