# Media API

> Upload images, videos and documents for posts (and inbox attachments).

Base URL: `https://api.socialit.com/v1`. Authenticate with `Authorization: Bearer <API key or OAuth token>`.

## Get an upload URL

`POST /media/presign`

Returns a URL to PUT the file to (S3/R2 bucket when configured, else the API). Reference the returned media id (or public_url) in posts.

Access: `write` · MCP tool: `presign-media-upload` · Zernio: `POST /v1/media/presign`

### Headers

- `Idempotency-Key` (string; ≤ 255 characters): Unique key (for example a UUID) that makes retries safe: a repeated request with the same key and body returns the first response (Idempotent-Replayed: true) for 24 hours.

### Body

- `filename` (string; required; 1–255 characters)
- `content_type` (string; required; 3–100 characters)
- `size` (integer)
- `folder` (string; ≤ 200 characters)
- `tags` (array of string; ≤ 50 items)
- `alt_text` (string; ≤ 2000 characters)

```bash
curl -X POST "https://api.socialit.com/v1/media/presign" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "string",
    "content_type": "string",
    "size": 0,
    "folder": "string",
    "tags": [
      "string"
    ]
  }'
```

Response 201:

```json
{
  "object": "media_upload",
  "media": {
    "object": "media",
    "id": "string",
    "status": "pending",
    "type": "string",
    "name": "string",
    "file_name": "string",
    "mime_type": "string",
    "size": 1,
    "url": "https://example.com",
    "thumbnail_url": "https://example.com",
    "preview_url": "https://example.com",
    "width": 1,
    "height": 1,
    "duration": 1,
    "alt_text": "string",
    "caption": "string",
    "tags": [
      "string"
    ],
    "folder": "string",
    "storage": "local",
    "source_url": "https://example.com",
    "used_in_posts": 1,
    "created_by": {
      "type": "string",
      "id": "string",
      "name": "string"
    },
    "created_at": "2026-10-13T09:00:00.000Z",
    "updated_at": "2026-10-13T09:00:00.000Z"
  },
  "upload_url": "https://example.com",
  "method": "PUT",
  "headers": {
    "key": "string"
  },
  "public_url": "https://example.com",
  "expires_in": 1
}
```

## Upload a file

`POST /media/upload-direct`

multipart/form-data with a file field (+ optional folder, alt_text, tags). Image ≤ 20 MB, GIF ≤ 15 MB, video ≤ 500 MB, document/audio ≤ 100 MB.

Access: `write` · Zernio: `POST /v1/media/upload-direct`

### Headers

- `Idempotency-Key` (string; ≤ 255 characters): Unique key (for example a UUID) that makes retries safe: a repeated request with the same key and body returns the first response (Idempotent-Replayed: true) for 24 hours.

