---
title: "Uploading Media with the API | Maeve Social"
description: "Upload an image, video, or document with the public API in three requests, then attach it to a post or find it in your library."
url: "https://maevesocial.com/guides/api-cli-and-mcp/uploading-media-with-the-api"
---

On this page

1. [Home](https://maevesocial.com/)
2. [Guides](https://maevesocial.com/guides)
3. [API, CLI and MCP](https://maevesocial.com/guides/api-cli-and-mcp)
4. Uploading Media with the API

# Uploading Media with the API

Updated December 1, 2026

Uploading a file takes three requests: start an upload, send the file to storage, then complete the upload. The completed upload returns a media ID you can attach to a post.

You need an [API key](https://maevesocial.com/guides/api-cli-and-mcp/api-keys) and a workspace ID. To upload a file from your computer in one command, use `maeve media:upload` in [the command line](https://maevesocial.com/guides/api-cli-and-mcp/the-command-line) instead.

```
1. POST /v1/workspaces/{workspaceId}/media/upload
2. PUT  <uploadUrl>
3. POST /v1/workspaces/{workspaceId}/media/upload/{sessionId}/complete
```

## Start the Upload

```
curl --fail-with-body "https://api.maevesocial.com/v1/workspaces/$WORKSPACE_ID/media/upload" \
  -H "Authorization: Bearer $MAEVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "photo.png",
    "contentType": "image/png",
    "fileSize": 102400
  }'
```

All three fields are required. `fileSize` is in bytes, and `filename` can contain up to 255 characters.

```
{
  "data": {
    "sessionId": "session-uuid",
    "uploadUrl": "https://storage.example.com/presigned-url",
    "expiresIn": 3600
  },
  "meta": null
}
```

| File type                 | `contentType`                                       | Maximum size |
| ------------------------- | --------------------------------------------------- | ------------ |
| JPEG                      | `image/jpeg`                                        | 50 MB        |
| PNG                       | `image/png`                                         | 50 MB        |
| GIF                       | `image/gif`                                         | 50 MB        |
| WebP                      | `image/webp`                                        | 50 MB        |
| AVIF                      | `image/avif`                                        | 50 MB        |
| MP4                       | `video/mp4`                                         | 2 GB         |
| QuickTime                 | `video/quicktime`                                   | 2 GB         |
| PDF, Word, and PowerPoint | `application/pdf` and the Word and PowerPoint types | 100 MB       |

## Send the File

Send the file's bytes to `uploadUrl` before it expires. This request goes directly to storage, so it does not use your API key:

```
curl --fail-with-body -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/png" \
  --data-binary @photo.png
```

Use the same content type you sent when starting the upload.

## Complete the Upload

```
curl --fail-with-body "https://api.maevesocial.com/v1/workspaces/$WORKSPACE_ID/media/upload/$SESSION_ID/complete" \
  -H "Authorization: Bearer $MAEVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "width": 800, "height": 600, "folderId": "folder-uuid" }'
```

Every field in this request is optional:

| Field             | Description                           |
| ----------------- | ------------------------------------- |
| `width`           | Width in pixels                       |
| `height`          | Height in pixels                      |
| `durationSeconds` | Video length in seconds               |
| `thumbnailBase64` | A thumbnail image, Base64-encoded     |
| `folderId`        | The media folder to place the file in |

```
{
  "data": {
    "id": "media-uuid",
    "url": "https://media.maevesocial.com/...",
    "thumbnailUrl": "https://media.maevesocial.com/.../thumb.jpg",
    "folderId": "folder-uuid",
    "width": 800,
    "height": 600,
    "durationSeconds": null
  },
  "meta": null
}
```

Save the `id`. The file now appears in the workspace's Media room.

## Attach the File to a Post

Reference the media ID in `contentMedia` when you [create or update a post](https://maevesocial.com/guides/api-cli-and-mcp/posting-with-the-api):

```
{
  "contentMedia": [
    { "mediaId": "media-uuid", "order": 0 }
  ]
}
```

Instagram and LinkedIn posts accept up to 20 files. Other platforms accept 10.

## List Your Media

```
curl --fail-with-body "https://api.maevesocial.com/v1/workspaces/$WORKSPACE_ID/media?type=image&limit=20" \
  -H "Authorization: Bearer $MAEVE_API_KEY"
```

| Parameter     | Default     | Options                                |
| ------------- | ----------- | -------------------------------------- |
| `type`        | All         | `image`, `video`, or `gif`             |
| `search`      | None        | Text to find in filenames              |
| `folderId`    | None        | A folder ID                            |
| `rootOnly`    | None        | `true` for files outside any folder    |
| `labelIds`    | None        | Comma-separated media label IDs        |
| `isUnlabeled` | None        | `true` or `false`                      |
| `isFavorite`  | None        | `true` or `false`                      |
| `isUsed`      | None        | `true` or `false`                      |
| `isUnused`    | None        | `true` or `false`                      |
| `state`       | `active`    | `active`, `deleted`, or `all`          |
| `sortBy`      | `createdAt` | `createdAt`, `filename`, or `fileSize` |
| `order`       | `desc`      | `asc` or `desc`                        |
| `limit`       | 50          | From 1 to 100                          |
| `cursor`      | None        | The previous response's `nextCursor`   |

The media list uses cursor pagination. While `meta.hasMore` is true, pass `meta.nextCursor` as `cursor` and keep the same filters.

## Questions

### Why are there three requests?

The file goes straight to storage instead of through the API. You start an upload to get a URL, send the file there, then complete the upload to add it to your library.

### Which file types can I upload?

JPEG, PNG, GIF, WebP, and AVIF images, MP4 and QuickTime videos, and PDF, Word, and PowerPoint documents.

### How large can a file be?

Images up to 50 MB, videos up to 2 GB, and PDF, Word, and PowerPoint documents up to 100 MB.

### Does the upload request need my API key?

The start and complete requests do. The PUT request to uploadUrl goes directly to storage and does not.

### How do I attach an uploaded file to a post?

Add its media ID to the post's contentMedia array when you create or update the post.

### How many files can a post have?

Up to 20 for Instagram and LinkedIn, and 10 for other platforms.

### Is there an easier way to upload a local file?

Yes. The command line uploads a file in one step with maeve media:upload \<file> --workspace \<workspaceId>.

Read next

* [Posting with the API](https://maevesocial.com/guides/api-cli-and-mcp/posting-with-the-api)
* [The Public API](https://maevesocial.com/guides/api-cli-and-mcp/the-public-api)

In Maeve Social

* [REST API](https://maevesocial.com/features/api)
* [CLI](https://maevesocial.com/features/cli)
* [MCP Server](https://maevesocial.com/features/mcp)
