Task for batch add participants to loyalty program
Description
Starts an asynchronous task for bulk adding participants to a loyalty program. Returns a task_id that can be used to track task status and retrieve results.
caution
A single request should not:
- Exceed 10,000 profiles;
- Exceed 10 MB of data. Larger volumes can be sent in multiple streams.
URL
Method: POST
https://example.com/api/v1.1/loyalty/register_member_batch_task
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 |
| task_id | string | "199b9c75-c540-455e-9e38-3d54e51e1d7a" | No (required for subsequent batches) | Existing task identifier |
| next_key | string | "abc123" | No | Pagination key for adding the next batch |
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",
"task_id": "199b9c75-c540-455e-9e38-3d54e51e1d7a"
}
<xml>
<error>0</error>
<error_text>Successful operation</error_text>
<task_id>199b9c75-c540-455e-9e38-3d54e51e1d7a</task_id>
</xml>
Response parameters
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code (0 — successful operation) |
| error_text | string | Error description |
| task_id | string | Asynchronous task identifier |