Media
Upload media
POST
https://postifuse.com/v1/mediaUpload once, from a URL or from a file. The response says, per network, whether the file fits and what to change if not. The original is never changed.
- Large file: send
"upload": trueto get a one-timeupload_url, valid one hour, toPUTthe bytes to "adjust": true: Postifuse makes one version per network that needs it (ratio, length, size, codec) and sendsmedia.readywhen they are done
curl --request POST \
--url 'https://postifuse.com/v1/media' \
--header 'Authorization: Bearer pf_live_…' \
--header 'Idempotency-Key: upload-media-1' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://cdn.example.com/reel.mp4"
}'
const res = await fetch("https://postifuse.com/v1/media", {
method: "POST",
headers: {
"Authorization": "Bearer pf_live_…",
"Idempotency-Key": "upload-media-1",
"Content-Type": "application/json"
},
body: JSON.stringify({
"url": "https://cdn.example.com/reel.mp4"
}),
});
const data = await res.json();
import requests
res = requests.post(
"https://postifuse.com/v1/media",
headers={"Authorization": "Bearer pf_live_…", "Idempotency-Key": "upload-media-1"},
json={
"url": "https://cdn.example.com/reel.mp4"
},
)
print(res.json())
{
"id": "med_42",
"type": "video",
"duration_s": 42,
"ratio": "9:16",
"size_mb": 38,
"fit": {
"tiktok": "ok",
"instagram": "ok",
"x": {
"status": "blocked",
"rule": "x.video.max_duration",
"fix": "Trim to 140 s or less",
"adjust": "trim_to_140s"
}
}
}
{
"error": "workspace_not_active",
"message": "The workspace for this key is not active yet.",
"docs": "https://postifuse.com/docs/errors/"
}
Headers
AuthorizationstringrequiredBearer followed by a workspace key, a profile key or an OAuth token. See authentication.
Example Bearer pf_live_…
Idempotency-KeystringrequiredAny unique string. The same key within 24 h returns the same result and posts nothing twice.
Body application/json
urlstring<uri>A public URL of the image or video.
Example https://cdn.example.com/reel.mp4
uploadbooleanReturn a one-time upload_url instead of fetching url.
Example true
adjustbooleanMake one version per network that needs it.
Example true
Response
200Media and its fit per network
403Workspace not active