For the complete documentation index, see llms.txt. This page is also available as Markdown.

Import a presentation

Import a PowerPoint or PDF deck into Gamma through the API, as is, with changes, or as the source for a new deck.

Hand Gamma a deck (.pptx, .potx, or a PDF of slides) or a link to one, and get a gamma back: imported as is, edited, restyled, or used as the source for a new deck. It takes two calls: upload the file, then start an agent generation that names it.

Quick reference

  • Upload with POST /uploads, then pass the returned uploadId and filename in files on POST /agent/generations.

  • The prompt decides what happens to the deck. Each generation creates one gamma.

  • One presentation is imported per generation. A generation takes up to 50 files and 250 MiB in total.

  • For a deck at a link, such as a Google Slides deck, put the link in sourceUrls instead of uploading it.

  • Each upload can be attached to one generation; to retry, upload the file again. An upload that is never attached expires after two days.

Upload and generate

UPLOAD=$(curl -s -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")

curl -s -X POST https://public-api.gamma.app/v1.0/agent/generations \
  -H "X-API-KEY: $GAMMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --argjson upload "$UPLOAD" \
    '{prompt: "Import this deck.", files: [{uploadId: $upload.uploadId, filename: $upload.filename}]}')"
import os
from urllib.parse import quote

import requests

API = "https://public-api.gamma.app/v1.0"
KEY = {"X-API-KEY": os.environ["GAMMA_API_KEY"]}
PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation"

with open("Q3 review.pptx", "rb") as deck:
    upload = requests.post(
        f"{API}/uploads",
        params={"mimeType": PPTX},
        headers={
            **KEY,
            "Content-Type": "application/octet-stream",
            "x-harness-upload-name": quote("Q3 review.pptx"),
        },
        data=deck,
    )
upload.raise_for_status()
file = {k: upload.json()[k] for k in ("uploadId", "filename")}

generation = requests.post(
    f"{API}/agent/generations",
    headers=KEY,
    json={"prompt": "Import this deck.", "files": [file]},
)
generation.raise_for_status()
print(generation.json()["generationId"])

Poll GET /agent/generations/{generationId} until status is completed or failed. See Poll for results.

To mark a file as the presentation to import, add "purpose": "import" to its files entry. The prompt still takes precedence, so say "import it as is" when you want a faithful copy. Only one file can have it, and it can't be combined with templateId, themeId, or numCards.

Write the prompt

You want
Example prompt
What Gamma does

The deck as is

"Import this deck." A bare title also works.

Imports it faithfully

Specific changes

"Import this deck and change the heading on slide 7 to 'The window is closing.'"

Imports it, then edits the import

A better look

"Import this deck and make it look better." or "…in our brand colors."

Imports it, then restyles the import and keeps its content

A template for new content

"Use this deck as a template for a Q3 update on climate tech."

Imports it, then rewrites the import, title included

A new deck from its content

"Make a 5-slide summary of this deck for our board."

Builds one new gamma from the content; the deck itself isn't imported

Your file is unchanged either way; changes are made on the imported gamma.

A request to import, edit, or template more than one presentation fails without creating a gamma. Several presentations used together as content for one new deck are fine.

Put the link in sourceUrls and use the same prompts. Gamma must be able to open the link, so share it publicly or use a direct download link. A link the prompt depends on is required: when Gamma can't read it, the generation fails with an explanation and creates no gamma.

From a coding agent

With GAMMA_API_KEY set in your shell, ask your agent (Claude Code, Codex, Cursor) to upload the file and call the agent generation API, and point it at this page.

Files from untrusted senders

Troubleshooting

  • invalid_files on the status response: an upload expired, was already attached to another generation, or the files exceed the size limit. Upload them again and retry.

  • 404 on POST /agent/generations: an upload in files doesn't exist or has expired.

  • 413: the file exceeds 250 MiB (on POST /uploads), or the files exceed 250 MiB in total (on POST /agent/generations).

  • 503 on POST /uploads: too many uploads are in progress. Retry with exponential backoff.

Last updated

Was this helpful?