---
title: "Upload a workspace image, video, or document"
description: "PubNio API media.upload: upload a workspace image, video, or document. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload a workspace image, video, or document

Upload a workspace image, video, or document with [`POST /api/v1/media`](https://pubnio.com/api/v1/docs#tag/media/POST/api/v1/media). Requires an API key with the `read` scope or a signed-in workspace member.

## Request

Send the raw file as application/octet-stream with its MIME type in the query. Limit 25 MiB.

| Parameter     | In    | Type             | Required |
| ------------- | ----- | ---------------- | -------- |
| `workspaceId` | query | UUID             | Yes      |
| `mimeType`    | query | one of 8 strings | Yes      |

## Response

- HTTP 201: `MediaIntake` with `mediaId`, `status`, `asset`, `issue`, `upload`, `idempotencyKey`, `retryAfterSeconds`.
  - `status`: `awaiting_upload`, `processing`, `ready`, `failed`

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const asset = await workspace.media.upload(file);
```

### Python

```python
asset = workspace.media.upload_direct(
    mime_type="image/png",
    content=open("cover.png", "rb").read(),
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/media?workspaceId=$WORKSPACE_ID&mimeType=image%2Fpng" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @cover.png
```

### CLI

```sh
pnio media upload ./cover.png
```

### MCP execute

Hosted MCP's `execute` tool cannot carry this operation's binary body or response.

## Errors

- [`upload-too-large`](https://pubnio.com/docs/problems/upload-too-large/): HTTP 413, Content Too Large

It also declares the problems [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

No key, so a retried `POST` is not deduplicated. Read the current state before you retry.

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Media operations](https://pubnio.com/docs/reference/#media)
- [Publishing](https://pubnio.com/docs/publishing/)

Source: https://pubnio.com/docs/reference/media-upload/index.mdx
