Starts a Live Activity on one or more customers' devices.
Use this endpoint to start a Live Activity on one or more customers' devices. The activity appears on the Lock Screen and in the Dynamic Island, and updates in real time until you end it.
API at a glance
Description: Live Activities show a card that follows an event as it happens, such as an order on its way, an offer counting down, or a match in progress. This endpoint starts the activity. Use the Update a Live Activity endpoint to change its content or end it.
The activity is identified by bsftActivityId, which you set inside activity_attributes. Reuse that same identifier to update or end the activity.
Before you can use this endpoint
App setup
Live Activities must be built into your iOS app and integrated with the Blueshift iOS SDK before this endpoint can deliver anything. Your app defines the layout of the card and the content it accepts. Blueshift sends the content that appears inside it.
For setup instructions, see Set up Live Activities.
Requirements
- Devices running iOS 17.2 or later
- Blueshift iOS SDK 2.8.0 or later
- Token-based (.p8) push authentication configured on your Blueshift push adapter
Authentication & testing - Live Activities
Testing the API on this page
How to try it here
- Use your Event API Key as the Username (leave Password blank). You can find it in the Blueshift app under Account Settings > API Keys.
- 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 the Event API Key.
The Event 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\_value
You 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
- Set a unique
bsftActivityIdfor each activity. It goes insideactivity_attributes, and you reuse it to update or end the activity. Starting a second activity with an ID that is already running creates a duplicate card on the device. content_stateproperty names must match your app. They must exactly match theContentStateyour app defines. A mismatch is not reported as an error: the API returns a success response and the device discards the content.activity_attributes_typemust match the name your app registers. This is the name passed toregisterPushToStartin your app.- A
200response means the push was dispatched, not displayed. Checkdispatched_toand theerrorsarray in the response. Adispatched_toof0means no device received the message. - You can include up to 50 customer identifiers per call. More than 50 returns a
413 Payload Too Largeerror. - Apple limits apply. A device shows a maximum of 5 Live Activities per app, and the total push payload must stay under 4 KB. Activities and payloads beyond these limits are not delivered.
Request parameters
Check out the request parameters
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_identifier_type | string | ✅ Yes | Type of identifier used in customer_identifiers. One of customer_id, email, or phone_number. |
customer_identifiers | string[] | ✅ Yes | Identifier values. Maximum 50 per call. |
activity_attributes_type | string | ✅ Yes | Name of the activity design, matching the name your app registers with registerPushToStart. |
activity_attributes | object | ✅ Yes | Static attributes that do not change for the life of the activity. Must include bsftActivityId. |
content_state | object | ✅ Yes | Dynamic content shown in the activity. Property names must match the ContentState defined in your app. |
notification | object | ✅ Yes | Alert shown when the activity starts. Accepts title and body. |
stale_date | string | ❌ No | ISO 8601 timestamp after which the content is considered out of date. Must be in the future. |
activity_attributes
| Parameter | Type | Required | Description |
|---|---|---|---|
bsftActivityId | string | ✅ Yes | Your identifier for this activity. Reuse it to update or end the activity. |
Any other properties you include are passed to your app as static attributes.
Example requests & responses
Request example
curl --request POST \
--url https://api.getblueshift.com/api/v1/live_activity/start \
--header 'accept: application/json' \
--header 'authorization: Basic YWNlZDZlNGYxMWExYWVhOTZmNTJkNDg4M2ZmMjI4Mjg6' \
--header 'content-type: application/json' \
--data '
{
"customer_identifier_type": "email",
"customer_identifiers": ["[email protected]"],
"activity_attributes_type": "DeliveryActivityAttribute",
"activity_attributes": {
"bsftActivityId": "order_4482",
"activityName": "Order #4482"
},
"content_state": {
"title": "Order confirmed",
"subtitle": "Preparing your order",
"progress": 0.2
},
"notification": {
"title": "Order #4482",
"body": "Your order is confirmed"
}
}
'{
"status": "ok",
"dispatched_to": 1,
"errors": []
}Response when an identifier cannot be reached
The request succeeds with a 200 status, but dispatched_to is 0 and the errors array explains why.
{
"status": "ok",
"dispatched_to": 0,
"errors": [
{
"customer_identifier_type": "email",
"customer_identifier_value": "[email protected]",
"error_message": "No user found for given identifier"
}
]
}API error responses
| Status code | Description | Example response |
|---|---|---|
| 400 Bad Request | A required parameter is missing or malformed. | { "errors": [{ "detail": "Missing customer_identifier_type" }] } |
| 401 Unauthorized | API authentication failed due to an invalid or missing API key. | { "message": "Not authorized" } |
| 403 Forbidden | The API key does not have sufficient permissions. | { "message": "Forbidden" } |
| 404 Not Found | None of the supplied identifiers resolved to a customer. | { "errors": [{ "detail": "No identifiers resolved" }] } |
| 413 Payload Too Large | More than 50 customer identifiers were supplied. | { "errors": [{ "detail": "You can add maximum 50 customer identifiers in one API call" }] } |
| 422 Unprocessable Entity | The account has no push adapter configured. | { "errors": [{ "detail": "No push adapter configured" }] } |
| 429 Too Many Requests | The request limit has been exceeded. | { "message": "Rate limit exceeded" } |
| 500 Internal Server Error | An unexpected server error occurred. | { "errors": [{ "detail": "Delivery failed" }] } |
| 502 Bad Gateway | The server received an invalid response. Retry with exponential backoff. | { "message": "Bad Gateway" } |
| 503 Service Unavailable | The service is temporarily unavailable. Retry with exponential backoff. | { "message": "Service Unavailable" } |
| 504 Gateway Timeout | The server took too long to respond. Retry with exponential backoff. | { "message": "Gateway Timeout" } |
Field reference
Response fields
| Field | Type | Description |
|---|---|---|
status | string | Result of the request. Returns ok when the request was accepted. |
dispatched_to | integer | Number of devices the message was dispatched to. A value of 0 means no device received it; check the errors array. |
errors | array | Per-identifier errors. Empty when every identifier resolved to a device. |
errors[].customer_identifier_type | string | The identifier type supplied in the request. |
errors[].customer_identifier_value | string | The identifier value that could not be reached. |
errors[].error_message | string | Why the identifier could not be reached. |
Error messages in the errors array
| Message | Description |
|---|---|
No user found for given identifier | No customer matches the identifier supplied. |
No device found with a push_to_start_token for the given activity type | The customer exists, but no device has registered for this activity type. The app may not have been opened since installing, or the customer has turned off Live Activities. |
429Rate limit exceeded - Too many requests
502Service unavailable, please retry - Bad Gateway, re-try with exponential backoff
503Service unavailable, please retry - Service Unavailable, re-try with exponential backoff
504Service unavailable, please retry - Gateway Timeout, please re-try with exponential backoff