> For the complete documentation index, see [llms.txt](https://developers.gamma.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.gamma.app/agent-gamma-5/create-upload.md).

# POST /uploads

Upload a file for an agent generation or an image generation to work from.

Store one file, such as a deck to import for the `files` field of [`POST /agent/generations`](https://developers.gamma.app/agent-gamma-5/create-agent-generation.md), or an image for `referenceImages` on [`POST /images`](https://developers.gamma.app/images/create-image-generation.md). Returns the `uploadId` and `filename` to pass there.

## Upload a file

> Stores one file for \`files\` on \`POST /v1.0/agent/generations\` or \`POST /v1.0/agent/gammas/{gammaId}/edits\`. Send the raw bytes as \`application/octet-stream\` with a \`Content-Length\` header; chunked and content-encoded bodies are rejected. Files can be up to 250 MiB, and images up to 50 megapixels. Each upload can be attached to one generation or edit. An upload that is never attached expires two days after it was created.

```json
{"openapi":"3.0.0","info":{"title":"Gamma Public API","version":"1.0"},"tags":[{"name":"public-api","description":"Public API endpoints for external integrations"}],"servers":[{"url":"https://public-api.gamma.app","description":"Production"}],"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key for authentication"}},"schemas":{"CreateUploadResponse":{"type":"object","properties":{"uploadId":{"type":"string"},"filename":{"type":"string","description":"Stored filename, derived from `x-harness-upload-name`."},"name":{"type":"string","description":"The filename as sent."},"mimeType":{"type":"string"},"size":{"type":"number","description":"Size in bytes."}},"required":["uploadId","filename","name","mimeType","size"]}}},"paths":{"/v1.0/uploads":{"post":{"description":"Stores one file for `files` on `POST /v1.0/agent/generations` or `POST /v1.0/agent/gammas/{gammaId}/edits`. Send the raw bytes as `application/octet-stream` with a `Content-Length` header; chunked and content-encoded bodies are rejected. Files can be up to 250 MiB, and images up to 50 megapixels. Each upload can be attached to one generation or edit. An upload that is never attached expires two days after it was created.","operationId":"createUpload","parameters":[{"name":"mimeType","required":true,"in":"query","description":"The file's media type. It must match the file's contents.","schema":{"enum":["application/javascript","application/json","application/pdf","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/xml","font/otf","font/ttf","image/avif","image/bmp","image/gif","image/heic","image/heif","image/jpeg","image/png","image/svg+xml","image/tiff","image/webp","text/css","text/csv","text/html","text/markdown","text/plain"],"type":"string"}},{"name":"x-harness-upload-name","required":true,"in":"header","description":"The filename, percent-encoded (for example with `encodeURIComponent`)","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"The file bytes","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"File stored","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUploadResponse"}}}},"400":{"description":"A missing `mimeType`, `x-harness-upload-name`, or `Content-Length`; a filename that is not percent-encoded; a body that is not `application/octet-stream`, is content-encoded, or does not match `mimeType`; or an unsupported `mimeType`"},"401":{"description":"Invalid or missing API key"},"403":{"description":"Insufficient credits, or the plan does not include the API"},"404":{"description":"Uploads are unavailable"},"408":{"description":"The body arrived too slowly"},"413":{"description":"The file exceeds 250 MiB, or the image exceeds 50 megapixels"},"429":{"description":"Rate limit exceeded"},"503":{"description":"Too many uploads in progress; retry with backoff"},"504":{"description":"Storing the file timed out"}},"summary":"Upload a file","tags":["public-api"]}}}}
```

{% hint style="info" %}
Send the file as the raw request body, not as multipart form data, with its media type in `mimeType` and its name percent-encoded in `x-harness-upload-name`.

* Send a `Content-Length` header. Chunked and content-encoded bodies are rejected.
* A file can be up to 250 MiB, and an image up to 50 megapixels. `mimeType` must match the file's contents.
* Each upload can be attached to one agent generation. To retry an agent generation, upload the file again.
* A reference image on `POST /images` does not attach the upload, so you can use it in several image generations until it expires.
* An upload that is never attached expires two days after it was created.
* A `503` means too many uploads are in progress. Retry with exponential backoff.
  {% endhint %}

## Example request

```bash
curl -X POST "https://public-api.gamma.app/v1.0/uploads?mimeType=application/vnd.openxmlformats-officedocument.presentationml.presentation" \
  -H "X-API-KEY: $GAMMA_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  -H "x-harness-upload-name: Q3%20review.pptx" \
  --data-binary @"Q3 review.pptx"
```

## Related

* [POST /agent/generations](https://developers.gamma.app/agent-gamma-5/create-agent-generation.md) to start a generation with `files`
* [POST /images](https://developers.gamma.app/images/create-image-generation.md) to use an uploaded image as a reference
* [Import a presentation](https://developers.gamma.app/build-with-gamma/import-a-presentation.md) for the full flow and prompt patterns
* [Error codes](https://developers.gamma.app/reference/error-codes.md) for upload status codes


---

# 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://developers.gamma.app/agent-gamma-5/create-upload.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.
