# Media API

> Upload images and videos to attach when scheduling posts.

Source: https://xbeast.io/docs/api-media

Upload an image or video to XBeast storage. Use the returned HTTPS `url` as `tweets[].media_url` when creating a post. You can also skip this endpoint and pass any public HTTPS media URL.

### Upload a file

**`POST /api/v1/media`**

Send `multipart/form-data` with a single field named `file`.

#### Limits

| Kind | Max size | Formats |
| --- | --- | --- |
| Image | 5 MB | PNG, JPEG, GIF, WebP |
| Video | 100 MB | MP4, MOV (QuickTime), WebM |

## Response (201)

```json
{
  "url": "https://....supabase.co/storage/v1/object/public/images/USER_ID/uuid.jpg",
  "type": "image"
}
```

`type` is `image` or `video`.

**curl**

```bash
curl -X POST "https://xbeast.io/api/v1/media" \
  -H "Authorization: Bearer xb_live_YOUR_KEY" \
  -F "file=@/path/to/image.jpg"
```
