Publishing · Media
Fetches an upload URL.
Request
Send your API key as Authorization: Bearer pz_live_.... Read-only keys cannot call it. Keys with the publishing resource group disabled get 403 resource_group_disabled. Authentication
Request body
application/json, required
filenamestringrequiredcontentTypestringrequiredOne of
image/jpeg,image/jpg,image/png,image/webp,image/gif,video/mp4,video/mpeg,video/quicktime,video/avi,video/x-msvideo,video/webm,video/x-m4v,application/pdf,audio/mpeg,audio/mp4,audio/aac,audio/ogg,audio/wav,audio/webm,audio/x-m4a,application/x-subrip,text/vtt.sizeinteger
Example
curl -X POST "https://api.pozy.ai/v1/media/presign" \
-H "Authorization: Bearer $POZY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filename": "photo.jpg",
"contentType": "image/jpeg"
}'const res = await fetch("https://api.pozy.ai/v1/media/presign", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.POZY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
filename: "photo.jpg",
contentType: "image/jpeg"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);import os
import requests
resp = requests.post(
"https://api.pozy.ai/v1/media/presign",
headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
json={
"filename": "photo.jpg",
"contentType": "image/jpeg",
},
timeout=30,
)
resp.raise_for_status()
print(resp.json())Response
200 on success
uploadUrlstring (URL)publicUrlstring (URL)keystringexpiresIninteger
200 response
{
"uploadUrl": "https://pozy.ai/media/example-1.jpg",
"publicUrl": "https://pozy.ai/media/example-1.jpg",
"key": "string",
"expiresIn": 1
}Errors
Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:
| 400 | invalid_request_error | A parameter or body field is missing or invalid. param names it. |
| 401 | authentication_error | The API key is missing, revoked or expired. |
| 403 | permission_error | The key is read-only, scoped to other profiles, or has this resource group disabled. |
| 429 | rate_limit_error | Too many requests this minute. Wait for Retry-After seconds. |
Every code is listed in Errors.