Page tree

Description

Imports or updates a customer profile.

Can delete custom fields, add or delete tags, increase or decrease field values. See update functions for reference.

To launch a trigger campaign right after the import you can use Import+trigger request.

Request URL

Method: POST

Add or update a profile:

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

Update only:

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

Request parameters

  • For JSON body use the following header: Content-Type: application/json.
  • For XML body use the following header: Content-Type: application/xml.
ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI тtoken
db_idint1YesDatabase ID
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 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_triggersbooltrueNoSkip trigger events.
By default – false
skip_invalid_subscriptionsbooltrueNoSkip invalid subscriptions
By default – false
detect_geobooltrueNo

Detect location by _regip or _ip from data object

add_to_segmentsarray
 
[
    1,
    2
]
NoAdd a profile to a segment

remove_from_segments

array
[
    1,
    2
]
NoRemove a profile from a segment
dataJSON object
{
    "_fname": "John",
    "_lname": "Doe"
}
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_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.

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

JSON request example

{
     "token": "91f1dfa81c264a938b475677c60ce967",
     "db_id": 1,
     "matching": "email",
     "email": "example@example.com",
     "detect_geo": true,
     "data": {
 
        "_fname": "Olly",
        "_lname": "Lambert",
 
        "email": "example@example.com",
        "phones": ["+790000000000"],
 
        "subscriptions": [
            {
                "channel": "email",
                "email": "example@example.com",
                "resource_id": 1
            },
            {
                "channel": "phone",
                "phone": "+790000000000",
                "resource_id": 1
            }
        ],
 
        "_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"
    }
}

JSON response example

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

XML request example

<xml>
<token>e923e55afc3e4e07bd64afb2227f8a5c</token>
<db_id>8</db_id>
<matching>email</matching>
<detect_geo>true</detect_geo>
<format>xml</format>
<skip_triggers>false</skip_triggers>
<data>
		<email>example@example.org</email>
		<_fname>Leonid</_fname>
		<_lname>Spartov</_lname>
		<_bdate>1990-02-22T21:00:00Z</_bdate>
		<_sex>M</_sex>
		<_regip>94.231.119.122</_regip>
		<custom_string>value</custom_string>
		<custom_integer>42</custom_integer>
		<custom_date>1990-02-22T21:00:00Z</custom_date>
		<cutom_tags>tag1, tag2</cutom_tags>
		<custom_boolean>true</custom_boolean>
		<custom_enum>2</custom_enum>
		<custom_ip>94.231.119.122</custom_ip>
		<subscriptions>
			<subscription>
				<resource_id>3</resource_id>
				<channel>email</channel>
				<email>example@example.org</email>
			</subscription>
			<subscription>
				<resource_id>3</resource_id>
				<channel>sms</channel>
				<phone>71234567890</phone>
			</subscription>
			<subscription>
				<resource_id>3</resource_id>
				<channel>push</channel>
				<subscription_id>ONEOF77THESE11DAYS11dd1</subscription_id>
				<provider>Chrome</provider>
			</subscription>
		</subscriptions>
	</data>
</xml>

XML response example

<result>
    <error>0</error>
    <error_text>Successful operation</error_text>
	<profile_id>c1are24fu213lwith21that2axe9<profile_id>
</result>

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError text
profile_idstringProfile ID
  • No labels