Learn how to create Templates using API V5
The Templates API enables the creation, updating, and retrieval of message templates through APIs. It supports App Push Notifications (APN), including platform-specific content, personalization, rich media, landing page actions, and custom key-value pairs.
Prerequisites
Before using the APN Templates API, ensure that the following requirements are met:
- A valid Netcore API key is available.
- The account has access to the required APN functionality.
- Requests use
Content-Type: application/json. - The appropriate regional base URL is configured.
APN Template Operations
| Operation | Endpoint | Method | Description |
|---|---|---|---|
| Create Templates | /client/template/create | POST | Creates APN templates with the specified content and configuration. |
| Update Templates | /client/template/update | POST | Updates existing templates using their template IDs. |
| Search Templates | /client/template/search | POST | Retrieves templates based on filtering criteria, sorting, pagination, and selected fields. |
Authentication
All requests require a valid API key passed through the api-key HTTP header.
Include the following headers in requests:
| Header | Required | Description |
|---|---|---|
api-key | Yes | API key used to authenticate the request. |
Content-Type | Yes for JSON requests | Set to application/json. |
Keep API keys secure and avoid exposing them in publicly accessible code or documentation examples.
Example:
POST {{BASE_URL}}/client/template/create
api-key: YOUR_API_KEY
Content-Type: application/jsonReplace YOUR_API_KEY and {{BASE_URL}} with the appropriate values for the account.
Create an APN Template
The following example creates a regular APN template with configurations for Android and iOS.
curl --location --request POST '{{BASE_URL}}/client/template/create' \
--header 'api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"templates": [
{
"channel_name": "apn",
"template_name": "Welcome Notification",
"custom": {
"template_type": "regular",
"os": "all"
},
"content": {
"title": "Welcome",
"description": "Welcome to our app.",
"landing_page_type": "app_homepage",
"apn_interactions": [
{
"os_type": "ios",
"subtitle": "Explore the app"
},
{
"os_type": "android",
"subtitle": "Explore the app"
}
]
}
}
]
}
}'The example illustrates the request structure. Additional fields can be included according to the selected template type and supported platform configuration.
Base URLs by Region
Use the regional API host configured for the account.
| Region | Base URL |
|---|---|
| India | https://netcoreapi-main-prod-ind.netcorein.com/v5/ |
| Europe | https://netcoreapi-main-prod-eu.netcorein.com/v5/ |
| United States | https://netcoreapi-main-prod-us.netcorein.com/v5/ |
| Indonesia | https://netcoreapi-gprd-id.netcorein.com |
Troubleshooting and FAQs
Which channels are supported?
The supplied Templates API specification defines apn as the supported channel_name value. Support for additional channels is not established by this specification.
Can a template contain both Android and iOS configurations?
Yes. The request structure supports multiple entries in content.apn_interactions, with each entry specifying an os_type of android or ios. The custom.os field supports all, android, and ios.
Can multiple templates be created or updated in one request?
Both Create and Update accept a templates array, allowing multiple template objects to be included in a request. Any applicable batch limits should be confirmed before publishing them.
How are templates searched?
The Search Templates endpoint supports filtering criteria, logical operators, sorting, pagination, and field selection. The request must include channel_name.