```bash
curl -X POST "https://api.socialit.com/v1/media/upload-direct" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Response 201:

```json
{
  "object": "media",
  "id": "string",
  "status": "pending",
  "type": "string",
  "name": "string",
  "file_name": "string",
  "mime_type": "string",
  "size": 1,
  "url": "https://example.com",
  "thumbnail_url": "https://example.com",
  "preview_url": "https://example.com",
  "width": 1,
  "height": 1,
  "duration": 1,
  "alt_text": "string",
  "caption": "string",
  "tags": [
    "string"
  ],
  "folder": "string",
  "storage": "local",
  "source_url": "https://example.com",
  "used_in_posts": 1,
  "created_by": {
    "type": "string",
    "id": "string",
    "name": "string"
  },
  "created_at": "2026-10-13T09:00:00.000Z",
  "updated_at": "2026-10-13T09:00:00.000Z"
}
```

## List the media library

`GET /media`

Access: `read` · MCP tool: `list-media-library`

### Query parameters

- `page` (integer; ≥ 1): Page number
- `limit` (integer; 1–100): Items per page (max 100)
- `sort` (string; one of created_at, size, name)
- `order` (string; one of asc, desc)
- `match` (string; one of all, or): Combine filters with AND (default) or OR
- `type` (string; one of image, video, gif, document, audio)
- `status` (string; one of pending, processing, ready, failed)
- `folder` (string)
- `tag` (string)
- `search` (string; ≤ 200 characters)

```bash
curl "https://api.socialit.com/v1/media" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "list",
  "data": [
    {
      "object": "media",
      "id": "string",
      "status": "pending",
      "type": "string",
      "name": "string",
      "file_name": "string",
      "mime_type": "string",
      "size": 1,
      "url": "https://example.com",
      "thumbnail_url": "https://example.com",
      "preview_url": "https://example.com",
      "width": 1,
      "height": 1,
      "duration": 1,
      "alt_text": "string",
      "caption": "string",
      "tags": [
        "string"
      ],
      "folder": "string",
      "storage": "local",
      "source_url": "https://example.com",
      "used_in_posts": 1,
      "created_by": {
        "type": "string",
        "id": "string",
        "name": "string"
      },
      "created_at": "2026-10-13T09:00:00.000Z",
      "updated_at": "2026-10-13T09:00:00.000Z"
    }
  ],
  "page": 1,
  "limit": 1,
  "total": 1,
  "has_more": true,
  "next_page_url": "https://example.com",
  "previous_page_url": "https://example.com"
}
```

## Register media from a public URL

`POST /media`

Access: `write` · MCP tool: `create-media-from-url`

### Headers

- `Idempotency-Key` (string; ≤ 255 characters): Unique key (for example a UUID) that makes retries safe: a repeated request with the same key and body returns the first response (Idempotent-Replayed: true) for 24 hours.

### Body

- `url` (string; required; 8–2048 characters)
- `name` (string; ≤ 255 characters)
- `type` (string; one of image, video, gif, document, audio)
- `alt_text` (string; ≤ 2000 characters)
- `caption` (string; ≤ 5000 characters)
- `tags` (array of string; ≤ 50 items)
- `folder` (string; ≤ 200 characters)

```bash
curl -X POST "https://api.socialit.com/v1/media" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "name": "string",
    "type": "image",
    "alt_text": "string",
    "caption": "string"
  }'
```

Response 201:

```json
{
  "object": "media",
  "id": "string",
  "status": "pending",
  "type": "string",
  "name": "string",
  "file_name": "string",
  "mime_type": "string",
  "size": 1,
  "url": "https://example.com",
  "thumbnail_url": "https://example.com",
  "preview_url": "https://example.com",
  "width": 1,
  "height": 1,
  "duration": 1,
  "alt_text": "string",
  "caption": "string",
  "tags": [
    "string"
  ],
  "folder": "string",
  "storage": "local",
  "source_url": "https://example.com",
  "used_in_posts": 1,
  "created_by": {
    "type": "string",
    "id": "string",
    "name": "string"
  },
  "created_at": "2026-10-13T09:00:00.000Z",
  "updated_at": "2026-10-13T09:00:00.000Z"
}
```

## Media storage usage

`GET /media/usage`

Access: `read` · MCP tool: `get-media-usage`

```bash
curl "https://api.socialit.com/v1/media/usage" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "media_usage",
  "used_bytes": 1,
  "limit_bytes": 1,
  "files": 1,
  "by_type": {
    "key": 1
  }
}
```

## List media folders

`GET /media/folders`

Access: `read` · MCP tool: `list-media-folders`

```bash
curl "https://api.socialit.com/v1/media/folders" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "list",
  "data": [
    {
      "object": "media_folder",
      "name": "string",
      "count": 1
    }
  ],
  "page": 1,
  "limit": 1,
  "total": 1,
  "has_more": true,
  "next_page_url": "https://example.com",
  "previous_page_url": "https://example.com"
}
```

## Get media

`GET /media/{id}`

Access: `read` · MCP tool: `get-media-item`

### Path parameters

- `id` (string; required; 1–80 characters): media id (med_…)

```bash
curl "https://api.socialit.com/v1/media/med_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "media",
  "id": "string",
  "status": "pending",
  "type": "string",
  "name": "string",
  "file_name": "string",
  "mime_type": "string",
  "size": 1,
  "url": "https://example.com",
  "thumbnail_url": "https://example.com",
  "preview_url": "https://example.com",
  "width": 1,
  "height": 1,
  "duration": 1,
  "alt_text": "string",
  "caption": "string",
  "tags": [
    "string"
  ],
  "folder": "string",
  "storage": "local",
  "source_url": "https://example.com",
  "used_in_posts": 1,
  "created_by": {
    "type": "string",
    "id": "string",
    "name": "string"
  },
  "created_at": "2026-10-13T09:00:00.000Z",
  "updated_at": "2026-10-13T09:00:00.000Z"
}
```

## Update media

`PATCH /media/{id}`

Name, alt text, caption, tags and folder.

Access: `write` · MCP tool: `update-media-item`

### Path parameters

- `id` (string; required; 1–80 characters): media id (med_…)

### Body

- `name` (string; 1–255 characters)
- `alt_text` (string | null; ≤ 2000 characters)
- `caption` (string | null; ≤ 5000 characters)
- `tags` (array of string; ≤ 50 items)
- `folder` (string | null; ≤ 200 characters)

```bash
curl -X PATCH "https://api.socialit.com/v1/media/med_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "alt_text": "string",
    "caption": "string",
    "tags": [
      "string"
    ],
    "folder": "string"
  }'
