Request URL
POST https://app.sms.by/api/v2/importContacts
You can import no more than 500 contacts per call and the number of custom fields must not exceed 30. Custom fields must include phone or email.
If the list already contains a contact with the transferred phone number or email address, such a contact will not be added again, but its parameters, which are transferred in field_names, will be updated.
For example, let's add 2 contacts with the custom fields phone, email and name to the mailing list. The request will look like this:
https://app.sms.by/api/v2/importContacts?token=***&list_id=123&field_names[0]=phone&field_names[1]=email&field_names[2]=name&data[0][0]=375291111111&data[0][1] =email1@example.by &data[0][2]=Alexey&data[1][0]=375291111112&data[1][1] =email2@example.by &data[1][2]=Irina
In the response, in the result field, the method will return an array with the following data:
inserted - how many new contacts were added to the list,
updated - how many contacts were changed,
invalid - how many contacts were not imported,
log - import errors and warnings. If the number of invalid is greater than 0, it will contain an array with the following data: index - contact number in the data array, error_message - error description.
Parameters
| Parameter |
Location |
Type |
Required |
Description |
| token |
query |
string |
Yes |
Your API key |
| list_id |
query |
integer |
Yes |
Mailing list ID |
| field_names[0] |
query |
string |
Yes |
Name of the first custom field |
| field_names[1] |
query |
string |
No |
Name of the second custom field |
| field_names[2] |
query |
string |
No |
Name of the third custom field |
| data[0][0] |
query |
string |
Yes |
First parameter for first contact |
| data[0][1] |
query |
string |
No |
Second parameter for first contact |
| data[0][2] |
query |
string |
No |
Third parameter for first contact |
| data[1][0] |
query |
string |
No |
First parameter for the second contact |
| data[1][1] |
query |
string |
No |
Second parameter for the second contact |
| data[1][2] |
query |
string |
No |
Third parameter for the second contact |
Responses
200 — Completed successfully
{
"status": "OK",
"result": {
"inserted": 10,
"updated": 5,
"invalid": 1,
"log": [
{
"index": 13,
"error_message": "Incorrect phone number"
}
]
}
}