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

# 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`.

   ![](/files/nm6HjSB7gqnIrFcfDRKZ)

   * **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](/json-template-syntax/presentation.md)

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="/files/hqrHGJs8CW5UsW3e0kdP" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mUjZqHZkGbs3Nw4P7LwL" alt=""><figcaption></figcaption></figure>

***

<figure><img src="/files/vFdHNmrJM6iPHIzaU8Q6" 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 %}