```

Response 200:

```json
{
  "object": "media",
  "id": "string",
  "status": "pending",
  "type": "string",
  "name": "string",
  "file_name": "string",
  "mime_type": "string",
  "size": 1,
  "url": "https://example.com",
  "thumbnail_url": "https://example.com",
  "preview_url": "https://example.com",
  "width": 1,
  "height": 1,
  "duration": 1,
  "alt_text": "string",
  "caption": "string",
  "tags": [
    "string"
  ],
  "folder": "string",
  "storage": "local",
  "source_url": "https://example.com",
  "used_in_posts": 1,
  "created_by": {
    "type": "string",
    "id": "string",
    "name": "string"
  },
  "created_at": "2026-10-13T09:00:00.000Z",
  "updated_at": "2026-10-13T09:00:00.000Z"
}
```

## Delete media

`DELETE /media/{id}`

Access: `write` · MCP tool: `delete-media-item`

### Path parameters

- `id` (string; required; 1–80 characters): media id (med_…)

```bash
curl -X DELETE "https://api.socialit.com/v1/media/med_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "media",
  "id": "string",
  "deleted": true
}
```

## Finalize a presigned upload

`POST /media/{id}/complete`

Access: `write` · MCP tool: `complete-media-upload`

### Path parameters

- `id` (string; required; 1–80 characters): media id (med_…)

### Headers

- `Idempotency-Key` (string; ≤ 255 characters): Unique key (for example a UUID) that makes retries safe: a repeated request with the same key and body returns the first response (Idempotent-Replayed: true) for 24 hours.

```bash
curl -X POST "https://api.socialit.com/v1/media/med_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd/complete" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Response 200:

```json
{
  "object": "media",
  "id": "string",
  "status": "pending",
  "type": "string",
  "name": "string",
  "file_name": "string",
  "mime_type": "string",
  "size": 1,
  "url": "https://example.com",
  "thumbnail_url": "https://example.com",
  "preview_url": "https://example.com",
  "width": 1,
  "height": 1,
  "duration": 1,
  "alt_text": "string",
  "caption": "string",
  "tags": [
    "string"
  ],
  "folder": "string",
  "storage": "local",
  "source_url": "https://example.com",
  "used_in_posts": 1,
  "created_by": {
    "type": "string",
    "id": "string",
    "name": "string"
  },
  "created_at": "2026-10-13T09:00:00.000Z",
  "updated_at": "2026-10-13T09:00:00.000Z"
}
```


---

Source: https://socialit.com/docs/api-reference/media/
