# GET /templates/{{identifier}} — Get Template By Name/Id

> Product: **Pabbly Chatflow** (v1)
> Base URL: `https://chatflow.pabbly.com/api/v1`
> Auth: Bearer via `Authorization` header
> Canonical: `/chatflow/templates/get-template-by-name-id`

Hit the API with GET method and fill the following data according your requirements to fetch a message template with custom fields. Path Variables (URL Params):

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| identifier | string | Yes | It should be a 24-Hex ID if the by query param is set with the value "id", otherwise you can use template_name. |

**Query parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| id | string | No |  |

**Response (200)** — Get a Text Template:

```json
{
    "status": "success",
    "message": "Template fetched successfully",
    "data": {
        "template": {
            "_id": "67a3182524676e664e58f8be",
            "settingId": "6764020afc60086212ad5119",
            "waTemplateId": "584789171207477",
            "name": "interactive_marketing",
            "language": "en_GB",
            "components": [
                {
                    "type": "HEADER",
                    "format": "TEXT",
                    "text": "Hello {{1}}",
                    "example": {
                        "header_text": [
                            "Sir"
                        ]
                    }
                },
                {
                    "type": "BODY",
                    "text": "Hope you are {{1}}.\n\nToday I want to introduce you to our new {{2}} {{3}}. {{4}} is our latest innovation, please do checkout and feel free to contact us.",
                    "example": {
                        "body_text": [
                            [
                                "doing well",
                                "product",
                                "Shalimar",
                                "Shalimar"
                            ]
                        ]
                    }
                },
                {
                    "type": "FOOTER",
                    "text": "Thank You"
                },
                {
                    "type": "BUTTONS",
                    "buttons": [
                        {
                            "type": "COPY_CODE",
                            "text": "Copy offer code",
                            "example": [
                                "Shalimar"
                            ]
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Sure I will do"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Not interested"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Opt-out"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Okay"
                        }
                    ]
                }
            ],
            "status": "APPROVED",
            "category": "MARKETING",
            "__v": 0,
            "createdAt": "2025-02-05T07:49:57.301Z",
            "updatedAt": "2025-02-05T07:49:57.301Z"
        },
        "customFields": {
            "headerParams": [
                {
                    "key": "{{1}}",
                    "value": "Sir",
                    "helpText": "Enter the Header Parameter {{1}} e.g. Sir"
                }
            ],
            "bodyParams": [
                {
                    "key": "{{1}}",
                    "value": "doing well",
                    "helpText": "Enter the Body Parameter {{1}} e.g. doing well"
                },
                {
                    "key": "{{2}}",
                    "value": "product",
                    "helpText": "Enter the Body Parameter {{2}} e.g. product"
                },
                {
                    "key": "{{3}}",
                    "value": "Shalimar",
                    "helpText": "Enter the Body Parameter {{3}} e.g. Shalimar"
                },
                {
                    "key": "{{4}}",
                    "value": "Shalimar",
                    "helpText": "Enter the Body Parameter {{4}} e.g. Shalimar"
                }
            ],
            "link": [],
            "copyCodeParam": []
        }
    }
}
```

**Response (200)** — Get a Media Template:

```json
{
    "status": "success",
    "message": "Template fetched successfully",
    "data": {
        "template": {
            "_id": "67a3182524676e664e58f8c0",
            "settingId": "6764020afc60086212ad5119",
            "waTemplateId": "858893156254595",
            "name": "link_docs",
            "language": "en",
            "components": [
                {
                    "type": "HEADER",
                    "format": "DOCUMENT",
                    "example": {
                        "header_handle": [
                            "https://scontent.whatsapp.net/v/t61.29466-34/473399444_858893162921261_7840692266964023941_n.pdf?ccb=1-7&_nc_sid=8b1bef&_nc_ohc=Ehtwa_m_4UYQ7kNvgGaLf8b&_nc_zt=3&_nc_ht=scontent.whatsapp.net&edm=AH51TzQEAAAA&_nc_gid=Ac2Kyb_CMTcjNzByxdal1Zp&oh=01_Q5AaIHduDzzpcec26JziX5DEo7JKW0y3-uPIkV4uopcluPMX&oe=67CA8D91"
                        ]
                    }
                },
                {
                    "type": "BODY",
                    "text": "This is documentation about links. {{1}}",
                    "example": {
                        "body_text": [
                            [
                                "Thanks"
                            ]
                        ]
                    }
                }
            ],
            "status": "APPROVED",
            "category": "UTILITY",
            "__v": 0,
            "createdAt": "2025-02-05T07:49:57.301Z",
            "updatedAt": "2025-02-05T12:15:29.109Z",
            "type": "document"
        },
        "customFields": {
            "headerParams": [],
            "bodyParams": [
                {
                    "key": "{{1}}",
                    "value": "Thanks",
                    "helpText": "Enter the Body Parameter {{1}} e.g. Thanks"
                }
            ],
            "link": [
                {
                    "key": "link",
                    "value": "",
                    "helpText": "Enter the URL of your document, e.g., https://pabbly-chatflow.s3.amazonaws.com/production/public/6666a1651c7510942a34f465/2025-01-14/video/e6773b24-d7a1-4d9c-a23b-c5d6b31fbc9f.mp4"
                }
            ],
            "copyCodeParam": []
        }
    }
}
```

