Start a Live Activity

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.
  • API - Select 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 bsftActivityId for each activity. It goes inside activity_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_state property names must match your app. They must exactly match the ContentState your app defines. A mismatch is not reported as an error: the API returns a success response and the device discards the content.
  • activity_attributes_type must match the name your app registers. This is the name passed to registerPushToStart in your app.
  • A 200 response means the push was dispatched, not displayed. Check dispatched_to and the errors array in the response. A dispatched_to of 0 means no device received the message.
  • You can include up to 50 customer identifiers per call. More than 50 returns a 413 Payload Too Large error.
  • 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

ParameterTypeRequiredDescription
customer_identifier_typestring✅ YesType of identifier used in customer_identifiers. One of customer_id, email, or phone_number.
customer_identifiersstring[]✅ YesIdentifier values. Maximum 50 per call.
activity_attributes_typestring✅ YesName of the activity design, matching the name your app registers with registerPushToStart.
activity_attributesobject✅ YesStatic attributes that do not change for the life of the activity. Must include bsftActivityId.
content_stateobject✅ YesDynamic content shown in the activity. Property names must match the ContentState defined in your app.
notificationobject✅ YesAlert shown when the activity starts. Accepts title and body.
stale_datestring❌ NoISO 8601 timestamp after which the content is considered out of date. Must be in the future.

activity_attributes

ParameterTypeRequiredDescription
bsftActivityIdstring✅ YesYour 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 codeDescriptionExample response
400 Bad RequestA required parameter is missing or malformed.{ "errors": [{ "detail": "Missing customer_identifier_type" }] }
401 UnauthorizedAPI authentication failed due to an invalid or missing API key.{ "message": "Not authorized" }
403 ForbiddenThe API key does not have sufficient permissions.{ "message": "Forbidden" }
404 Not FoundNone of the supplied identifiers resolved to a customer.{ "errors": [{ "detail": "No identifiers resolved" }] }
413 Payload Too LargeMore than 50 customer identifiers were supplied.{ "errors": [{ "detail": "You can add maximum 50 customer identifiers in one API call" }] }
422 Unprocessable EntityThe account has no push adapter configured.{ "errors": [{ "detail": "No push adapter configured" }] }
429 Too Many RequestsThe request limit has been exceeded.{ "message": "Rate limit exceeded" }
500 Internal Server ErrorAn unexpected server error occurred.{ "errors": [{ "detail": "Delivery failed" }] }
502 Bad GatewayThe server received an invalid response. Retry with exponential backoff.{ "message": "Bad Gateway" }
503 Service UnavailableThe service is temporarily unavailable. Retry with exponential backoff.{ "message": "Service Unavailable" }
504 Gateway TimeoutThe server took too long to respond. Retry with exponential backoff.{ "message": "Gateway Timeout" }

Field reference

Response fields
FieldTypeDescription
statusstringResult of the request. Returns ok when the request was accepted.
dispatched_tointegerNumber of devices the message was dispatched to. A value of 0 means no device received it; check the errors array.
errorsarrayPer-identifier errors. Empty when every identifier resolved to a device.
errors[].customer_identifier_typestringThe identifier type supplied in the request.
errors[].customer_identifier_valuestringThe identifier value that could not be reached.
errors[].error_messagestringWhy the identifier could not be reached.
Error messages in the errors array
MessageDescription
No user found for given identifierNo customer matches the identifier supplied.
No device found with a push_to_start_token for the given activity typeThe 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.

Body Params
string
enum
required

Type of identifier used in customer_identifiers.

Allowed:
customer_identifiers
array of strings
required

Identifier values. Maximum 50 per call.

customer_identifiers*
string
required

Name of the activity design, matching the name your app registers with registerPushToStart.

activity_attributes
object
required

Static attributes that do not change for the life of the activity. Must include bsftActivityId, a unique identifier for this activity for this customer.

content_state
object
required

Dynamic content shown in the activity. The property names must exactly match the ContentState defined in your app. A mismatch is not reported as an error and the device discards the update.

notification
object
required

Alert shown when the activity starts.

date-time

ISO 8601 timestamp after which the content is considered out of date. Must be in the future.

Responses

429

Rate limit exceeded - Too many requests

502

Service unavailable, please retry - Bad Gateway, re-try with exponential backoff

503

Service unavailable, please retry - Service Unavailable, re-try with exponential backoff

504

Service unavailable, please retry - Gateway Timeout, please re-try with exponential backoff

Language
Credentials
Basic
base64
:
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json