/v1/accounts/{accountId}/campaigns/{campaignId}/numbers/uploadAdds the numbers of a CSV (comma-separated values) file to a campaign. 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 row with a wrong number of columns makes the whole request fail with 400 Bad Request, indicating the line with the problem.
Numbers can be added to campaigns in Draft state, and to Active or Paused campaigns with Dynamic number provisioning. Other campaigns return 409 Conflict.
Duplicates are handled differently depending on the state of the campaign. In Draft campaigns, a number with the same variable values as an existing one is skipped (the same number can be added again with different values). In Active or Paused campaigns, every number sent is added, even if it already exists, since it's considered a new call to make, for example to contact the same customer again.
ID of your SIP Caller account. See Account ID.
ID of the campaign.
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, up to 100 MB. 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/campaigns/CAMPAIGN_ID/numbers/upload
curl -X POST 'https://api.sipcaller.com/v1/accounts/ACCOUNT_ID/campaigns/CAMPAIGN_ID/numbers/upload?firstRowIsHeader=false&varCount=2&varNames=%5B%22Customer%20Name%22%2C%22Due%20Balance%22%5D' \
-H 'Authorization: Bearer API_KEY_TOKEN' \
-F 'file=@campaign-numbers.csv;type=text/csv'Response
200 OK
[
{
"fileName": "campaign-numbers.csv",
"totalNumbers": 5000,
"numbersAdded": 4997,
"numbersSkipped": 3,
"firstInvalidNumbers": [
"55A0012",
"12"
]
}
]