> 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/edit-gamma.md).

# POST /agent/gammas/{gammaId}/edits

Edit an existing Gamma from a natural-language prompt.

Edit an existing Gamma with a natural-language `prompt`; the call returns an `editId` to poll (the final status reports `credits.deducted` and `credits.remaining` when available), requires edit permission on the Gamma, and runs one edit per Gamma at a time.

## Edit an existing Gamma

> Creates an asynchronous AI edit of one page of an existing Gamma from a natural-language \`prompt\`. Returns an edit ID to poll with \`GET /v1.0/agent/edits/{editId}\`. Requires at least edit permission on the Gamma. Only one edit runs on a page at a time, and an edit cannot add pages.

```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":{"EditGamma":{"type":"object","properties":{"prompt":{"type":"string","description":"Natural-language instruction describing the edit.","maxLength":10000},"quality":{"type":"string","description":"How much model effort the edit runs with, matching the quality tiers in the\nGamma agent UI. `max` requires a plan that includes it and can use more\ncredits. Omitting the field uses the API default, capped at what the\nplan includes.","enum":["lite","max","standard"]},"disableConnectors":{"type":"boolean","description":"Opt this edit out of workspace connector access (e.g. Notion, Slack)."}},"required":["prompt"]},"EditGammaResponse":{"type":"object","properties":{"editId":{"type":"string","description":"Unique ID for the edit job. Poll `GET /v1.0/agent/edits/{editId}` with it."},"gammaUrl":{"type":"string","description":"URL to the Gamma being edited"}},"required":["editId","gammaUrl"]}}},"paths":{"/v1.0/agent/gammas/{gammaId}/edits":{"post":{"description":"Creates an asynchronous AI edit of one page of an existing Gamma from a natural-language `prompt`. Returns an edit ID to poll with `GET /v1.0/agent/edits/{editId}`. Requires at least edit permission on the Gamma. Only one edit runs on a page at a time, and an edit cannot add pages.","operationId":"editGamma","parameters":[{"name":"gammaId","required":true,"in":"path","description":"The Gamma to edit: a gamma (file) ID, or a page ID (the id in a\ngamma.app/docs/<id> URL). A file ID edits the Gamma's main page; a page\nID edits that page.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditGamma"}}}},"responses":{"201":{"description":"Edit job created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditGammaResponse"}}}},"400":{"description":"Invalid request parameters, or a Gamma that is archived, has no pages, or is of a type that cannot be edited"},"401":{"description":"Invalid or missing API key"},"403":{"description":"Insufficient credits, no edit permission on the Gamma, or a `quality` tier the plan does not include"},"404":{"description":"Gamma not found"},"409":{"description":"An edit is already in progress for this page (`code: edit_in_progress`, with the running `editId` when it belongs to your workspace)"},"429":{"description":"Rate limit exceeded, or the workspace has too many in-flight agent jobs (`code: workspace_concurrency_limit_exceeded`, with a `Retry-After` header)"},"503":{"description":"The service is busy; retry the request"}},"summary":"Edit an existing Gamma","tags":["public-api"]}}}}
```

{% hint style="info" %}
Pass a file id (`g_…`) to edit the Gamma's main page, or a page id from a `gamma.app/docs/<id>` URL to edit that page. If another edit is already running on the page, the API returns `409` with code `edit_in_progress`.
{% endhint %}

## Related

* [GET /agent/edits/{editId}](/agent-gamma-5/get-edit-status.md) to poll for completion
* [GET /gammas/{gammaId}](/management/get-gamma.md) to confirm ids and metadata before editing
* [Error codes](/reference/error-codes.md) for `409` and workspace concurrency errors


---

# 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/edit-gamma.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.
