Import profile
Description
Imports a customer profile. It also can be used to update an existing profile.
Can delete custom fields, add or delete tags, increase or decrease field values. See update functions for reference.
tip
To launch a trigger campaign right after the import you can use Import + trigger request.
Request URL
Method: POST
https://example.com/api/v1.1/profiles/import
Request parameters
caution
- For JSON body use the following header: Content-Type: application/json.
- For XML body use the following header: Content-Type: application/xml.
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
db_id | int | 1 | Yes | Database ID |
matching | string | "email" "email_profile" "email_sub" "phone" "phone_sub" "profile_id" "push_sub" "custom" "custom_sub" "email_phone" "email_phone_sub" | No, if matched by email | Profile matching mode By default — email For each type of matching, certain fields must be passed in the request body. Learn more about these fields here. |
skip_triggers | bool | true | No | Skip trigger events. By default – false |
skip_invalid_subscriptions | bool | true | No | Skip invalid subscriptions By default – false |
detect_geo | bool | true | No | Detect location by _regip or _ip from data object |
add_to_segments | array | [1, 2] | No | Add a profile to a segment |
remove_from_segments | array | [1, 2] | No | Remove a profile from a segment |
data | JSON object | { | Yes | Profile fields data, including resource subscription data ( subscriptions ) |
Subscriptions array
The subscriptions
array stores data about the profile's subscriptions to resources. One object is one subscription.
Parameter | Type | Example | Description |
---|---|---|---|
resource_id | int | 1 | Resource ID |
status | string | "subscribed" | Subscription status |
priority | int | 1 | Subscription priority If the subscription priority is passed in the request, the "Increase priority for new subscriptions" option in the resource does not work. |
custom_fields | object | { | System and custom subscription fields. You can get information about available subscription fields in a resource using the /v1.1/resources/fields_get method |
cats | array | [ | Resource categories to which to subscribe the profile. |
Email channel | |||
channel | string | "email" | Channel type |
string | "john@example.com" | ||
SMS channel | |||
channel | string | "sms" | Channel type |
phone | string | "+79000000000" | Phone number |
Push channel | |||
channel | string | "push" | Channel type |
provider | string | "Firefox" | Provider type |
subscription_id | string | "abcdefghijklmnqrstuvwxyz" | Subscription ID |
Telegram Bot channel | |||
channel | string | "telegram_bot" | Channel type |
cc_data | object | { | Telegram Bot chat ID |
WhatsApp* channel | |||
channel | string | "whatsapp" | Channel type |
cc_data | object | { | Profile phone number on WhatsApp* |
Viber channel | |||
channel | string | "viber" | Channel type |
cc_data | object | { | Profile phone number on Viber |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"matching": "email",
"email": "example@example.com",
"detect_geo": true,
"data": {
"_fname": "Olly",
"_lname": "Lambert",
"email": "example@example.com",
"phones": ["+79000000000"],
"subscriptions": [
{
"channel": "email",
"email": "example@example.com",
"resource_id": 2,
"custom_fields": {
"_browser_name": "Firefox",
"_device_type": "web",
"custom_field_1": "test value"
},
"cats": [
"category_1",
"category_2"
]
},
{
"channel": "sms",
"phone": "+79000000000",
"resource_id": 1
},
{
"channel": "push",
"subscription_id": "a81c264a938b475",
"provider": "android-firebase",
"resource_id": 1
},
{
"channel": "telegram_bot",
"cc_data": {"user_chat_id"}
},
{
"channel": "whatsapp",
"cc_data": {"user_phone"}
},
{
"channel": "viber",
"cc_data": {"user_phone"}
}
],
"_bdate": "1990-02-22T21:00:00Z",
"_sex": 0,
"_regdate": "2019-03-14T22:00:00Z",
"_regip": "94.231.119.122",
"_ip": "94.231.119.122",
"_tz": "Europe/Moscow",
"_postal_code": "390000",
"_os": "Windows 10",
"_browser": "Firefox",
"_vendor": "form_#31",
"custom_field": "custom_value"
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<detect_geo>true</detect_geo>
<email>example@example.com</email>
<matching>email</matching>
<data>
<_bdate>1990-07-06</_bdate>
<_browser>Firefox</_browser>
<_fname>FirstName</_fname>
<_ip>192.168.0.179</_ip>
<_lname>LastName</_lname>
<_os>Windows 10</_os>
<_postal_code>1230000</_postal_code>
<_regdate>2023-07-06</_regdate>
<_sex>female</_sex>
<_vendor>9</_vendor>
<email>example@example.com</email>
<phones>+79511059000</phones>
<subscriptions array='true'>
<email>example@example.com</email>
<channel>email</channel>
<resource_id>29</resource_id>
</subscriptions>
<subscriptions>
<email>example@example.com</email>
<channel>email</channel>
<resource_id>28</resource_id>
</subscriptions>
</data>
</xml>
Response example
- JSON
- XML
{
"error": 0,
"error_text": "Successful operation",
"profile_id": "54759eb3c090d83494e2d804"
}
<xml>
<error>0</error>
<error_text>Successful operation</error_text>
<profile_id>c1are24fu213lwith21that2axe9<profile_id>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
profile_id | string | Profile ID |
*The Meta organization, which owns Instagram, Facebook and WhatsApp products, has been declared as extremist and banned in Russia.