# Media

Source: https://postgale.com/docs/api/media

Upload images and videos once and use their public URL in posts and messages.

Instagram, Facebook, Threads and TikTok publish media from a public URL. Host media with `POST /media` and use its `publicUrl` as
`mediaUrl` (or in `mediaUrls`) in [`platformSpecificData`](https://postgale.com/docs/api/posts#platform-options). Instagram images must be JPEG.

| Method | Path | Description |
| --- | --- | --- |
| GET | `/media` | The 200 most recent uploads |
| POST | `/media` | multipart file, or JSON `{url \| base64, fileName?, mimeType?}`; returns publicUrl |
| GET | `/media/{id}` | One upload |

POST /api/v1/media:
```bash
curl -X POST https://postgale.com/api/v1/media \
  -H 'Authorization: Bearer sk_…' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://shop.example/menu.jpg","fileName":"menu.jpg"}'
```

- Direct messages take an uploaded file as `mediaId` (Instagram and Messenger attachments, see [Comments & inbox](https://postgale.com/docs/api/comments-inbox#direct-messages)).
- WhatsApp needs the file uploaded to WhatsApp itself: `POST /whatsapp/accounts/{id}/media` with `{"mediaId":"…"}` (a Postgale upload) returns the WhatsApp media id ([WhatsApp media](https://postgale.com/docs/whatsapp#media)).
