Batch adding participants to loyalty program
Description
Adds multiple participants to a loyalty program in a single request. Before adding, each profile is looked up using the selected matching method: email, phone, profile ID, or custom field.
caution
In one request it is not recommended:
- transfer more than 10,000 profiles;
- transfer more than 10 MB of data. It is possible to transfer more data using multiple streams.
URL
Method: POST
https://example.com/api/v1.1/loyalty/register_member_batch
Request parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| token | string | "abc123def456" | Yes | API token |
| loyalty_program_id | int | 123 | Yes | Loyalty program identifier |
| matching | string | "email" | Yes | Profile lookup method: email, phone, profile_id, custom |
| data | array | [{"email": "user@example.com"}] | Yes | Array of participants to add |
data array
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| string | "user@example.com" | Yes, if matching = email | Email for profile lookup | |
| phone | string | "+1234567890" | Yes, if matching = phone | Phone number in international format |
| profile_id | string | "profile123" | Yes, if matching = profile_id | Profile identifier |
| field_name | string | "user_id" | Yes, if matching = custom | Custom field name |
| field_value | string / int | "123456" | Yes, if matching = custom | Custom field value |
| registration_date | string | "2024-09-01T12:34:56Z" | No | Registration date in RFC3339 format |
Request example
- JSON
- XML
{
"token": "abc123def456",
"loyalty_program_id": 123,
"matching": "email",
"data": [
{
"email": "user1@example.com",
"registration_date": "2024-09-01T12:34:56Z"
},
{
"email": "user2@example.com"
}
]
}
<xml>
<token>abc123def456</token>
<loyalty_program_id>123</loyalty_program_id>
<matching>email</matching>
<data>
<item>
<email>user1@example.com</email>
<registration_date>2024-09-01T12:34:56Z</registration_date>
</item>
<item>
<email>user2@example.com</email>
</item>
</data>
</xml>
Response example
- JSON
- XML
{
"error": 0,
"error_text": "Successful operation",
"result": [
{
"error": 0,
"error_text": "Successful operation",
"profile_id": "663a138cee44bb50a67115cd"
},
{
"error": 409,
"error_text": "Member already exists",
"profile_id": "69df4fd5ff232800e2d1e2d6"
},
{
"error": 404,
"error_text": "Profile not found",
"profile_id": null
}
]
}
<xml>
<error>0</error>
<error_text>Successful operation</error_text>
<result>
<item>
<error>0</error>
<error_text>Successful operation</error_text>
<profile_id>663a138cee44bb50a67115cd</profile_id>
</item>
<item>
<error>409</error>
<error_text>Member already exists</error_text>
<profile_id>69df4fd5ff232800e2d1e2d6</profile_id>
</item>
<item>
<error>404</error>
<error_text>Profile not found</error_text>
<profile_id />
</item>
</result>
</xml>
Response parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code (0 — successful operation) |
| error_text | string | Error description |
| result | array | Array of results for each participant |
result element parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code for the specific participant |
| error_text | string | Error description for the specific participant |
| profile_id | string | Profile identifier (null on error) |
Error codes in result
| Code | Description |
|---|---|
| 0 | Successfully added |
| 404 | Profile not found |
| 409 | Member already exists in the loyalty program |