Skip to main content

Update multiple profiles

Description

Updates (only) multiple profiles to or in a database.

info

If you pass the status and priority parameters of the subscriptions object with a value of 0, then the value is taken into account.

In order not to change or update the values of these parameters, do not pass them, or set the values to -1.

caution

In one request it is not recommended:

  • transfer more than 10,000 profiles;
  • transfer more than 10 MB of data. It is possible totransfer more data using multiple streams.

Request URL

Method: POST

https://example.com/api/v1.1/profiles/update_batch

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
dataJSON array

[    {       "_fname": "John",       "_lname": "Doe",       "custom_id": "abcdefghijklmnqrstuvwxyz",       "email": "john@example.com",       "subscriptions": [          {              "channel": "email",              "email_data": {                  "email": "john@example.com"              },             "resource_id": 1          }       ]    } ]

YesProfile fields data
db_idint1YesDatabase ID
skip_invalid_subscriptionsbooltrueNoSkip invalid subscriptions.
By default – false
Profile matching mode
matchingstring"email"
"email_profile"
"email_sub"
"phone"
"phone_sub"
"profile_id"
"push_sub"
"custom"
"custom_sub"
"email_phone"
"email_phone_sub"
No, if matched by emailProfile 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.
emailstring"john@example.com""matching":"email"Email address
phonestring"+79000000000""matching":"phone"Phone number
profile_idstring"abcdefghijklmnqrstuvwxyz""matching":"profile_id"Profile ID
field_namestring"CRM_ID""matching":"custom"Custom profile data field name
field_valueint/string"123420""matching":"custom"

Custom profile data field value.

tip

Searching by combination of tags is available for tag type profile fields. Values are recorded as a string: "tag-1, tag-2".

resource_idint24NoResource ID for email and phone matching

Subscriptions array

The subscriptions array stores data about the profile's subscriptions to resources. One object is one subscription.

ParameterTypeExampleDescription
resource_idint1Resource ID
statusstring"subscribed"Subscription status

It is recommended to pass the parameter in the request only in cases where it is necessary to update the subscription status.

priorityint1Subscription priority
custom_fieldsobject
{
   "_browser_name": "Chrome",
   "_device_type": "web"
}
System and custom subscription fields.

You can get information about available subscription fields in a resource using the /v1.1/resources/fields_get method
catsarray
[
   "category_1",
   "category_2"
]
Resource categories to which to subscribe the profile.
Email channel
channelstring"email"Channel type
emailstring"john@example.com"Email
SMS channel
channelstring"sms"Channel type
phonestring"+79000000000"Phone number
Push channel
channelstring"push"Channel type
providerstring"Firefox"Provider type
subscription_idstring"abcdefghijklmnqrstuvwxyz"Subscription ID
Telegram Bot channel
channelstring"telegram_bot"Channel type
cc_dataobject
{
   "id": 1
}
Telegram Bot chat ID
WhatsApp channel
channelstring"whatsapp"Channel type
cc_dataobject
{
   "phone": "+79000000000"
}
Profile phone number on WhatsApp
Viber channel
channelstring"viber"Channel type
cc_dataobject
{
   "phone": "+79000000000"
}
Profile phone number on Viber

Request example

{
"data": [
{
"_fname": "John",
"_lname": "Doe",
"custom_id": "abcdefghijklmnqrstuvwxyz",
"email": "jane@example.com",
"subscriptions": [
{
"channel": "email",
"email_data": {
"email": "john@example.com"
},
"resource_id": 1,
"custom_fields": {
"_browser_name": "Firefox",
"_device_type": "web",
"custom_field_1": "test value"
},
"cats": [
"category_1",
"category_2"
]
}
]
}
],
"db_id": 1,
"field_name": "CustomID",
"field_value": 13,
"matching": "custom",
"skip_triggers": true,
"token": "abcdefghijklmnqrstuvwxyz"
}

Response example

{
"error": 0,
"error_text": "Successful operation",
"result": [
{
"error": 0,
"error_text": "Successful operation",
"profile_id": "abcdefghijklmnqrstuvwxyz"
}
]
}

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError text
profile_idstringProfile ID