Latest Legacy

Retrieve pricing for a country

Retrieves pricing for a specified country.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/Pricing/

Arguments

country_iso required string

The two-character country ISO code — for example, US for United States.

Returns

The Pricing object.

Response

HTTP Status Code: 200

{
   "api_id":"7ff5505c-93ca-11e7-9bde-024427e23b8a",
   "country":"United States",
   "country_code":1,
   "country_iso":"US",
   "message":{
      "inbound":{
         "rate":"0.00000"
      },
      "outbound":{
         "rate":"0.00350"
      },
      "outbound_networks_list":[
         {
            "group_name":"US",
            "rate":"0.00350"
         },
         {
            "group_name":"United States - AT&T Mobility",
            "rate":"0.00350"
         }
      ]
   },
   "phone_numbers":{
      "local":{
         "rate":"0.80000"
      },
      "tollfree":{
         "rate":"1.00000"
      }
   },
   "voice":{
      "inbound":{
         "ip":{
            "rate":"0.00300"
         },
         "local":{
            "rate":"0.00850"
         },
         "tollfree":{
            "rate":"0.02100"
         }
      },
      "outbound":{
         "ip":{
            "rate":"0.00300"
         },
         "local":{
            "rate":"0.00750"
         },
         "rates":[
            {
               "prefix":[
                  "1"
               ],
               "origination_prefix":[
                  "" // blank string represents default rate
               ],
               "rate":"0.00750"
            },
            {
               "prefix":[
                  "1"
               ],
               "origination_prefix":[
                  "1232", "1434", "1652"
               ],
               "rate":"0.0150"
            }
         ],
         "tollfree":{
            "rate":null
         }
      }
   }
}

Example Request

1
2
3
4
5
6
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.pricing.get(
    country_iso='GB', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Example for Pricing Get
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.pricings.get(
    'GB'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for Pricing get

var plivo = require('plivo');

(function main() {
    'use strict';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.pricings.get(
        "GB", // country iso
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Example for Pricing get
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->pricing->get(
        'GB'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r($ex);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.pricing;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.pricing.Pricing;
import com.plivo.api.models.pricing.Pricing;

/**
* Example for Pricing get
*/
class PricingGet {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            Pricing response = Pricing.getter("GB")
                .get();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Example for Pricing Get
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Pricing.Get(
                    countryIso:"GB"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
curl -i --user auth_id:auth_token \
    https://api.plivo.com/v1/Account/{auth_id}/Pricing/?country_iso=US
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for Pricing get
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Pricing.Get(
		"GB",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}