---
title: "Upload the next media part using its exact Content-Length"
description: "PubNio API media.uploadPart: upload the next media part using its exact Content-Length. 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 the next media part using its exact Content-Length

Upload the next media part using its exact Content-Length with [`PUT /api/v1/media/uploads/{mediaId}/parts/{partNumber}`](https://pubnio.com/api/v1/docs#tag/media/PUT/api/v1/media/uploads/{mediaId}/parts/{partNumber}). Requires an API key with the `read` scope or a signed-in workspace member.

## Request

| Parameter        | In     | Type   | Required |
| ---------------- | ------ | ------ | -------- |
| `mediaId`        | path   | UUID   | Yes      |
| `partNumber`     | path   | string | Yes      |
| `content-length` | header | string | Yes      |
| `workspaceId`    | query  | UUID   | Yes      |

## Response

- HTTP 200: `MediaPartReceipt` with `partNumber`.

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
part = workspace.media.upload_part(
    media_id,
    1,
    content=open("part-1.bin", "rb").read(),
)
```

### cURL

```sh
curl -X PUT "https://pubnio.com/api/v1/media/uploads/$MEDIA_ID/parts/1?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @part-1.bin
```

### CLI

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

### MCP execute

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

## Errors

- [`media-upload-conflict`](https://pubnio.com/docs/problems/media-upload-conflict/): HTTP 409, Media upload conflict
- [`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 `PUT` is not deduplicated. Read the current state before you retry.

## 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-upload-part/index.mdx
