# POST /gammas/{gammaId}/archive

Archive a Gamma to remove it from the active workspace without deleting it.

## Archive a Gamma

> Archives a Gamma document. The operation is idempotent - archiving an already archived Gamma succeeds.

```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":{"ArchiveGammaResponse":{"type":"object","properties":{"gammaId":{"type":"string","description":"The ID of the archived Gamma"},"archived":{"type":"boolean","description":"Confirmation that the Gamma is archived"}},"required":["gammaId","archived"]}}},"paths":{"/v1.0/gammas/{gammaId}/archive":{"post":{"description":"Archives a Gamma document. The operation is idempotent - archiving an already archived Gamma succeeds.","operationId":"archiveGamma","parameters":[{"name":"gammaId","required":true,"in":"path","description":"The unique ID of the Gamma to archive","schema":{"type":"string"}}],"responses":{"200":{"description":"Gamma archived successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArchiveGammaResponse"}}}},"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArchiveGammaResponse"}}}},"401":{"description":"Invalid or missing API key"},"403":{"description":"Access denied - edit permission required"}},"summary":"Archive a Gamma","tags":["public-api"]}}}}
```

{% hint style="warning" %}
**The `gammaId` must be the file ID returned by the API** (e.g. `g_l0mf2jvf1fpmi1v`), not the slug from the web app URL. If you pass the URL slug (the ID at the end of `gamma.app/docs/My-Doc-bc7s74ruzod20f4`), the request returns `403` instead of `404`.
{% endhint %}

### Example

```bash
curl -X POST "https://public-api.gamma.app/v1.0/gammas/$GAMMA_ID/archive" \
  -H "X-API-KEY: $GAMMA_API_KEY"
```

```json
{
  "gammaId": "g_l0mf2jvf1fpmi1v",
  "archived": true
}
```

### Behavior

* **Idempotent.** Archiving an already archived Gamma returns `200` with `"archived": true`.
* **No credits deducted.** This endpoint does not consume credits.
* **Requires edit permission.** The API key owner must have edit access, and the Gamma must belong to the API key's workspace.

### Finding the gammaId

Poll a completed generation to get the ID:

```bash
curl "https://public-api.gamma.app/v1.0/generations/$GENERATION_ID" \
  -H "X-API-KEY: $GAMMA_API_KEY"
```

The `gammaId` value in the response (e.g. `g_l0mf2jvf1fpmi1v`) is what you pass to `/archive`. The `gammaUrl` field contains the web app link, but the slug in that URL is not the same ID.

### Related

* [GET /generations/{id}](/generations/get-generation-status.md) to retrieve the `gammaId` from a generation
* [Error codes](/reference/error-codes.md) for the `403` response when using a wrong ID


---

# Agent Instructions: 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:

```
GET https://developers.gamma.app/management/archive-gamma.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
