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

Status Codes

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

On this page