Skip to content

Audience API

bulkRegisterDevice

Registers multiple devices in Pushwoosh in a single request. It also allows specifying various tags for each device.

POST https://api.pushwoosh.com/api/v2/audience/bulkRegisterDevice

Request parameters

ParameterTypeRequiredDescription
applicationstringYesThe application code for your Pushwoosh account.
authstringYesThe API authentication token.
devicesarrayYesAn array of device objects. Each object represents a device and its associated data. See details in the Device object parameters table below.

Device object parameters

ParameterTypeRequiredDescription
hwidstringYesThe hardware ID or unique identifier for the device.
push_tokenstringYesPush token for the device.
platformintegerYesThe platform identifier. Learn more
list_operatorstringNoDetermines the action for list-type tags:
- “append”: Add the specified value to the tag list.
- “remove”: Remove the specified value from the tag list.
Note: If the list_operator parameter is not specified, all existing values in the tag list will be replaced with the provided values.
tagsobjectNoCustom tags assigned to the device. Tags are key-value pairs used for segmentation.

Request example

{
"application": "application code", // required. Pushwoosh app code
"auth": "Pushwoosh auth token", // required. API access token from Pushwoosh Control Panel
"devices": [{ // required. Array of devices
"hwid": "device hwid", // required. Unique identifier for the device (can be an email).
"push_token": "device push token", // required. Push notification token for the device.
"platform": 14, // required. Device platform (e.g., 14 for email).
"list_operator": "append", // optional. For list tags. Adds or removes the specified value(s) from the tag of list type.
"tags": { // optional. Values to set for the specified tags.
"language": "en", // use correct value type.
"CSV_Import": "summer_camp"
}
},
{
"hwid": "device hwid 2", // required. Unique identifier for the second device.
"push_token": "device push token 2", // required. Push notification token for the device.
"platform": 14, // required. Device platform.
"list_operator": "remove", // optional. Adds or removes values from tags of the list type.
"tags": { // optional. Values to remove from the specified tags.
"language": "en",
"CSV_Import": "summer_camp2"
}
},
{
"hwid": "device hwid 3", // required. Unique identifier for the third device.
"push_token": "device push token 3", // required. Push notification token for the device.
"platform": 14, // required. Device platform.
"tags": { // optional. Values to set for the specified tags.
"language": "en",
"CSV_Import": "summer_camp3"
}
}]
}

Response

The method responds with an operation ID, which can be used to track the status and results of the bulk registration process.

{
"request_id": "request_id to use in GET method to obtain job status",
"status": "Pending"
}

bulkRegisterDevice status

You can check the status of a bulk registration process by making the following GET request:

GET https://api.pushwoosh.com/api/v2/audience/bulkRegisterDevice/{request_id}?detailed=true

ParameterTypeRequiredDescription
request_idstringYesThe request ID returned by the POST request.
detailedbooleanNoIf set to true, the response includes detailed results for each registered device.

Example response

{
"request_id": "9a2e1a14-XXXX-46c3-XXXX-c254b25d3782",
"status": "Completed",
"progress": 100,
"devices_success": 4,
"devices": [
{
"hwid": "user1@example.com",
"status": "done"
},
{
"hwid": "user2@example.com",
"status": "done"
},
{
"hwid": "user3@example.com",
"status": "done"
},
{
"hwid": "invalid_email@example.com",
"status": "failed"
}
]
}

bulkSetTags

POST https://api.pushwoosh.com/api/v2/audience/bulkSetTags

Sets tag values for the list of devices.

Request Body

NameTypeDescription
application*StringPushwoosh app code.
auth*StringAPI access token from Pushwoosh Control Panel.
create_missing_tagsBooleanIf true, missing tags are created automatically.
devices*ObjectArray of devices.
devices.hwidStringCan be used to identify a device instead of user_id or push_token
devices.user_idStringCan be used to identify a user instead of hwid or push_token
devices.push_tokenStringCan be used to identify a device instead of hwid or user_id
devices.list_operatorStringDefines how to set values for tags of the list type: set, append, or remove
devices.tags*ObjectValues to set for the tags specified.
{
"request_id": "request_id to use in GET method to obtain job status",
"status": "Pending"
}
Request:
{
"application": "application code", // required. Pushwoosh app code
"auth": "Pushwoosh auth token", // required. API access token from Pushwoosh Control Panel
"create_missing_tags": false, // optional. Should automatically create missing tags
"devices": [{ // required. Array of devices
"hwid": "device hwid", // optional. Can be used to identify a device instead of
// "user_id" or "push_token".
"user_id": "user ID", // optional. Can be used to identify a user instead of "hwid" or "push_token".
"push_token": "device push token", // optional. Can be used to identify a device instead of "hwid" or "user_id".
"list_operator": "set", // required. For list tags. Defines how to set values for
// tags of the list type: set, append, or remove
"tags": { // required. Values to set for the tags specified.
"tag_name": "tagvalue", // use correct value type
"tag_name2": "tagvalue2"
}
}]
}
Response:
{
"request_id": "request_id to use in GET method to obtain job status",
"status": "Pending"
}

bulkSetTags status

GET https://api.pushwoosh.com/api/v2/audience/bulkSetTags/{request_id}?detailed=false

Returns the status of /bulkSetTags operation

Path Parameters

NameTypeDescription
request_idStringrequest id from previous /bulkSetTags call

Query Parameters

NameTypeDescription
detailedBoolean(true/false) whether to return detailed per-device info
Response:
{
"request_id": "id of the request",
"status": "Completed", // also "Pending", "Failed"
"progress": 100, // jobs progress 0-100
"devices_success": 100, // good devices
"devices_not_found": 0, // devices not found in Pushwoosh
"devices_failed": 0, // errored
"devices": [{ // device report (only in detailed = true)
"hwid": "device hwid",
"status": "done", // also "failed", "not found"
"tags": {
"tagName": "ok",
"tagName2": "tag not found",
"tagName3": "wrong value. expect :string",
}
}]
}