# Using multiple templates

You may have a scenario where you want to build a PowerPoint using slides from multiple template PowerPoints.&#x20;

To do this, you have to:

1. **Attach Files and/or Provide Template URLs:**

   * **File Attachment:** Attach your template PowerPoint files as `File` attachments in the `POST` request, using the parameter name `files`.

   ![](https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FaKIdni4AyYutLkQBsMhO%2Fmultiple-files.jpg?alt=media\&token=e0d19a5d-b175-4fc7-88c0-6463ca21ce6f)

   * **Template URLs:** You can also use URLs for templates stored online, such as in Google Drive or OneDrive, which provide direct download access.
2. **Define Templates in Your JSON Payload:** Add a `template_list` parameter in your JSON payload, as shown below. The `template_list` should contain an entry for each template file, with a unique `template_id` and the name of each template file. Each `template` name must exactly match the filename of the corresponding "files" parameter sent in the form.

{% code lineNumbers="true" %}

```json
{
   "presentation":{
      "template_list":[
         {
            "template_id":1,
            "template":"template-1.pptx"
         },
         {
            "template_id":2,
            "template":"template-2.pptx"
         },
         {
            "template_id":3,
            "template":"template-3.pptx"
         }
      ]
      ....
      
```

{% endcode %}

3. **Assign Template IDs to Slides:** In the JSON payload, specify a `template_id` for each slide to indicate which template file to use. Each `slide` object should include a `slide_index` and the `template_id` for the template it should follow.

{% code lineNumbers="true" %}

```json
"slides":[
   {
      "template_id":1,
      "slide_index":0,
   ....   
```

{% endcode %}

#### Important Note

You cannot use both a single template file and multiple templates together. The following example demonstrates incorrect syntax:

{% code lineNumbers="true" %}

```json
//This syntax is not allowed.
{
   "presentation":{
      "template":"template.pptx",
      "template_list":[
         {
            "template_id":1,
            "template":"template-1.pptx"
         },
         {
            "template_id":2,
            "template":"template-2.pptx"
         },
         {
            "template_id":3,
            "template":"template-3.pptx"
         }
      ],
      ....
```

{% endcode %}

Reference: [presentation](https://docs.powerpointgeneratorapi.com/json-template-syntax/presentation "mention")

Download: [input.zip](https://drive.google.com/uc?export=download\&id=1MKJPv8T46FK_p39vDvq_9Rm3pJaqeNKo) | [output.pptx](https://drive.google.com/uc?export=download\&id=1KFTmyMb2gMOnv6zrMqaZZ4wjGCSRok8A)

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2Fuv9Zewe5lMEIqKUXGAC8%2Ftemplate-1.png?alt=media&#x26;token=7282ac2a-0f19-40b7-bfbf-8457be1cda9f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2F02cYhbFRbsRGvjuN1KP3%2Ftemplate-2.png?alt=media&#x26;token=f4807d60-ba06-4f78-aa95-737011e3a762" alt=""><figcaption></figcaption></figure>

***

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2FjTxTeZMHKG1DezbZqwqC%2Foutput.png?alt=media&#x26;token=e09bf9f8-cf2d-4a54-bb47-43788b834232" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column width="58.33333333333333%" %}
{% code lineNumbers="true" %}

```json
{
  "presentation": {
    "template_list": [
      {
        "template_id": 1,
        "template": "template-1.pptx"
      },
      {
        "template_id": 2,
        "template": "template-2.pptx"
      }
    ],
    "slides": [
      {
        "slide_index": 0,
        "template_id": 1,
        "shapes": [
          {
            "name": "Chart 1",
            "data": [
              [
                "North",
                "South",
                "East",
                "West"
              ],
              [
                "January",
                "February",
                "March",
                "April"
              ],
              [
                11,
                15,
                4,
                7
              ],
              [
                15,
                35,
                23,
                18
              ],
              [
                40,
                50,
                65,
                44
              ],
              [
                60,
                73,
                52,
                68
              ]
            ]
          }
        ]
      },
      {
        "slide_index": 0,
        "template_id": 2,
        "shapes": [
          {
            "name": "Chart 1",
            "data": [
              [
                "Product A",
                "Product B",
                "Product C"
              ],
              [
                "Q1",
                "Q2",
                "Q3"
              ],
              [
                72,
                78,
                81
              ],
              [
                68,
                74,
                77
              ],
              [
                85,
                88,
                90
              ]
            ]
          }
        ]
      }
    ]
  }
}
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}


---

# 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/examples/presentation/using-multiple-templates-1.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.
