> For the complete documentation index, see [llms.txt](https://docs.taqnyat.sa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taqnyat.sa/api-reference/templates/get-templates.md).

# Get Templates

Use this endpoint to retrieve the WhatsApp message templates associated with your account.

The request can also trigger a template synchronization using the `sync` parameter.

### Endpoint

```
GET /templates/
```

Full URL:

```
https://api.taqnyat.sa/wa/v2/templates/
```

### Authentication

Include your API token in the request header:

```
Authorization: <YOUR_TOKEN>Content-Type: application/json
```

### Request Body

```json
{
  "sync": 1
}
```

### Request Parameters

| Parameter | Type    | Required | Description                                                                    |
| --------- | ------- | -------- | ------------------------------------------------------------------------------ |
| `sync`    | Integer | Yes      | Triggers synchronization of the account templates before returning the result. |

### Example Request

```bash
curl --location --request GET 'https://api.taqnyat.sa/wa/v2/templates/' \
--header 'Content-Type: application/json' \
--header 'Authorization: <YOUR_TOKEN>' \
--data '{
  "sync": 1
}'
```

### Example Response

```json
{
  "waba_templates": [
    {
      "name": "example_name",
      "parameter_format": "POSITIONAL",
      "components": [
        {
          "type": "HEADER",
          "format": "TEXT",
          "text": "Lorem ipsum"
        },
        {
          "type": "BODY",
          "text": "Lorem ipsum dolor sit amet"
        },
        {
          "type": "FOOTER",
          "text": "Lorem ipsum"
        },
        {
          "type": "BUTTONS",
          "buttons": [
            {
              "type": "URL",
              "text": "your-url-button-text",
              "url": "https://website-example.com/"
            },
            {
              "type": "PHONE_NUMBER",
              "text": "Lorem ipsum",
              "phone_number": "+966*********"
            }
          ]
        }
      ],
      "language": "ar",
      "status": "APPROVED",
      "category": "MARKETING",
      "id": "86*************"
    }
  ]
}
```

### Response Fields

| Field              | Type   | Description                                                 |
| ------------------ | ------ | ----------------------------------------------------------- |
| `waba_templates`   | Array  | List of WhatsApp templates associated with the account.     |
| `name`             | String | Template name.                                              |
| `parameter_format` | String | Variable format used by the template, such as `POSITIONAL`. |
| `components`       | Array  | Components that make up the template.                       |
| `language`         | String | Template language code.                                     |
| `status`           | String | Current template status, such as `APPROVED`.                |
| `category`         | String | Template category, such as `MARKETING`.                     |
| `id`               | String | Unique template ID.                                         |

### Template Components

The response may include components such as:

* `HEADER`
* `BODY`
* `FOOTER`
* `BUTTONS`

Each component contains the configuration defined for the template.

### Notes

* The response is returned inside the `waba_templates` array.
* `sync: 1` is included in the current Postman request to synchronize templates before retrieving them.
* The returned `id` can be used when another endpoint requires the template ID.
* Template components vary depending on how the template was created.
