> 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/generations/get-generation-status.md).

# GET /generations/{id}

Use this endpoint to poll an existing generation until `status` is `completed` or `failed`. This is where you receive `gammaUrl`, `exportUrl`, and `credits`.

### How polling works

After starting a generation with `POST /generations` or `POST /generations/from-template`, poll this endpoint every 5 seconds using the returned `generationId`. Most generations complete within 1-3 minutes.

### Generation states

| Status      | Meaning              | What to do                                        |
| ----------- | -------------------- | ------------------------------------------------- |
| `pending`   | Still generating     | Keep polling every 5 seconds                      |
| `completed` | Done                 | Stop polling — use the URLs and credit data below |
| `failed`    | Something went wrong | Stop polling — check the `error` object           |

### What you get back on completion

| Field               | Description                                                                                                                                                                                                                                                                                                                                                             |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gammaUrl`          | Link to view or share the generated Gamma                                                                                                                                                                                                                                                                                                                               |
| `exportUrl`         | Download URL for the exported file (if `exportAs` was set). Format matches `exportAs`: `pdf` and `pptx` download directly; `png` returns a `.zip` with one PNG per card. Anyone with the URL can download until it expires (about one week); access is not tied to your API key. Treat the link as a secret — do not log it, share it, or embed it in client-side code. |
| `gammaId`           | The file ID (e.g. `g_l0mf2jvf1fpmi1v`). Use this for management endpoints such as [GET /gammas/{gammaId}](/management/get-gamma.md), `POST /gammas/{gammaId}/archive`, or `DELETE /gammas/{gammaId}`.                                                                                                                                                                   |
| `credits.deducted`  | Credits consumed by this generation                                                                                                                                                                                                                                                                                                                                     |
| `credits.remaining` | Credits left in the workspace after this generation                                                                                                                                                                                                                                                                                                                     |

## Get generation status

> Retrieves the current status of a generation job. Poll this endpoint until status is "completed" or "failed".

```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":{"GenerationStatusResponse":{"type":"object","properties":{"generationId":{"type":"string","description":"Unique identifier for the generation job"},"status":{"type":"string","description":"Current status of the generation job","enum":["completed","failed","pending"]},"gammaId":{"type":"string","description":"File ID of the generated Gamma (when completed)"},"gammaUrl":{"type":"string","description":"URL to the generated Gamma (when completed)"},"error":{"description":"Error details (when failed)","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}]},"exportUrl":{"type":"string","description":"URL to download the exported file (when exportAs was specified).\nThe file format matches exportAs: `pptx` → .pptx, `pdf` → .pdf, `png` → a .zip archive containing one PNG per card (not a single PNG file).\nAnyone with this URL can download the file until it expires (about one week) — access is not tied to your API key. Treat the link as a secret: don't log it, share it, or embed it in client-side code."},"credits":{"description":"Credit usage information","allOf":[{"$ref":"#/components/schemas/CreditsResponse"}]},"pages":{"description":"Per-page results for multi-page generations.\nOnly present when the generation was created with a `pages` array.","type":"array","items":{"$ref":"#/components/schemas/PageGenerationResult"}}},"required":["generationId","status"]},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable error message"},"statusCode":{"type":"number","description":"HTTP status code"}},"required":["message","statusCode"]},"CreditsResponse":{"type":"object","properties":{"deducted":{"type":"number","description":"Number of credits deducted for this operation"},"remaining":{"type":"number","description":"Remaining credits in the workspace"}},"required":["deducted","remaining"]},"PageGenerationResult":{"type":"object","properties":{"gammaId":{"type":"string","description":"Doc ID of this page within the File."},"gammaUrl":{"type":"string","description":"Direct URL to this page."},"status":{"type":"string","description":"Current status of this page's generation.","enum":["completed","failed","pending"]},"error":{"description":"Error details if this page failed.","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}]},"exportUrl":{"type":"string","description":"URL to download this page's exported file (present only when\n`exportAs` was specified). Each page is exported independently; the\nfile format matches `exportAs` (`pptx` → .pptx, `pdf` → .pdf,\n`png` → a .zip of one PNG per card)."}},"required":["gammaId","gammaUrl","status"]}}},"paths":{"/v1.0/generations/{id}":{"get":{"description":"Retrieves the current status of a generation job. Poll this endpoint until status is \"completed\" or \"failed\".","operationId":"getGenerationStatus","parameters":[{"name":"id","required":true,"in":"path","description":"The unique generation ID returned from the create endpoint","schema":{"type":"string"}}],"responses":{"200":{"description":"Generation status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationStatusResponse"}}}},"400":{"description":"Invalid request parameters"},"401":{"description":"Invalid or missing API key"},"404":{"description":"Generation not found"}},"summary":"Get generation status","tags":["public-api"]}}}}
```

{% hint style="info" %}
For usage patterns, see [Poll for results](/guides/async-patterns-and-polling.md).
{% endhint %}

## Related

* [Poll for results](/guides/async-patterns-and-polling.md) for complete polling implementations
* [POST /generations](/generations/create-generation.md) if you need to start a new generation first


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.gamma.app/generations/get-generation-status.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
