> For the complete documentation index, see [llms.txt](https://docs.powerpointgeneratorapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.powerpointgeneratorapi.com/generations/post-generator-create.md).

# POST /generator/create

Use this endpoint to create a new presentation from a .pptx template file and JSON data . The call is **synchronous** — the connection stays open while the presentation is built, and the finished file comes back in the same response.

{% hint style="info" %}
**Synchronous or asynchronous?**

Both endpoints take exactly the same `files` and `jsonData` payload, use the same [token](https://docs.powerpointgeneratorapi.com/api-reference/token-create), and count towards the same [usage allowance](https://docs.powerpointgeneratorapi.com/api-reference/usage). If this endpoint is timing out on a large presentation, switch to [`generator/create-async`](broken://pages/d580027332a1bd0ad7f4c3bc9fd966aa86c2132d) — the request itself is unchanged, you only add the polling step.
{% endhint %}

|                      | <p><strong><code>generator/create</code></strong> </p><p><strong>(v1.0)</strong></p> | <p><a href="/generations/post-generator-create-async.md"><strong><code>generator/create-async</code></strong></a> </p><p><strong>(v2.0)</strong></p> |
| -------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Style                | Synchronous — one request                                                            | Asynchronous — submit, then poll                                                                                                                     |
| Response             | The `.pptx` file as a binary stream                                                  | JSON containing a job ID                                                                                                                             |
| Connection held open | For the whole generation                                                             | Only long enough to upload the template and JSON                                                                                                     |
| Best for             | Small and medium decks, quick interactive calls                                      | Large decks — many slides, large tables, charts and images                                                                                           |
| Risk                 | Client, proxy or gateway timeouts on long jobs                                       | None — generation time is decoupled from the request                                                                                                 |

## generator/create

<mark style="color:green;">`POST`</mark> `https://gen.powerpointgeneratorapi.com/v1.0/generator/create`

#### Headers

| Name                                            | Type   | Description                 |
| ----------------------------------------------- | ------ | --------------------------- |
| Content-Type<mark style="color:red;">\*</mark>  | String | multipart/form-data         |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer authentication token |

#### Request Body

| Name                                       | Type                   | Description                                  |
| ------------------------------------------ | ---------------------- | -------------------------------------------- |
| files<mark style="color:red;">\*</mark>    | File or array of files | .pptx template file(s), plus any image files |
| jsonData<mark style="color:red;">\*</mark> | String                 | JSON data                                    |

{% tabs %}
{% tab title="200: OK" %}
On success, the API returns the generated file as a binary stream (not JSON).

| Header              | Description                         |
| ------------------- | ----------------------------------- |
| Content-Type        | Matches the requested output format |
| Content-Disposition | Attachment; filename={filename}     |

Save the response body directly to a file to get the presentation.
{% endtab %}

{% tab title="400: Bad Request" %}
Returns a JSON error object describing what was invalid.

```json
{
    "statusCode": 400,
    "message": "Invalid input parameters",
    "details": "{more information}",
}
```

{% endtab %}

{% tab title="401: Unauthorized" %}

```json
{
  "statusCode": 401,
  "message": "Unauthorized",
  "detail": "The bearer token is missing, expired, or invalid."
}
```

{% endtab %}

{% tab title="429: Too Many Requests" %}

```json
{
  "statusCode": 429,
  "message": "Too Many Requests - usage or rate limit exceeded",
  "detail": "Too many requests: monthly slide limit exceeded."
}
```

{% endtab %}

{% tab title="500: Internal Server Error" %}

```json
{
  "statusCode": 500,
  "title": "Error",
  "detail": "An error occurred while generating the presentation. See server logs for details."
}
```

{% endtab %}
{% endtabs %}

### Example request

Dummy PowerPoint template used in examples below:

{% file src="/files/OoWw4SZNOWuE77CHRXjB" %}

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

```bash
curl --location --request POST 'https://gen.powerpointgeneratorapi.com/v1.0/generator/create' \
  -H 'Authorization: Bearer {add_your_token_here}' \
  -F 'files=@title_slide_template.pptx' \
  -F 'jsonData={"presentation":{"template":"title_slide_template.pptx","export_version":"Pptx2019","resultFileName":"quick_start_example","slides":[{"type":"slide","slide_index":0,"shapes":[{"name":"Title 1","content":"Your generated PowerPoint presentation"},{"name":"Subtitle 2","content":"Create, fill and manage PowerPoint documents through simple API requests."}]}]}}' \
  --output generated.pptx
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import requests

TEMPLATE_PATH = './title_slide_template.pptx'   # where the file lives on disk
TEMPLATE_NAME = 'title_slide_template.pptx'     # upload name, same as jsonData "template"
API_TOKEN = 'eyJ...'                            # your bearer token

payload = {
    'jsonData': json.dumps({
        "presentation": {
            "template": TEMPLATE_NAME,
            "export_version": "Pptx2019",
            "resultFileName": "quick_start_example",
            "slides": [
                {
                    "type": "slide",
                    "slide_index": 0,
                    "shapes": [
                        {"name": "Title 1", "content": "Your generated PowerPoint presentation"},
                        {"name": "Subtitle 2", "content": "Create, fill and manage PowerPoint documents through simple API requests."},
                    ],
                }
            ],
        }
    })
}

with open(TEMPLATE_PATH, 'rb') as f:
    files = [
        ('files', (TEMPLATE_NAME, f,
                   'application/vnd.openxmlformats-officedocument.presentationml.presentation'))
    ]
    response = requests.post(
        'https://gen.powerpointgeneratorapi.com/v1.0/generator/create',
        data=payload,
        files=files,
        headers={'Authorization': f'Bearer {API_TOKEN}'},
        timeout=360,
    )

print(response.status_code, response.headers.get('Content-Type'))

if response.ok:
    with open("./generated.pptx", "wb") as out:
        out.write(response.content)
    print("saved generated.pptx", len(response.content), "bytes")
else:
    print(response.text)
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const TEMPLATE_NAME = "title_slide_template.pptx"; // upload name + JSON "template" (must match)
const API_TOKEN = "add_your_token_here";

const jsonData = {
  presentation: {
    template: TEMPLATE_NAME,
    export_version: "Pptx2019",
    resultFileName: "quick_start_example",
    slides: [
      {
        type: "slide",
        slide_index: 0,
        shapes: [
          { name: "Title 1", content: "Your generated PowerPoint presentation" },
          { name: "Subtitle 2", content: "Create, fill and manage PowerPoint documents through simple API requests." },
        ],
      },
    ],
  },
};

// templateFile is a File/Blob, e.g. from <input type="file" id="template">:
// const templateFile = document.getElementById("template").files[0];

async function generate(templateFile) {
  const formData = new FormData();
  formData.append("jsonData", JSON.stringify(jsonData));
  formData.append("files", templateFile, TEMPLATE_NAME);

  const response = await fetch(
    "https://gen.powerpointgeneratorapi.com/v1.0/generator/create",
    {
      method: "POST",
      headers: { Authorization: `Bearer ${API_TOKEN}` },
      body: formData,
    }
  );

  if (!response.ok) {
    console.error(response.status, await response.text());
    return;
  }

  const blob = await response.blob();
  const link = document.createElement("a");
  link.href = URL.createObjectURL(blob);
  link.download = "generated.pptx";
  link.click();
  URL.revokeObjectURL(link.href);
}
```

{% endtab %}

{% tab title="Postman" %}
{% stepper %}
{% step %}

## Select Authorization

Select the `Authorization` tab, enter your `Token`.
{% endstep %}

{% step %}

## Configure the request body

Select the `Body` tab, select `form-data`, and add the two key-value parameters below:

<table><thead><tr><th width="116">KEY</th><th>VALUE</th></tr></thead><tbody><tr><td><code>files</code></td><td>upload/ attach your <code>.pptx</code> file</td></tr><tr><td><code>jsonData</code></td><td>copy and paste the data from your <code>.json</code> payload</td></tr></tbody></table>
{% endstep %}

{% step %}

## Send and download

Click the down arrow next to `Send`, then select `Send and Download`. Once the result is successfully received, save the output as `.pptx`.
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}
