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 |
Video Specifications by Platform
For the most reliable cross-platform publishing, use an MP4 container with H.264 video, AAC audio, progressive scan, and the moov atom at the front of the file. Platform limits can change, and account-specific limits can be lower.
| Platform | Container | Video and audio | Frame rate | Dimensions and aspect ratio | Duration | Maximum file size | Official specifications |
|---|---|---|---|---|---|---|---|
| TikTok | MP4 recommended; MOV and WebM supported | H.264 recommended; H.265, VP8, and VP9 supported | 23-60 FPS | Width and height must each be 360-4,096 px | Creator-specific; API upload maximum is 10 minutes | 4 GB | TikTok media transfer guide |
| Instagram Reel | MP4 or MOV | H.264 or HEVC; AAC, 48 kHz | 23-60 FPS | 0.01:1-10:1 required; 9:16 recommended; maximum 1,920 px wide | 3 seconds-15 minutes | 300 MB | Meta's Instagram Reel specifications |
| Facebook Page video | MP4 or MOV recommended | H.264 video with AAC audio recommended | 30 FPS or lower recommended | Maximum 4,000 px wide; dimensions divisible by 16 recommended | Up to 240 minutes | 4 GB | Facebook video settings and upload limits |
| YouTube video | MP4 recommended; YouTube accepts MOV, AVI, WebM, ProRes, HEVC, and other formats | H.264 video with AAC-LC audio recommended | Preserve the source frame rate; 24, 25, 30, 48, 50, and 60 FPS are common | 16:9 standard; player adapts to vertical and square video | 15 minutes by default; up to 12 hours for verified accounts | 256 GB | YouTube encoding settings and upload limits |
| YouTube Short | Same as YouTube video | Same as YouTube video | Same as YouTube video | Square or vertical | Up to 3 minutes | 256 GB | Three-minute YouTube Shorts |
TikTok's creator-info response provides maxVideoPostDurationSec. Use that account-specific value instead of assuming every creator can publish a 10-minute video.
Status Codes
| Code | Meaning |
|---|---|
200 | Upload URL generated |
400 | Unsupported MIME type or missing fields |