---
agentTools:
  projectIndex: https://rampwin-api.readme.io/llms.txt
---

# Fetch Templates

Fetches WhatsApp message templates associated with a channel.

## Endpoint

`GET /api/message-templates/official-templates`

**Base URL**

```bash URL
https://api.rampwin.com
```

***

## Description

Retrieves WhatsApp message templates stored in Rampwin, with an option to sync with Meta for the latest status.

***

## Headers

| Header    | Type   | Required | Description          |
| --------- | ------ | -------- | -------------------- |
| accept    | string | Yes      | application/json     |
| x-api-key | string | Yes      | Your Rampwin API key |

***

## Query Parameters

| Parameter     | Type    | Required | Description                                |
| ------------- | ------- | -------- | ------------------------------------------ |
| channel\_id   | string  | Yes      | WhatsApp channel ID                        |
| isSyncMessage | boolean | No       | Sync templates from Meta for latest status |
| isPagination  | boolean | No       | Enable pagination                          |
| page          | number  | No       | Page number                                |
| page\_size    | number  | No       | Number of records per page                 |
| isCurrency    | boolean | No       | Include currency-related data              |

***

## 1. Fetch Templates (Default)

Returns templates stored in Rampwin without syncing from Meta.

### Use Case

* Fast retrieval
* Regular listing
* No need for real-time status updates

### Example Request

```curl
curl --location 'https://api.rampwin.com/api/message-templates/official-templates?channel_id=YOUR_CHANNEL_ID&isPagination=true&page=1&page_size=10&isCurrency=true' \
--header 'accept: application/json' \
--header 'x-api-key: YOUR_API_KEY'
```

***

## 2. Fetch + Sync Templates

Fetches templates after syncing with Meta to ensure the latest status.

### Use Case

* When template status may have changed in Meta
* Before sending campaigns
* Admin or refresh actions

### Key Difference

* `isSyncMessage=true` → Syncs templates from Meta before returning response

### Example Request

```curl
curl --location 'https://api.rampwin.com/api/message-templates/official-templates?channel_id=YOUR_CHANNEL_ID&isSyncMessage=true&isPagination=true&page=1&page_size=10&isCurrency=true' \
--header 'accept: application/json' \
--header 'x-api-key: YOUR_API_KEY'
```

***

## Note

Both APIs use the same endpoint.\
The only difference is the `isSyncMessage` parameter:

* `false / not provided` → Fetch from Rampwin DB
* `true` → Sync from Meta and return latest status

***

## Response

### Success (200)

```json
{
  "success": true,
  "data": [
    {
      "template_id": "template_123",
      "name": "payment_receipt",
      "status": "APPROVED",
      "category": "UTILITY",
      "language": "en_US",
      "components": []
    }
  ],
  "pagination": {
    "page": 1,
    "page_size": 10,
    "total": 100
  }
}
```