> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gateway.connexease.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Carousel Templates

> Send carousel templates with per-card media and button values.

A carousel template is a body bubble followed by 2–10 swipeable cards. Each card has its own media header, body, and buttons. At send time you provide the top-level body variables and, per card, the media and any dynamic values.

> [!NOTE]
>
> Carousels are `MARKETING` only. Every card has the same structure: same header format and same button types in the same order. See [Create Template → Carousel rules](https://docs.gateway.connexease.com/public-api-reference/template/create-template.md#carousel-rules).

## Structure

The top-level `components` array holds the template body and one `carousel` component. The `carousel` component has no `parameters`; it has `cards` instead.

| Field | Type | Description |
| :- | :- | :- |
| `cards[].card_index` | integer | Zero-based position of the card. Send every card, in order. |
| `cards[].components` | array | The card's own components: `header` (always, for the media), `body` (if the card body has variables), and `button` (for dynamic URL or quick reply payloads). |

Card buttons use the same `sub_type` / `index` rules as regular [template buttons](https://docs.gateway.connexease.com/api-reference/templates/buttons.md). `index` counts buttons within the card.

***

## Send a carousel

```bash cURL theme={null}
curl -X POST https://api.gateway.connexease.com/v1/wa/message \
  -H "Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "905321234567",
    "type": "template",
    "template": {
      "name": "summer_catalog",
      "language": { "code": "en" },
      "components": [
        {
          "type": "body",
          "parameters": [{ "type": "text", "text": "John" }]
        },
        {
          "type": "carousel",
          "cards": [
            {
              "card_index": 0,
              "components": [
                {
                  "type": "header",
                  "parameters": [{ "type": "image", "image": { "link": "https://example.com/cards/shirts.jpg" } }]
                }
              ]
            },
            {
              "card_index": 1,
              "components": [
                {
                  "type": "header",
                  "parameters": [{ "type": "image", "image": { "link": "https://example.com/cards/dresses.jpg" } }]
                }
              ]
            }
          ]
        }
      ]
    }
  }'
```

```python Python theme={null}
import requests

cards = [
    "https://example.com/cards/shirts.jpg",
    "https://example.com/cards/dresses.jpg",
]

requests.post(
    "https://api.gateway.connexease.com/v1/wa/message",
    headers={"Authorization": "Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json"},
    json={
        "messaging_product": "whatsapp",
        "to": "905321234567",
        "type": "template",
        "template": {
            "name": "summer_catalog",
            "language": {"code": "en"},
            "components": [
                {"type": "body", "parameters": [{"type": "text", "text": "John"}]},
                {
                    "type": "carousel",
                    "cards": [
                        {
                            "card_index": i,
                            "components": [
                                {"type": "header", "parameters": [{"type": "image", "image": {"link": url}}]}
                            ]
                        }
                        for i, url in enumerate(cards)
                    ]
                }
            ]
        }
    }
)
```

```javascript Node.js theme={null}
const cards = [
  'https://example.com/cards/shirts.jpg',
  'https://example.com/cards/dresses.jpg',
];

await fetch('https://api.gateway.connexease.com/v1/wa/message', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    messaging_product: 'whatsapp',
    to: '905321234567',
    type: 'template',
    template: {
      name: 'summer_catalog',
      language: { code: 'en' },
      components: [
        { type: 'body', parameters: [{ type: 'text', text: 'John' }] },
        {
          type: 'carousel',
          cards: cards.map((url, i) => ({
            card_index: i,
            components: [
              { type: 'header', parameters: [{ type: 'image', image: { link: url } }] }
            ]
          }))
        }
      ]
    }
  }),
});
```

***

## Card with a dynamic URL button

If the card's URL button has a `{{1}}` variable, add a `button` component inside that card:

```json theme={null}
{
  "card_index": 0,
  "components": [
    {
      "type": "header",
      "parameters": [{ "type": "image", "image": { "link": "https://example.com/cards/shirts.jpg" } }]
    },
    {
      "type": "button",
      "sub_type": "url",
      "index": "0",
      "parameters": [{ "type": "text", "text": "linen-shirts" }]
    }
  ]
}
```

> [!WARNING]
>
> Send exactly as many cards as the approved template has, and keep every card's structure the same. A missing card or a mismatched parameter count fails the whole message.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.