# Gamma Developer Docs

{% columns %}
{% column valign="middle" %}
One API call. Polished presentations, documents, websites, and social posts — branded, exported, and shared.

<a href="https://gamma.app/settings/api-keys" class="button primary">Get your API key</a><a href="get-started/understanding-the-api-options" class="button secondary">API overview</a>
{% endcolumn %}

{% column %}

<figure><img src="https://2814591912-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FupsTVd2JbSOFZRBjfqED%2Fuploads%2Fgit-blob-f7bdadae6305295a8fb9abfcaa79bcc56c80a778%2Flandscape-developer-clouds.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

## Authentication

All requests require an API key in the `X-API-KEY` header. Generate a key from [Account Settings > API Keys](https://gamma.app/settings/api-keys).

| Header         | Value              | Required |
| -------------- | ------------------ | -------- |
| `X-API-KEY`    | Your API key       | Yes      |
| `Content-Type` | `application/json` | Yes      |

API key access requires a Pro, Ultra, Teams, or Business plan. [Some connectors](https://developers.gamma.app/connectors/connectors-and-integrations) work on all plans and do not require an API key.

{% hint style="info" %}
**Machine-readable docs** are available at [developers.gamma.app/llms.txt](https://developers.gamma.app/llms.txt) and [developers.gamma.app/llms-full.txt](https://developers.gamma.app/llms-full.txt). Every page is also available as markdown by appending `.md` to the URL.
{% endhint %}

## Quickstart

### 1. Start a generation

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://public-api.gamma.app/v1.0/generations \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: $GAMMA_API_KEY" \
  -d '{
    "inputText": "Q3 product launch strategy",
    "textMode": "generate",
    "format": "presentation",
    "numCards": 10,
    "exportAs": "pdf"
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests, os

response = requests.post(
    "https://public-api.gamma.app/v1.0/generations",
    headers={
        "X-API-KEY": os.environ["GAMMA_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
        "inputText": "Q3 product launch strategy",
        "textMode": "generate",
        "format": "presentation",
        "numCards": 10,
        "exportAs": "pdf",
    },
)
generation_id = response.json()["generationId"]
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const response = await fetch(
  "https://public-api.gamma.app/v1.0/generations",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-API-KEY": process.env.GAMMA_API_KEY,
    },
    body: JSON.stringify({
      inputText: "Q3 product launch strategy",
      textMode: "generate",
      format: "presentation",
      numCards: 10,
      exportAs: "pdf",
    }),
  }
);
const { generationId } = await response.json();
```

{% endtab %}
{% endtabs %}

{% code title="Response" %}

```json
{
  "generationId": "abc123xyz"
}
```

{% endcode %}

### 2. Poll for the result

Poll `GET /v1.0/generations/{generationId}` every 5 seconds until `status` is `completed` or `failed`. Full polling examples in [Poll for results](https://developers.gamma.app/guides/async-patterns-and-polling).

{% code title="Response (completed)" %}

```json
{
  "generationId": "abc123xyz",
  "status": "completed",
  "gammaUrl": "https://gamma.app/docs/abc123",
  "exportUrl": "https://gamma.app/export/abc123.pdf",
  "credits": {
    "deducted": 15,
    "remaining": 485
  }
}
```

{% endcode %}

### 3. Use your Gamma

Your presentation is live at `gammaUrl`. If you specified `exportAs`, the file is ready at `exportUrl`.

{% hint style="info" %}
Getting a 401? Gamma uses `X-API-KEY` as a custom header — not `Authorization: Bearer`. See [Error codes](https://developers.gamma.app/reference/error-codes) for other common issues.
{% endhint %}

## Endpoints

| Endpoint                                                                                    | Method | Description            |
| ------------------------------------------------------------------------------------------- | ------ | ---------------------- |
| [/generations](https://developers.gamma.app/generations/create-generation)                  | POST   | Generate from text     |
| [/generations/from-template](https://developers.gamma.app/generations/create-from-template) | POST   | Generate from template |
| [/generations/{id}](https://developers.gamma.app/generations/get-generation-status)         | GET    | Poll generation status |
| [/themes](https://developers.gamma.app/workspace/list-themes)                               | GET    | List workspace themes  |
| [/folders](https://developers.gamma.app/workspace/list-folders)                             | GET    | List workspace folders |

{% hint style="success" %}
**Building an AI integration?** The [MCP server](https://developers.gamma.app/mcp/gamma-mcp-server) lets AI tools create gammas on behalf of users via OAuth with Dynamic Client Registration.
{% endhint %}

## Next steps

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Generate from text</strong></td><td>Control format, themes, images, headers/footers, and sharing.</td><td><a href="guides/generate-api-parameters-explained">generate-api-parameters-explained</a></td></tr><tr><td><strong>Generate from a template</strong></td><td>Design a template once, then generate variations programmatically.</td><td><a href="guides/create-from-template-api-parameters-explained">create-from-template-api-parameters-explained</a></td></tr><tr><td><strong>Connect integrations</strong></td><td>Use Gamma with AI assistants and automation platforms — some require no API key.</td><td><a href="connectors/connectors-and-integrations">connectors-and-integrations</a></td></tr><tr><td><strong>Set up the MCP server</strong></td><td>Let AI tools create gammas on behalf of users via OAuth.</td><td><a href="mcp/gamma-mcp-server">gamma-mcp-server</a></td></tr></tbody></table>
