PostZen
Media

Create a presigned media upload URL

POST
/v1/media/presign

Creates a presigned URL for uploading an image, video, GIF, or PDF to PostZen-hosted storage. Upload the file with an HTTP PUT to uploadUrl, then reference publicUrl in post mediaItems. This endpoint requires a read-write API key.

Authorization

bearerAuth
AuthorizationBearer <token>

PostZen API key.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/media/presign" \  -H "Content-Type: application/json" \  -d '{    "filename": "launch-video.mp4",    "contentType": "video/mp4",    "size": 10485760  }'
{  "uploadUrl": "https://postzen-media.a1b2c3d4e5f6a7b8.r2.cloudflarestorage.com/users/jd7cm2xw9krt4v1n8q6zs0b3hf5yg2pa/media/6f0d0296-6a1c-4d5b-9a2e-3f8c1b7d4e90/launch-video.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=f3ac1e2b",  "publicUrl": "https://media.postzen.dev/users/jd7cm2xw9krt4v1n8q6zs0b3hf5yg2pa/media/6f0d0296-6a1c-4d5b-9a2e-3f8c1b7d4e90/launch-video.mp4",  "key": "users/jd7cm2xw9krt4v1n8q6zs0b3hf5yg2pa/media/6f0d0296-6a1c-4d5b-9a2e-3f8c1b7d4e90/launch-video.mp4",  "type": "video"}
{  "error": "JSON body is required"}
{  "error": "Unauthorized"}
{  "error": "API key requires read_write permission"}
{  "error": "Not found"}
{  "error": "Failed to create post"}