Search Templates: Sample Requests

This guide provides sample request bodies for the Search Templates API V5.

Retrieve All APN Templates

Search for APN templates without applying filters.

{
  "channel_name": "apn"
}

Search by Template Name

Retrieve templates whose names contain Promotion.

{
  "channel_name": "apn",
  "filtering_criteria": [
    {
      "condition_operator": "and",
      "condition_details": [
        {
          "field": "template_name",
          "operation": "contains",
          "value": ["Promotion"]
        }
      ]
    }
  ]
}

Search by Template ID

Retrieve a template with a specific ID.

{
  "channel_name": "apn",
  "filtering_criteria": [
    {
      "condition_operator": "and",
      "condition_details": [
        {
          "field": "template_id",
          "operation": "equals",
          "value": [12345]
        }
      ]
    }
  ]
}

Replace 12345 with the actual template ID.


Search by Category

Retrieve templates matching a category value.

{
  "channel_name": "apn",
  "filtering_criteria": [
    {
      "condition_operator": "and",
      "condition_details": [
        {
          "field": "category",
          "operation": "equals",
          "value": ["Promotional"]
        }
      ]
    }
  ]
}

Search Using Multiple Conditions

Retrieve templates whose names contain Promotion and whose category matches Promotional.

{
  "channel_name": "apn",
  "filtering_criteria_operator": "and",
  "filtering_criteria": [
    {
      "condition_operator": "and",
      "condition_details": [
        {
          "field": "template_name",
          "operation": "contains",
          "value": ["Promotion"]
        },
        {
          "field": "category",
          "operation": "equals",
          "value": ["Promotional"]
        }
      ]
    }
  ]
}

Search Using OR Conditions

Retrieve templates whose names contain either Welcome or Greeting.

{
  "channel_name": "apn",
  "filtering_criteria": [
    {
      "condition_operator": "or",
      "condition_details": [
        {
          "field": "template_name",
          "operation": "contains",
          "value": ["Welcome"]
        },
        {
          "field": "template_name",
          "operation": "contains",
          "value": ["Greeting"]
        }
      ]
    }
  ]
}

Search with Sorting and Pagination

Retrieve the first 10 templates, sorted by creation date in descending order.

{
  "channel_name": "apn",
  "output": {
    "sorting": [
      {
        "field": "created_date",
        "direction": "desc"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 10
    }
  }
}

Search with Selected Output Fields

Request specific fields in the search results.

{
  "channel_name": "apn",
  "output": {
    "fields": [
      "template_id",
      "template_name",
      "category_id",
      "category_name",
      "created_date",
      "updated_date"
    ]
  }
}

Search with Count, Sorting, Pagination, and Fields

Use the available output options together.

{
  "channel_name": "apn",
  "filtering_criteria": [
    {
      "condition_operator": "and",
      "condition_details": [
        {
          "field": "template_name",
          "operation": "starts_with",
          "value": ["Festive"]
        }
      ]
    }
  ],
  "output": {
    "get_count": true,
    "sorting": [
      {
        "field": "template_name",
        "direction": "asc"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20
    },
    "fields": [
      "template_id",
      "template_name",
      "category_name",
      "updated_date"
    ]
  }
}

Search Using an IN Condition

Retrieve templates whose IDs match any of the specified values.

{
  "channel_name": "apn",
  "filtering_criteria": [
    {
      "condition_operator": "and",
      "condition_details": [
        {
          "field": "template_id",
          "operation": "in",
          "value": [12345, 12346, 12347]
        }
      ]
    }
  ]
}

Replace the sample IDs with actual template IDs.