---
title: "Start a resumable media upload"
description: "PubNio API media.startUpload: start a resumable media upload. 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.

# Start a resumable media upload

Start a resumable media upload with [`POST /api/v1/media/uploads`](https://pubnio.com/api/v1/docs#tag/media/POST/api/v1/media/uploads). Requires an API key with the `read` scope or a signed-in workspace member.

## Request

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `workspaceId` | query | UUID | Yes      |

| Body field  | Type    | Required |
| ----------- | ------- | -------- |
| `sizeBytes` | integer | Yes      |

## Response

- HTTP 201: `MediaUploadSession` with `mediaId`, `partSizeBytes`, `expiresAt`.

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

## Examples

### TypeScript

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

The SDK's `media.upload()` runs this step itself for a file too large for one request.

### Python

```python
upload = workspace.media.start_upload(size_bytes=52428800)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/media/uploads?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sizeBytes":52428800}'
```

### CLI

```sh
pnio media upload ./launch.mp4
```

### MCP execute

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

## Errors

- [`idempotency-conflict`](https://pubnio.com/docs/problems/idempotency-conflict/): HTTP 409, Idempotency key already used
- [`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

Required. A retry with the same `Idempotency-Key` returns the first result for 24 hours. Make one key per intent, such as `crypto.randomUUID()` or Python's `uuid4()`, and reuse it only to retry the same request. The TypeScript SDK makes a key for each call unless you pass `idempotencyKey`. See [Idempotency](https://pubnio.com/docs/concepts/idempotency/).

## Limits

- It is one step of a resumable upload. Agents usually call `media.upload`, `media.import`, or `media.uploadInline` instead.

## Related

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

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