Upload Media
Upload images and videos to use in your posts.
Overview
PostPeer provides presigned S3 URLs for media uploads. The flow is:
- Request a presigned upload URL from PostPeer
- Upload the file directly to S3 using the presigned URL
- Use the returned public URL in your post's
mediaItems
Get Upload URL
POST https://api.postpeer.dev/v1/media/uploadRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | Name of the file (e.g. "photo.jpg") |
mimeType | string | Yes | MIME type of the file (e.g. "image/jpeg", "video/mp4") |
Only image/* and video/* MIME types are allowed.
Example
curl -X POST "https://api.postpeer.dev/v1/media/upload" \
-H "x-access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filename": "launch-banner.png",
"mimeType": "image/png"
}'Response
{
"success": true,
"data": {
"uploadUrl": "https://s3.amazonaws.com/bucket/...",
"publicUrl": "https://assets.postpeer.dev/uploads/.../launch-banner.png"
}
}Upload the File to S3
Use the uploadUrl from the response to upload the file directly:
curl -X PUT "UPLOAD_URL_FROM_RESPONSE" \
-H "Content-Type: image/png" \
--data-binary @launch-banner.pngUse in a Post
After uploading, use the publicUrl as the media URL in your post:
curl -X POST "https://api.postpeer.dev/v1/posts" \
-H "x-access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Check out our new launch banner!",
"platforms": [
{ "platform": "twitter", "accountId": "abc123" }
],
"mediaItems": [
{ "type": "image", "url": "https://assets.postpeer.dev/uploads/.../launch-banner.png" }
],
"publishNow": true
}'Supported Formats
| Type | Formats |
|---|---|
| Images | JPEG, PNG, GIF, WebP |
| Videos | MP4, MOV |
Status Codes
| Code | Meaning |
|---|---|
200 | Upload URL generated |
400 | Unsupported MIME type or missing fields |