External APItemplatesList Templates

List Templates

Overview

This API retrieves WhatsApp message templates from your Meta Business account. You can fetch all templates, filter by approval status, search by name, or paginate through large template sets.


Endpoint

GET https://client-api.wappcloud.com/api/v1/external/templates

Headers

HeaderDescription
x-api-key(Required) Your API Key for authentication
Authorization(Required) Bearer Token

Query Parameters

ParameterTypeRequiredDescription
TemplateNamestringNoFetch a single template by exact name. Returns full component detail
TemplateStatusstringNoFilter by status: APPROVED, PENDING, REJECTED, or ALL
limitnumberNoNumber of templates to return (default: 1000)
afterstringNoCursor for the next page (from pagination.after in previous response)
TemplateFieldsstringNoComma-separated list of Meta template fields to include

Important: TemplateName and TemplateStatus cannot be used together. When TemplateName is provided, the API returns full template detail (all components, variables, media URL). Without TemplateName, the API returns a summary list with status counts.


Setting Up in Postman

  1. Select the Params tab in Postman
  2. Add any of the query parameters listed above as key-value pairs

Requests


1. Get All Templates

Fetches all templates (up to 1000 by default). Returns a summary: name, status, category, and ID per template — plus status counts.

GET https://client-api.wappcloud.com/api/v1/external/templates

Response:

{
  "success": true,
  "code": 200,
  "message": "Template listed created",
  "data": {
    "messageTemplates": {
      "templates": [
        {
          "name": "hello_world",
          "status": "APPROVED",
          "category": "UTILITY",
          "_id": "1234567890123456"
        },
        {
          "name": "order_confirmation",
          "status": "APPROVED",
          "category": "UTILITY",
          "_id": "9876543210987654"
        },
        {
          "name": "promo_launch",
          "status": "PENDING",
          "category": "MARKETING",
          "_id": "1122334455667788"
        }
      ],
      "pagination": {
        "before": "cursor_before_value",
        "after": "cursor_after_value"
      },
      "statusCounts": [
        { "status": "APPROVED", "count": 2 },
        { "status": "PENDING", "count": 1 },
        { "status": "TOTAL", "count": 3 }
      ]
    }
  }
}

2. Filter by Status — APPROVED

Returns only approved templates, ready to be used for sending messages.

GET https://client-api.wappcloud.com/api/v1/external/templates?TemplateStatus=APPROVED

3. Filter by Status — PENDING

Returns templates currently under Meta review.

GET https://client-api.wappcloud.com/api/v1/external/templates?TemplateStatus=PENDING

4. Filter by Status — REJECTED

Returns templates that Meta has rejected. Check Meta’s rejection reason in the Business Manager.

GET https://client-api.wappcloud.com/api/v1/external/templates?TemplateStatus=REJECTED

5. Filter by Status — ALL (Explicit)

Same as fetching without any status filter. Returns templates of all statuses.

GET https://client-api.wappcloud.com/api/v1/external/templates?TemplateStatus=ALL

6. Get Template by Name

Returns full template detail — all components, body text, variable examples, button definitions, and media URL (if applicable).

Use this when you need to inspect a specific template’s structure before sending.

GET https://client-api.wappcloud.com/api/v1/external/templates?TemplateName=order_confirmation

Response:

{
  "success": true,
  "code": 200,
  "message": "Template listed created",
  "data": {
    "messageTemplates": [
      {
        "id": "9876543210987654",
        "name": "order_confirmation",
        "status": "APPROVED",
        "category": "UTILITY",
        "language": "en_US",
        "components": [
          {
            "type": "HEADER",
            "format": "TEXT",
            "text": "Hello {{1}}!"
          },
          {
            "type": "BODY",
            "text": "Hi {{1}}, your order #{{2}} has been confirmed. Expected delivery: {{3}}.",
            "example": {
              "body_text": [["Rahul", "ORD-9821", "Dec 25, 2024"]]
            }
          },
          {
            "type": "FOOTER",
            "text": "WappCloud Orders"
          },
          {
            "type": "BUTTONS",
            "buttons": [
              {
                "type": "URL",
                "text": "Track Order",
                "url": "https://track.wappcloud.com/{{1}}",
                "example": ["https://track.wappcloud.com/ORD-9821"]
              }
            ]
          }
        ],
        "variableCountBySection": {
          "HEADER": 1,
          "BODY": 3,
          "BUTTONS": 1
        }
      }
    ]
  }
}
FieldDescription
variableCountBySectionNumber of dynamic variables per section (HEADER, BODY, BUTTONS)
mediaUrlS3 URL of the uploaded media (present for IMAGE/DOCUMENT/VIDEO headers only)

7. Pagination — First Page

Use limit to control how many templates are returned per request.

GET https://client-api.wappcloud.com/api/v1/external/templates?limit=10

8. Pagination — Next Page

Take the after cursor from the previous response’s pagination.after field and pass it here.

GET https://client-api.wappcloud.com/api/v1/external/templates?limit=10&after=cursor_after_value

9. Approved Templates with Pagination

GET https://client-api.wappcloud.com/api/v1/external/templates?TemplateStatus=APPROVED&limit=20

Response Fields Reference

Summary List Response (no TemplateName)

FieldTypeDescription
templatesarrayList of template summary objects
templates[].namestringTemplate name
templates[].statusstringAPPROVED, PENDING, or REJECTED
templates[].categorystringMARKETING, UTILITY, or AUTHENTICATION
templates[]._idstringMeta template ID
pagination.beforestringCursor to fetch the previous page
pagination.afterstringCursor to fetch the next page — pass as after query param
statusCountsarrayCount of templates per status, plus a TOTAL entry

Full Detail Response (with TemplateName)

FieldTypeDescription
idstringMeta template ID
namestringTemplate name
statusstringApproval status
categorystringTemplate category
languagestringLanguage code
componentsarrayFull component definitions (HEADER, BODY, FOOTER, BUTTONS)
variableCountBySectionobjectNumber of variables in each section
mediaUrlstringS3 URL of the media (if IMAGE/DOCUMENT/VIDEO header)

Error Responses

401 Unauthorized

{
  "error": "Missing authToken or x-api-key"
}

403 Forbidden

{
  "error": "Invalid or inactive API key"
}

Notes

  • Template names must match exactly as stored in Meta — they are case-sensitive.
  • The after cursor is returned only when there are more templates beyond the current page.
  • When TemplateStatus=ALL or no status is passed, all templates regardless of status are returned.
  • Use TemplateName to get the component structure of a template before building a send-message payload.