/v1/accounts/{accountId}/contactLists/{contactListId}/numbers/uploadAdds the numbers of a CSV (comma-separated values) file, with their variable values, to a contact list. This is the most efficient way to add a large number of numbers.
Each row of the file contains a number in the first column, followed by the values of its variables. For example, a file with 2 variables:
5550001,John,199
5550002,Mary,299
5550003,Susan,149
The first column can contain several numbers for the same contact, separated by semicolons. Invalid numbers are skipped, and reported in the response. A number with the same variable values as an existing one is skipped too. A row with a wrong number of columns makes the whole request fail with 400 Bad Request, indicating the line with the problem.
The first numbers added to the contact list define its variables. Later uploads must have the same number of variable columns, and if varNames is included, the names must match the existing ones.
ID of your SIP Caller account. See Account ID.
ID of the contact list.
Whether the first row of the file contains column names, and must be skipped.
Number of variable columns after the number column, between 0 and 20.
Names of the variable columns, in order, such as ["Customer Name","Due Balance"]. When included, it must contain varCount names.
Character encoding of the file. Defaults to UTF8. Other common values are LATIN1 and windows-1252.
A multipart/form-data body with the file. Several files can be uploaded in the same request.
Returns an array with one result for each file uploaded:
Name of the uploaded file.
Number of rows read from the file.
Number of numbers added.
Number of rows skipped, because the number was invalid or duplicated.
Up to 10 of the invalid numbers found in the file, to help you find the problem.
/v1/accounts/ACCOUNT_ID/contactLists/CONTACT_LIST_ID/numbers/upload
curl -X POST 'https://api.sipcaller.com/v1/accounts/ACCOUNT_ID/contactLists/CONTACT_LIST_ID/numbers/upload?firstRowIsHeader=true&varCount=2&varNames=%5B%22Customer%20Name%22%2C%22Due%20Balance%22%5D' \
-H 'Authorization: Bearer API_KEY_TOKEN' \
-F 'file=@contact-list-numbers.csv;type=text/csv'Response
200 OK
[
{
"fileName": "contact-list-numbers.csv",
"totalNumbers": 1255,
"numbersAdded": 1254,
"numbersSkipped": 1,
"firstInvalidNumbers": [
"55A0012"
]
}
]