Create a presigned media upload URL
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 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"}Complete an OAuth connection POST
Exchanges an OAuth authorization code for tokens and connects the account to the specified profile. This endpoint requires a read-write API key.
Upload a file directly POST
Uploads a file in the request itself and returns a public URL, for cases where a two-step presign is inconvenient and the file is small — chiefly direct message attachments, where Meta fetches the URL itself. The stored object is deleted automatically after seven days, so it is not a substitute for `POST /v1/media/presign` when publishing posts. Maximum 25MB. Requires a read-write API key.