Import Audience (REST API)
Method Objective
The method allows importing audiences both in the general list and in a separate segment.
Request
Endpoint | Request Type | Content-Type | Rate Limit | Max Data Size |
|---|---|---|---|---|
https://api.personaclick.com/import/audience | POST | application/json | 40 requests/minute 1 request/1.5seconds | 32 MB/request |
Exceeding the limit will result in a 429 "Too Many Requests" HTTP error. The request can be repeated after the rate limit period.
Parameters
Name | Type | Requirement | Description |
|---|---|---|---|
shop_id | string | required | Unique Store Key in PersonaClick. Located there: Account > Settings > Store Settings |
shop_secret | string | required | Store Secret Key in PersonaClick. Located there: Account > Settings > Store Settings |
segment_id | number | optionally | The ID of the static segment. It's available there: Account > CRM > Segments. If not specified, the audience will be imported into the general list. |
audience | Array | required | Object array with the imported audience. See the description below. |
webhook | string | optionally | The webhook URL to which a request will be sent upon successful or failed import. This is a POST request with "Content-Type: application/json" and with a body in case of success: {
"status":"success"
}or in case of failure: {
"status":"error",
"message":"ERROR MESSAGE"
} |
Audience Object
Main parameters
Name | Type | Description |
|---|---|---|
string | User Email. This parameter is used as an identifier, so it's required (if the "phone" parameter isn't used). | |
first_name | string | User First Name. |
gender | string | User Gender (m – male, f – female). |
external_id | number/string | Store side user ID. |
last_name | string | User Surname. |
phone | string | User phone in full international format. This parameter is used as an identifier, so it's required (if the "email" parameter isn't used). A phone number in full international format may begin with a plus sign (+) followed by the country code, city (area) code, and phone number. |
Additional parameters
Name | Type | Description |
|---|---|---|
age | number | User age (in years). |
auto | Object array | List of vehicles. See description below. |
birthday | string | User birthday in the format YYYY-MM-DD. |
bought_something | boolean | The user has or hasn't ever bought something in the store. |
email_bulk | boolean | Subscribe user to email bulk campaigns. |
email_chain | boolean | Subscribe user to email trigger campaigns. |
email_transactional | boolean | Subscribe user to email transactional campaigns. It's recommended that always use the "true" value, even if you don't use transactional messages. |
fb_id | string | Facebook User ID. |
kids | Object array | User's children. See description below. |
location | string | The user's current location from the list of locations in the product feed. |
loyalty_bonuses | number | The current number of store bonuses at the user. |
loyalty_bonuses_to_next_level | number | The number of store bonuses necessary for the user to reach the next loyalty level. |
loyalty_card_location | string | The location (from the list of locations in the product feed) where the user last used the loyalty card. |
loyalty_id | string | The Loyalty Program user ID (loyalty card). |
loyalty_status | string | The user's current status in the loyalty program. |
mobile_token | string | The mobile push token of the user's device. |
mobile_token_platform | string | Token platform. Available values:
|
sms_bulk | boolean | Subscribe user to SMS bulk campaigns. |
sms_chain | boolean | Subscribe user to SMS trigger campaigns. |
sms_transactional | boolean | Subscribe user to SMS transactional campaigns. It's recommended that always use the "true" value, even if you don't use transactional messages. |
telegram_id | string | Telegram User ID. |
vk_id | string | VKontakte User ID. |
The "auto" object properties
Name | Type | Description |
|---|---|---|
brand | string | Vehicle Brand. |
model | string | Vehicle Model. |
vds | string | Vehicle's VDS/VIN. |
The "kids" object properties
Name | Type | Description |
|---|---|---|
gender | string | Child's age (m – male, f – female). |
birthday | string | Child's birthday in the format YYYY-MM-DD. |
Custom Properties
Name | Type | Description |
|---|---|---|
A custom property can have any name except the reserved ones | string | The custom property must be created before it can be used. Located there: Account > Settings > Profile Property If property creation isn't available in the account, contact PersonaClick support. |
integer | ||
float | ||
array | ||
array of string | ||
json | ||
date (YYYY-MM-DD hh:mm:ss) |
API Response Code
HTTP status code | Description |
|---|---|
200 OK | The request was successful. |
400 Bad Request | Unsuccessful authorization. |
While working with the API, you may encounter typical situations with HTTP status codes from the following groups: 4xx “Client Error” and 5xx “Server Error”.
If you receive an HTTP status code from the 4xx “Client Error” group, you should check the request data for correctness or resend the request if the error is related to exceeding limits.
If you receive an HTTP status code from the 5xx “Server Error” group, you should postpone the execution of requests for 10-15 minutes. If the period is longer, please contact Personaclick support.
Request Example
curl 'https://api.personaclick.com/import/audience' \
-X 'POST' \
-H 'content-type: application/json' \
--data-binary '@data.json'
# data.json
{
"shop_id": "0d42fd8b713d0752776ca589cc0056",
"shop_secret": "0123456789abcdef0123456789abcdef",
"segment_id": 146,
"audience": [
{
"email": "john.doe@examplemail.com",
"loyalty_id": "000001234567",
"phone": "+4400114527199",
"id": "100500",
"fb_id": "000000000354677",
"vk_id": "vk031845",
"telegram_id": "0125762968357835",
"loyalty_card_location": "NY",
"loyalty_status": "5% discount",
"loyalty_bonuses": 1123,
"loyalty_bonuses_to_next_level": 1877,
"gender": "m",
"location": "NY",
"first_name": "John",
"last_name": "Doe",
"age": 31,
"birthday": "1990-03-11",
"bought_something": true,
"email_bulk": true,
"email_chain": true,
"email_transactional": true,
"sms_bulk": true,
"sms_chain": true,
"sms_transactional": true,
"auto": [
{
"brand": "Nissan",
"model": "Qashqai",
"vds": "TM7N243E4G0BJG978"
},
{
"brand": "Toyota",
"model": "Corolla",
"vds": "987655431"
}
],
"kids": [
{
"birthday": "2015-07-28",
"gender": "f"
},
{
"birthday": "2001-04-12",
"gender": "m"
}
],
"custom_string_property": "the string value of the custom property",
"custom_integer_property": 100500,
"custom_float_property": 7.62,
"custom_array_of_string_property": ["value1","value2","value3"],
"custom_json_property": {"key1":"value1","key2":"value2","key3":"value3"},
"custom_date_property": "2021-12-31 23:55:00"
},
{
# the next user's data
},
{
# the next user's data
}
]
}Page Navigation
Related Pages