**Response (200)** — Get a Authentication Template:

```json
{
    "status": "success",
    "message": "Template fetched successfully",
    "data": {
        "template": {
            "_id": "67a35661c103833223a633b0",
            "settingId": "6764020afc60086212ad5119",
            "waTemplateId": "907331274893781",
            "name": "bearer_auth",
            "language": "en_GB",
            "components": [
                {
                    "type": "BODY",
                    "text": "*{{1}}* is your verification code. For your security, do not share this code.",
                    "add_security_recommendation": true,
                    "example": {
                        "body_text": [
                            [
                                "123456"
                            ]
                        ]
                    }
                },
                {
                    "type": "FOOTER",
                    "text": "This code expires in 10 minutes.",
                    "code_expiration_minutes": 10
                },
                {
                    "type": "BUTTONS",
                    "buttons": [
                        {
                            "type": "URL",
                            "text": "QWERAS",
                            "url": "https://www.whatsapp.com/otp/code/?otp_type=COPY_CODE&code_expiration_minutes=10&code=otp{{1}}",
                            "example": [
                                "https://www.whatsapp.com/otp/code/?otp_type=COPY_CODE&code_expiration_minutes=10&code=otp123456"
                            ]
                        }
                    ]
                }
            ],
            "status": "APPROVED",
            "category": "AUTHENTICATION",
            "__v": 0,
            "createdAt": "2025-02-05T12:15:29.111Z",
            "updatedAt": "2025-02-05T12:15:29.111Z"
        },
        "customFields": {
            "headerParams": [],
            "bodyParams": [],
            "link": [],
            "copyCodeParam": [
                {
                    "key": "copyCodeParam",
                    "value": {
                        "type": "BODY",
                        "text": "*{{1}}* is your verification code. For your security, do not share this code.",
                        "add_security_recommendation": true,
                        "example": {
                            "body_text": [
                                [
                                    "123456"
                                ]
                            ]
                        }
                    },
                    "helpText": "Enter the code to copy, e.g., QWERAS"
                }
            ]
        }
    }
}
```

**Response (200)** — Get Template with CTA/CopyCode Buttons:

```json
{
    "status": "success",
    "message": "Template fetched successfully",
    "data": {
        "template": {
            "_id": "67c55eaf1dc8001c3d3e32f8",
            "settingId": "6764020afc60086212ad5119",
            "waTemplateId": "1264338004661404",
            "name": "winter_offer",
            "language": "en",
            "components": [
                {
                    "type": "BODY",
                    "text": "Hello folks, We're glad to invite you in our new workplace inauguration & check our newly launched collections"
                },
                {
                    "type": "FOOTER",
                    "text": "Thank You"
                },
                {
                    "type": "BUTTONS",
                    "buttons": [
                        {
                            "type": "QUICK_REPLY",
                            "text": "Sure"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Sorry busy at the moment"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Not interested"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Thanks"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Thanks You"
                        },
                        {
                            "type": "QUICK_REPLY",
                            "text": "Others"
                        },
                        {
                            "type": "URL",
                            "text": "Visit new website",
                            "url": "https://github.com/sunny-unik{{1}}",
                            "example": [
                                "https://github.com/sunny-unik"
                            ]
                        },
                        {
                            "type": "PHONE_NUMBER",
                            "text": "Call phone number",
                            "phone_number": "+917697862115"
                        },
                        {
                            "type": "URL",
                            "text": "Visit website",
                            "url": "https://github.com/"
                        },
                        {
                            "type": "COPY_CODE",
                            "text": "Copy offer code",
                            "example": [
                                "EDSWRF"
                            ]
                        }
                    ]
                }
            ],
            "status": "APPROVED",
            "category": "MARKETING",
            "type": "text",
            "__v": 0,
            "createdAt": "2025-03-03T07:47:59.036Z",
            "updatedAt": "2025-03-03T07:47:59.036Z"
        },
        "customFields": {
            "headerParams": [],
            "bodyParams": [],
            "link": [],
            "copyCodeParam": [
                {
                    "key": "urlVariables",
                    "value": "EDSWRF",
                    "helpText": "Enter the code to copy, e.g., QWERAS"
                }
            ],
            "urlVariables": [
                {
                    "key": "urlVariables",
                    "value": "",
                    "helpText": "Enter the url variables or query params to concatenate with URL"
                }
            ]
        }
    }
}
```

**Code examples:**

_cURL_

```curl
curl https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}} \
  -H "Authorization: Bearer {{YOUR_API_KEY}}"
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer {{YOUR_API_KEY}}'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests

response = requests.get(
    'https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}',
    headers={'Authorization': 'Bearer {{YOUR_API_KEY}}'},
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer {{YOUR_API_KEY}}']);

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}"))
    .header("Authorization", "Bearer {{YOUR_API_KEY}}")
    .GET();

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const response = await fetch('https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer {{YOUR_API_KEY}}',
  },
});

const data = await response.json();
```

_Go_

```go
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}", nil)
    req.Header.Set("Authorization", "Bearer {{YOUR_API_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://chatflow.pabbly.com/api/v1/templates/{{identifier}}?id={{id}}");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer {{YOUR_API_KEY}}");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Templates:**

- [GET /templates — Get Templates](/chatflow/templates/get-templates)

