API Reference / Media

Upload an image

PostPiper API: upload one JPEG, PNG, or WebP image as multipart form data. Returns an owned asset ID for use in X, LinkedIn, or Pinterest drafts.

POSThttps://api.postpiper.ai/v1/media

Use a file field named file. JPEG, PNG, and WebP images up to 5 MB are accepted. The image is validated and normalized before storage. Preview URLs expire after 15 minutes.

Request body

NameTypeDescription
filefile, requiredOne JPEG, PNG, or WebP image, at most 5 MB.

Example request

Terminal
curl -X POST "https://api.postpiper.ai/v1/media" \
  -H "Authorization: Bearer $POSTPIPER_API_KEY" \
  -F "file=@photo.webp"

Response

201 Created. Returns the owned image asset.

JSON
{
  "asset": {
    "id": "<asset-uuid>",
    "post_id": null,
    "mime_type": "image/webp",
    "size_bytes": 34567,
    "created_at": "2030-10-12T01:00:00.000Z",
    "preview_url": "https://<signed-preview-url>"
  }
}

Errors

  • 400INVALID_MEDIA.
  • 401Missing or invalid API key.
  • 403API key lacks the required scope.
  • 413MEDIA_TOO_LARGE.
  • 429MEDIA_RATE_LIMITED.