Skip to main content

Upload Media

Upload images and videos to use in your posts.

Overview

PostPeer provides presigned S3 URLs for media uploads. The flow is:

  1. Request a presigned upload URL from PostPeer
  2. Upload the file directly to S3 using the presigned URL
  3. Use the returned public URL in your post's mediaItems

Get Upload URL

POST https://api.postpeer.dev/v1/media/upload

Request Body

FieldTypeRequiredDescription
filenamestringYesName of the file (e.g. "photo.jpg")
mimeTypestringYesMIME 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.png

Use 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

TypeFormats
ImagesJPEG, PNG, GIF, WebP
VideosMP4, 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.

PlatformContainerVideo and audioFrame rateDimensions and aspect ratioDurationMaximum file sizeOfficial specifications
TikTokMP4 recommended; MOV and WebM supportedH.264 recommended; H.265, VP8, and VP9 supported23-60 FPSWidth and height must each be 360-4,096 pxCreator-specific; API upload maximum is 10 minutes4 GBTikTok media transfer guide
Instagram ReelMP4 or MOVH.264 or HEVC; AAC, 48 kHz23-60 FPS0.01:1-10:1 required; 9:16 recommended; maximum 1,920 px wide3 seconds-15 minutes300 MBMeta's Instagram Reel specifications
Facebook Page videoMP4 or MOV recommendedH.264 video with AAC audio recommended30 FPS or lower recommendedMaximum 4,000 px wide; dimensions divisible by 16 recommendedUp to 240 minutes4 GBFacebook video settings and upload limits
YouTube videoMP4 recommended; YouTube accepts MOV, AVI, WebM, ProRes, HEVC, and other formatsH.264 video with AAC-LC audio recommendedPreserve the source frame rate; 24, 25, 30, 48, 50, and 60 FPS are common16:9 standard; player adapts to vertical and square video15 minutes by default; up to 12 hours for verified accounts256 GBYouTube encoding settings and upload limits
YouTube ShortSame as YouTube videoSame as YouTube videoSame as YouTube videoSquare or verticalUp to 3 minutes256 GBThree-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

CodeMeaning
200Upload URL generated
400Unsupported MIME type or missing fields

On this page