Upload your outbound voice rates
const url = 'https://api.siprtc.io/v1/Accounts/example/Rates/Upload';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST', headers: {Authorization: 'Basic <credentials>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.siprtc.io/v1/Accounts/example/Rates/Upload \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: multipart/form-data' \ --form file=@fileUploads a CSV of outbound voice rates that become your account’s own rate plan, used to rate your outbound calls ahead of your vendor’s default plan. The upload replaces all your previous own rates; destinations whose prefix is not in the file then have no rate, so the file should cover every destination you call. The CSV needs a header row with at least prefix (digits, + allowed), country_iso (two letters) and rate (US dollars per minute, 0 or more); country, country_code, initial_pulse and sub_pulse (seconds, 1 to 3600, default 60) are optional. Aliases dial_prefix, iso, cc, rate_per_minute, usd_per_minute and *_in_seconds are accepted. Up to 50,000 rows; a duplicate prefix or bad value rejects the whole file with the line number.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your account Auth ID (20 characters). The request always acts on the authenticated account.
Request Bodyrequired
Section titled “ Request Bodyrequired ”object
CSV file of rates
Responses
Section titled “ Responses ”OK
object
ID of the account’s own rate plan.
How many rates the file held; they replace all the account’s previous own rates.
Always “success”.
Example
{ "plan_id": 117, "rates": 245, "status": "success"}No file field, unreadable file, or a CSV error such as ‘line 12: prefix 44x is not digits’
object
What went wrong, in plain words.
Always “failed”.
Example
{ "message": "trunk not found", "status": "failed"}Missing or wrong Auth ID / Auth Secret (answered by the API gateway)
Example generated
exampleSigned in as a sub-user (portal login) rather than the account owner: only the owner can change rates
object
What went wrong, in plain words.
Always “failed”.
Example
{ "message": "trunk not found", "status": "failed"}The rates could not be saved
object
What went wrong, in plain words.
Always “failed”.
Example
{ "message": "trunk not found", "status": "failed"}The account’s vendor could not be looked up
object
What went wrong, in plain words.
Always “failed”.
Example
{ "message": "trunk not found", "status": "failed"}