> For the complete documentation index, see [llms.txt](https://docs.podigee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podigee.com/documentation/start-here/ai-agents/mcp-reference/media-upload-protocol.md). Agents can also search and read this documentation through its [MCP server](https://docs.podigee.com/~gitbook/mcp).

# Media upload protocol

How a recording or a cover image goes from a computer to Podigee through an MCP upload session.

A file never goes through an MCP call. The assistant opens an upload session with an MCP tool. It sends the file itself with an HTTP `PUT` to a signed storage address. Then it attaches the upload with another tool. Podigee never fetches a file from a web address.

Only an assistant that can read the file and run a command can do this, for example a terminal or desktop coding app. A chat app cannot. It gives the person the New episode page of the show, where the person chooses the file (`find_in_podigee` has the link). The steps for each client are in [Upload media and cover images](https://docs.podigee.com/documentation/start-here/ai-agents/media-and-publishing/upload-media-and-cover-images.md).

## Control tools

| Tool                                                                   | Purpose                                                                                                                |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `create_upload`                                                        | Opens an upload session. Returns the `upload_id` and the address and command for the first part.                       |
| `get_upload`                                                           | Reads the session. Returns a new address for the next missing part.                                                    |
| `publish_episode`                                                      | Takes the upload of a recording as media source `upload`. Checks the file and closes the session.                      |
| `create_production`                                                    | Attaches the upload of a recording to an existing episode as a new production. Checks the file and closes the session. |
| `create_podcast`, `update_podcast`, `create_episode`, `update_episode` | Take the upload of a cover image as `attributes.cover_image_upload_id`. Check the image and close the session.         |

`create_upload` and `get_upload` need `mcp:media:write`. The scopes of every tool are in [Authorization and scopes](https://docs.podigee.com/documentation/start-here/ai-agents/mcp-reference/authorization-and-scopes.md). There is no other upload endpoint for MCP credentials.

## Accepted files

The file ending decides what the upload is.

| Kind            | File endings                                                                        |
| --------------- | ----------------------------------------------------------------------------------- |
| Audio recording | `mp3`, `m4a`, `opus`, `ogg`                                                         |
| Video recording | `mp4`, `m4v`, `m4p`, `mov`, `qt`, `mkv`, `mk3d`, `avi`, `ogv`, `ogg`, `ogm`, `webm` |
| Cover image     | `png`, `jpg`, `jpeg`                                                                |

A file can have up to 20 GiB (gibibytes). A cover image can have up to 2 MB.

## Open a session

Call `create_upload` with:

* `filename`: the base name of the file with its ending. It can have up to 255 bytes. It must not contain a slash, a backslash, or a control character. The ending has 1 to 15 letters or digits.
* `byte_size`: the exact size of the file in bytes, for example from `wc -c < FILE`. The address is signed for this size. Another size is refused.
* `idempotency_key`: 1 to 128 characters. The first character is a letter or a digit. The other characters are letters, digits, `.`, `_`, `:`, or `-`. The same key with the same file returns the same session.
* `content_type` (optional): leave it out. Podigee takes the type from the file ending. When you send it, it must match the ending.

The answer contains `upload_id`, `state`, `byte_size`, `content_type`, `part_count`, `part_size`, `completed_parts`, `expires_at`, `next_part`, and `next_step`.

## Send the file

`next_part` contains `part_number`, `method` (`PUT`), `url`, `headers`, `expires_at`, and `command`.

1. Replace `FILE` in `next_part.command` with the path of the file.
2. Run the command. It is one `curl` command, and it must print `HTTP 200`.
3. For a file up to 5 GB, the file is now in storage. Go to "Close the session".

A file larger than 5 GB goes in parts of 5 GB, up to five parts:

1. Run the command for part 1. It cuts the part out of the file with `dd`, sends it, and removes the cut.
2. Call `get_upload`. It returns the command for the next missing part.
3. Do steps 1 and 2 again until no part is missing.

Rules for the transfer:

* Send exactly the declared bytes with the returned `Content-Type` and `Content-Length`.
* The address is valid for 15 minutes. `get_upload` returns a new one.
* An answer other than `HTTP 200` means that nothing was stored. The most frequent cause is a `byte_size` that is not the size of the file. Call `create_upload` again with the exact size and a new `idempotency_key`.
* The address lets anyone write that one file until it expires. Do not show it, log it, store it, or parse it. Do not send an `Authorization` header to it.

## Check and continue an upload

* Call `get_upload` to read `state` and `completed_parts`.
* Only a session in the state `pending` or `uploading` takes bytes.
* Send only the parts that are missing.

## Close the session

There is no separate completion call. The tool that takes the upload closes the session:

* `publish_episode` and `create_production` check the part order, the part sizes, and the total size, and then close the session. When a part is missing or the size is different, the error says which part and what to do.
* The tools that set a cover check the image and close the session.

An upload belongs to the person and the account that opened it. A recording upload can attach to only one production. Podigee never returns a storage address as the public media address.

Podigee removes an upload that nothing took within its 24-hour session.

## Cover images

A cover for a show or an episode goes the same way as a recording. Then a tool takes it in `attributes.cover_image_upload_id`. This field and `cover_image` (an image address) exclude each other.

| Step                                         | What Podigee does                                                                                       |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Preview (`dry_run: true`)                    | Closes the session, reads the stored file, and checks the image. A refused image gets no confirm value. |
| Confirmed call                               | Checks the image again, stores it as the cover, and sets it on the show or the episode.                 |
| Same request with the same `idempotency_key` | Returns the stored result. It does not read the upload again.                                           |

* The image must be a PNG or JPEG file by its content, square, and 1400 to 3000 pixels wide. The error for a refused image names the rule and the measured size.
* `create_episode` has no confirmation step. Its preview checks the image, and the call without `dry_run` stores it.
* The field needs `mcp:media:write` in addition to the scope of the tool.
* `publish_episode`, `bulk_update_episodes`, and `manage_workspace` do not take the field.
* `publish_episode` and `create_production` refuse the upload of a cover image as a recording. The tools that set a cover refuse the upload of a recording.
* After the call, the cover does not depend on the upload. One upload can set more than one cover in its 24 hours. The covers stay when Podigee removes the upload.

## After the publish

`publish_episode` returns an `operation_id`. A video recording is processed before the episode publishes, and the operation can wait for it. While `continues_automatically` is true, the person can leave. Do not send the file again, and do not ask for another file format, unless `recovery` says `replace_recording`. The full rules are in [Follow and recover long-running operations](https://docs.podigee.com/documentation/start-here/ai-agents/work-safely/follow-and-recover-long-running-operations.md).

## The upload recipe resource

The resource `podigee://docs/media-upload` gives an assistant the same steps as Markdown text (`text/markdown`). It needs `mcp:media:write`. It covers a file up to 5 GB, a cover image, and a file above 5 GB. It also covers the errors and the wait while a recording is processed. See [Resources and prompts](https://docs.podigee.com/documentation/start-here/ai-agents/mcp-reference/resources-and-prompts.md).

## Errors

* `invalid_params`: the file name, the size, the content type, or the idempotency key does not follow the rules above. The message names the field.
* `upload_quota_exceeded`: an upload limit of the account is reached.
* `storage_forbidden`: the storage refused the request permanently. Do not retry.

The upload limits and all error codes are in [Limits, errors, and recovery](https://docs.podigee.com/documentation/start-here/ai-agents/mcp-reference/limits-errors-and-recovery.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.podigee.com/documentation/start-here/ai-agents/mcp-reference/media-upload-protocol.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
