Add profile to database
tip
The request does not look for existing records and adds any data other than those that duplicate the profile's unique field (email). We recommend using the Import profile request in most cases.
Description
Adds a new customer profile to a database.
caution
If no data is specified — an empty profile will be created.
Data field rules
- The field value must be valid for the field type: numeric fields accept a number, "list" fields accept a variant name from the list or its ordinal number, etc. If the value does not match the field type (for example, a string that is not in the list of variants is passed to a list field), the request returns an error. Value formats for custom fields are listed in the Custom field value formats section.
- The
dataparameter should contain only the fields that need to be filled in. If a profile field should remain unchanged, do not pass it in the request. - For more flexible field value management, use database fields functional update.
Request URL
Method: POST
https://example.com/api/v1.1/profiles/add
Request parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| db_id | int | 1 | Yes | Database ID |
| data | JSON object | { | Yes | Profile fields data |
| skip_triggers | bool | true | No | Skip import trigger events. By default – false |
| skip_invalid_subscriptions | bool | true | No | Skip invalid subscriptions. By default – false |
Request example
- JSON
- XML
{
"db_id": 1,
"data": {
"_fname": "Fillipp",
"_lname": "Doe"
},
"skip_triggers": true
}
<xml>
<db_id>1</db_id>
<skip_triggers>true</skip_triggers>
<data>
<_fname>Fillipp</_fname>
<_lname>Doe</_lname>
</data>
</xml>
Response example
- JSON
- XML
{
"error": 0,
"error_text": "",
"profile_id": "6638e1e8ee44bb50a67115c4"
}
<xml>
<error>0</error>
<error_text>Successful operation</error_text>
<profile_id>6638e1e8ee44bb50a67115c4</profile_id>
</xml>
Response parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code |
| error_text | string | Error text |