GET /api/templates Returns a list of all templates for the current app. Optionally filter by a specific channel ID to see only templates linked to that channel.

Headers

appid
string
required
Your CometChat App ID.
apikey
string
required
Your CometChat API Key.

Query parameters

channelId
string
Filter templates by a specific channel ID.

Example request

curl https://{appId}.api-{region}.cometchat.io/v3/business-messaging/api/templates \
  -H "appid: YOUR_APP_ID" \
  -H "apikey: YOUR_API_KEY"

Example response

[
  {
    "id": "665b2c3d4e5f6a7b8c9d0e1f",
    "appId": "YOUR_APP_ID",
    "name": "Order Confirmation",
    "templateId": "order-confirmation",
    "status": "approved",
    "category": "transactional",
    "channelIds": ["664a1b2c3d4e5f6a7b8c9d0e"],
    "variableSchema": {
      "customerName": { "type": "string" },
      "orderId": { "type": "string" }
    },
    "config": {},
    "createdAt": "2024-01-15T09:30:00.000Z",
    "updatedAt": "2024-01-15T09:30:00.000Z"
  }
]

Response fields

id
string
Unique template identifier.
name
string
Template display name.
templateId
string
Custom or auto-generated template identifier.
status
string
Template status: draft, approved, or archived.
category
string
Optional template category.
channelIds
string[]
Array of linked channel IDs.
variableSchema
object
Declared template variables with their types.
config
object
Template-level configuration.