# Quick start

## Objective <a href="#prereqs" id="prereqs"></a>

Generate a fresh presentation by utilizing a PowerPoint template and JSON data via a request to the PowerPoint-Generator-API service.&#x20;

Watch the step-by-step overview before diving in.

{% embed url="<https://youtu.be/Yb-UqZFeIJ8>" %}

## Step 1. Create an account

Sign up to PowerPoint-Generator-API [here](https://powerpointgeneratorapi.com/). Make a note of your email address, password and API key. You will need these to create an authentication token.

{% hint style="info" %}
API key will be emailed to you.&#x20;
{% endhint %}

## Step 2. Create an authentication token

All API calls require authentication. You can create an authentication token manually using the [Web Console](https://powerpointgeneratorapi.com/managebearertoken) or programmatically using the POST below.&#x20;

## Create authentication token

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

This endpoint enables you to create an authentication token. You will need this for all requests to the API. \
\
**Your  authentication token is only valid for 24 hours.** Once your token has expired you will need to request a new token.&#x20;

#### Headers

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

#### Request Body

| Name                                       | Type   | Description           |
| ------------------------------------------ | ------ | --------------------- |
| username<mark style="color:red;">\*</mark> | String | your email address    |
| password<mark style="color:red;">\*</mark> | String | your account password |
| key<mark style="color:red;">\*</mark>      | String | your API key          |

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

```
Success
```

{% endtab %}

{% tab title="400" %}

```
Bad Request 
```

{% endtab %}
{% endtabs %}

### Example Requests

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

```bash
curl -d "username=<your_username>&password=<your_password>&key=<your_security_key>" \
     -X POST https://auth.powerpointgeneratorapi.com/v1.0/token/create
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# API endpoint for token creation
url = "https://auth.powerpointgeneratorapi.com/v1.0/token/create"

# Your credentials and security key
credentials = {
    'username': '<your_username>',
    'password': '<your_password>',
    'key': '<your_security_key>'
}

# Headers for the HTTP request
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}

# Send a POST request to the API endpoint with credentials
response = requests.post(url, headers=headers, data=credentials)

# Print the response from the API
print(response.text)

```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
// Create a new FormData object to handle the form data
const formData = new FormData();
formData.append("username", "<your_username>");
formData.append("password", "<your_password>");
formData.append("key", "<your_security_key>");

// Define the options for the fetch request
const requestOptions = {
  method: 'POST',
  body: formData,          // Set the body of the request to the FormData object
  redirect: 'follow'       // Specify the redirect behavior
};

// Make a POST request to the authentication endpoint
fetch("https://auth.powerpointgeneratorapi.com/v1.0/token/create", requestOptions)
  .then(response => response.text())    // Parse the response as text
  .then(result => console.log(result)) // Log the result to the console
  .catch(error => console.error('Error:', error)); // Log any errors that occur

```

{% endtab %}

{% tab title="Postman" %}

1. Post: <https://auth.powerpointgeneratorapi.com/v1.0/token/create>
2. Select `form-data` in the `Body` tab
3. Populate the `KEY` and `VALUE` with your username, password and key
4. Hit `Send` to get your Token

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FGMrkMlad3vVYrhNqKqE9%2Fauth%20request.png?alt=media&#x26;token=fcf5a827-0329-490a-8909-b7626076f6f4" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Step 3: Make a request to PowerPointGeneratorAPI

Download the ZIP folder below and extract its contents. Then, use Postman or any API client to send the `.pptx` template file and the JSON data file to the `generator/create` endpoint to generate your presentation.

{% file src="<https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FYywVCFgsMrlusBg2tBlU%2Fquick-start.zip?alt=media&token=8d1a86a3-9ff9-41ce-b3c5-02faeeb42596>" %}

## Create presentation

<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>    | Object | .pptx template file |
| jsonData<mark style="color:red;">\*</mark> | String | JSON payload        |

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

```
Success
```

{% endtab %}

{% tab title="400" %}

```javascript
Bad Request
```

{% endtab %}

{% tab title="401 " %}

```javascript
Unauthorized
```

{% endtab %}
{% endtabs %}

### Example Requests

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

```csharp
curl --location --request POST 'https://gen.powerpointgeneratorapi.com/v1.0/generator/create' \
-H 'Content-Type: multipart/form-data' \
-H 'Authorization: Bearer <add_your_token_here>' \
-F 'files=@title_slide_template.pptx' \
-F 'jsonData={"presentation":{"template":"title_slide_template.pptx","export_version":"Pptx2010","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."}]}]}}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

auth_token = 'your_actual_token_here'

payload = {
    "jsonData": '''{
        "presentation": {
            "template": "title_slide_template.pptx",
            "export_version": "Pptx2013",
            "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("./title_slide_template.pptx", "rb") as pptx_file:
    files = [
        ('files', ('title_slide_template.pptx', pptx_file, 'application/vnd.openxmlformats-officedocument.presentationml.presentation'))
    ]
    
    try:
        print("⏳ Sending request...")
        response = requests.post(
            'https://gen.powerpointgeneratorapi.com/v1.0/generator/create',
            data=payload,
            files=files,
            headers={'Authorization': f'Bearer {auth_token}'},
            timeout=360
        )
        
        print("🚀 Response received!")
        
        # Validate response before saving
        if response.status_code == 200:
            with open("./generated.pptx", "wb") as output_file:
                output_file.write(response.content)
            print("✅ PowerPoint file generated successfully!")
        else:
            print(f"❌ Error: {response.status_code} - {response.text}")
    
    except requests.exceptions.RequestException as e:
        print(f"⚠️ Request failed: {e}")

```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const formData = new FormData();

  formData.append("jsonData", JSON.stringify('{"presentation":{"template":"url of title_slide_template.pptx","export_version":"Pptx2010","resultFileName":"quick_start_example","slides":[{"type":"slide","slide_index":0,"shapes":[{"name":"Title 1","content":"YourgeneratedPowerPointpresentation"},{"name":"Subtitle 2","content":"Create,fillandmanagePowerPointdocumentsthroughsimpleAPIrequests."}]}]}}'));

  const request = new XMLHttpRequest();
  request.open(
    "POST",
    "https://gen.powerpointgeneratorapi.com/v1.0/generator/create",
    true
  );
  request.setRequestHeader(
    "Authorization",
    "Bearer <add_your_token_here>"
  );

  request.responseType = "blob";

  request.onload = function () {
    if (request.readyState === request.DONE && request.status === 200) {
      var blob = new Blob([request.response], {
      type: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
      });
      var link = document.createElement("a");
      link.href = window.URL.createObjectURL(blob);
      link.download = "generated.pptx";
      link.click();      
    }
  };

  request.send(formData);
```

{% endtab %}

{% tab title="Postman" %}

1. Select the `Authorization` tab,  enter your `Token` .

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FmsUkWEOs0SqjPwPV52da%2FPGA%20Postman%20Auth%20Image.png?alt=media&#x26;token=bf296357-2354-4771-a42e-a77676ba1a84" alt=""><figcaption></figcaption></figure>

2. Select the `Body` tab, select `form-data` , 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 the <code>.pptx</code> file from the <code>quick-start.zip</code> folder above</td></tr><tr><td><code>jsonData</code></td><td>Copy and paste the data from the <code>.json</code> file in the <code>quick-start.zip</code> folder above.</td></tr></tbody></table>

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FwlnyFYy8wQg0LI0Kapwh%2FPGA%20Postman%20Body%20Image.png?alt=media&#x26;token=44656a98-48fe-4693-b76f-575d9ac85b2d" alt=""><figcaption></figcaption></figure>

3. Click the down arrow next to `Send` then select `Send and Download` . Once the result is successfully received, save the output as `.pptx`.

![](https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FRSZdlg0JnnZ0c4PAShC3%2FPGA%20Postman%20Save%20Image.png?alt=media\&token=135a5f85-3155-442c-9750-5e6942f43d48)
{% endtab %}
{% endtabs %}

### Output .pptx file

You will receive a byte array that can be converted to a PowerPoint presentation. Your PowerPoint will contain a single slide that looks like this:

![](https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2F1S5kyNRi0Jm26lFLiahD%2Ffirst%20example.JPG?alt=media\&token=55c22da5-bb38-46a8-96dd-547088e6023d)


---

# 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://docs.powerpointgeneratorapi.com/getting-started/quick-start.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.
