Use this endpoint to create a push template.
API at a glance
Description: This API creates a new push notification template in your Blueshift account. You can specify the template content, target devices (iOS/Android/both), recommendation schemes, external fetches, and other campaign behavior properties.
Authentication & testing
Testing the API on this page
How to try it here
- Use your User API Key as the Username (leave Password blank).
- Select the appropriate API endpoint based on your Blueshift region.
- Enter the necessary parameters and click Try It to run the request.


Authentication using Base64 encoding
Note for developers
API requests require authentication using HTTP Basic Authentication with an API key.
The API key serves as the username, while the password field should be left empty.
The format to encode is: your_api_key: (note the trailing colon).
This string must be Base64-encoded and included in the request's Authorization header as follows:
Authorization: Basic encoded_valueYou can generate the encoded value using a trusted Base64 encoder.
Postman collection
Try it with Postman: Explore the API using Blueshift's Postman collection.
Things to know before you start
- Required fields:
push_template(withname,content,skip_user_on_external_fetch_error) andtemplate_property(with skip flags) are required. - Message type: Only
jsonmessage type is supported. - Device targeting: Choose
apple,android, orboth(default). - JSON payload: The
contentfield should contain the JSON payload for push notifications. Leave GCM payload empty for iOS-only notifications, or leave APNs payload empty for Android-only notifications. - Recommendation schemes: Use
account_algorithm_uuidto add recommendation schemes. Sendnullto remove existing schemes. - Tag data: Tags must already exist in your account. Format:
folder_name:tag1,tag2,tag3. - Use case: Best for programmatically creating push templates, automating template setup, and bulk template creation.
Request parameters
Check out the request parameters
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
push_template | object | ✅ Yes | Push template object. See structure below. |
template_property | object | ✅ Yes | Campaign behavior properties. See structure below. |
external_fetches | array | ❌ No | Array of external fetch UUIDs to integrate external data sources. |
transaction_mixins | array | ❌ No | Array of transaction mixin UUIDs. |
Push template object
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | ✅ Yes | Specify the name of the template. |
content | string | ✅ Yes | Specify the JSON payload of the notification. Leave GCM empty for iOS-only, APNs empty for Android-only. |
skip_user_on_external_fetch_error | boolean | ✅ Yes | Message is not sent if external fetch encounters an error. Default: true. |
author | string | ❌ No | Specify the email address of the template's author. |
message_type | string | ❌ No | Only json is supported. Default: json. |
device_type | string | ❌ No | Target device: apple, android, or both. Default: both. |
tag_data | string | ❌ No | Folder and tags in format folder_name:tag1,tag2,tag3. Tags must exist in your account. |
Template property object
| Parameter | Type | Required | Description |
|---|---|---|---|
skip_user_on_blank_products | boolean | ✅ Yes | Skip user if products are blank. Default: true. |
skip_user_on_blank_event_products | boolean | ✅ Yes | Skip user if event products are blank. Default: true. |
account_algorithm_uuid | string | ❌ No | Recommendation scheme UUID. Leave blank for no change, send null to remove existing scheme. |
Example requests & responses
Create a push template
Request
curl --request POST \
--url https://api.getblueshift.com/api/v1/push_templates.json \
--header 'accept: application/json' \
--header 'authorization: Basic <YOUR_API_KEY>' \
--header 'content-type: application/json' \
--data '{
"push_template": {
"name": "Summer Rush",
"author": "[email protected]",
"message_type": "json",
"device_type": "apple",
"content": "{\"GCM\":{\"notification\":{\"title\":\"Notification Content\"}},\"APNS\":{\"aps\":{\"alert\":\"Hello world, now we'\''re cookin!\"}}}",
"tag_data": "Regions:USA,China,Brazil,Hong Kong,India,Sweden,Canada",
"skip_user_on_external_fetch_error": true
},
"template_property": {
"skip_user_on_blank_products": true,
"skip_user_on_blank_event_products": true,
"account_algorithm_uuid": "2879b1a3-ee84-4e13-b63c-ad83674c0ca1"
},
"external_fetches": [
{
"uuid": "e789705f-3eb3-4e2a-a666-648dedae6g86"
}
]
}'Response
{
"status": "OK",
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}API error responses
Note
The following error codes are commonly returned by Blueshift APIs. Depending on the specific endpoint, not all may apply.
Status code | Description | Example responses |
|---|---|---|
400 Bad Request | The request is invalid due to missing or incorrect parameters. This includes missing fields, invalid values, formatting issues, or conflicts such as duplicate data. |
|
401 Unauthorized | API authentication failed due to an invalid or missing API key. |
|
403 Forbidden | The API key does not have sufficient permissions to perform this action. |
|
404 Not Found | The specified campaign was not found. Verify the campaign UUID. |
|
422 Unprocessable Entity |
|
|
429 Too Many Requests | The request limit has been exceeded. Reduce request frequency. |
|
500 Internal Server Error | An unexpected server error occurred. Contact support if the issue persists. |
|
502 Bad Gateway | The server received an invalid response. Retry the request. |
|
503 Service Unavailable | The service is temporarily unavailable. Try again later. |
|
504 Gateway Timeout | The server took too long to respond. Retry the request with exponential backoff. |
|