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

POST /generations/from-template

Adapt, remix, or transform an existing Gamma. The template's structure is preserved by default and changes only when your prompt asks.

Start an asynchronous Classic generation by adapting an existing Gamma — swap content, retarget for a new audience, transform the subject, replace images, or restructure cards. The template's structure is preserved by default; it only changes when your prompt explicitly asks. New integrations can also use POST /agent/generations with templateId, which works differently: your prompt decides how much of the template's structure and look to keep, and themeId can't be combined with templateId.

When to use this endpoint

Use this instead of POST /generations when you have an existing Gamma whose layout, card count, or visual structure you want to keep. Provide the template's file ID as gammaId and describe what should change in prompt. Gamma preserves the template's structure by default — it only restructures cards when your prompt explicitly asks.

Key differences from /generations

/generations
/generations/from-template

Input

inputText (raw content)

prompt (change instructions) + gammaId (template file ID)

Structure

Gamma decides layout

Preserves template layout

Use case

Create from scratch

Remix, retarget, or translate existing content

What you get back

The response returns a generationId immediately. Poll GET /generations/{id} every 5 seconds until status is completed or failed. On completion, you receive gammaUrl, exportUrl (if exportAs was set), gammaId, and credits usage.

Create generation from template

post

Creates an asynchronous generation job from a template Gamma with variable substitution.

Authorizations
X-API-KEYstringRequired

API key for authentication

Body
exportAsstring · enumOptional

Export format for automatic export after generation

Example: pdfPossible values:
promptstring · min: 1 · max: 400000Required

Text prompt describing what to generate

Example: Q3 financial summary for investors
titlestring · min: 1 · max: 500Optional

Custom title for the generated Gamma. If not provided, a title will be automatically generated from the content.

Example: Q3 Financial Summary
gammaIdstringRequired

The File ID of the gamma to be used as a template. The File must contain exactly one Page.

Example: gamma_abc123
themeIdstringOptional

Theme ID to apply to the generated Gamma

Example: theme_xyz789
folderIdstringOptional

Folder to place the generated Gamma in.

Example: folder_abc
folderIdsstring[] · max: 1OptionalDeprecated

Folder to place the generated Gamma in. Accepts at most 1 folder ID. Ignored when folderId is provided.

Example: ["folder_abc"]
Responses
200

Generation job created successfully

application/json
generationIdstringRequired

Unique identifier for the generation job

Example: gen_xyz789
warningsstringOptional

Warnings about the request

Example: Some template variables were not found
post/v1.0/generations/from-template
POST /v1.0/generations/from-template HTTP/1.1
Host: public-api.gamma.app
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 367

{
  "exportAs": "pdf",
  "prompt": "Q3 financial summary for investors",
  "title": "Q3 Financial Summary",
  "gammaId": "gamma_abc123",
  "themeId": "theme_xyz789",
  "imageOptions": {
    "model": "flux-2-pro",
    "style": "photorealistic"
  },
  "sharingOptions": {
    "workspaceAccess": "view",
    "externalAccess": "none",
    "emailOptions": {
      "access": "view",
      "recipients": [
        "user@example.com"
      ]
    }
  },
  "folderId": "folder_abc"
}
{
  "generationId": "gen_xyz789",
  "warnings": "Some template variables were not found"
}

Template eligibility: gammaId must be a gamma in your workspace that is marked as a template, with a single page whose card count is within your plan's card limit. Non-template gammas, archived templates, multi-page gammas, and site-bound gammas are rejected when you submit the request, and official Explore templates are not accepted here (use them as templateId on POST /agent/generations). Omit themeId to keep the template's theme. For workflow guidance, see Generate from template.

Concurrency: On Free workspaces, too many pending generation jobs started with an API key return 429 with code: workspace_concurrency_limit_exceeded and a Retry-After header. See Error codes.

Full workflow with this endpoint, including failure cases: Generate from approved templates. What the template controls: Brand, template, and editing controls.

Last updated

Was this helpful?