Latest Legacy

Remove a toll-free number

Removes the toll-free number from the number pool.

API Endpoint

DELETE https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Tollfree/{tollfree_number}/

Arguments

unrentbooleanDefault is false if not specified.

Returns

This API call removes the toll-free number from the number pool resource identified by the number and number_pool_uuid specified in the request URL.

Response

HTTP Status Code: 200

{
    "api_id": "57936fb0-7ed5-11ea-aa79-0242ac110003",
    "response": "success"
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")
# Remove a specific tollfree number from Powerpack - Unlink & Unrent
powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
# To Un-Rent while removing a number from powepack - Set flag to "True"
# Version 1
response = powerpack.remove_tollfree('<tollfree_number>', True)
# Version 2
response = powerpack.numberpool.tollfree.remove('<tollfree_number>', True)
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

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

begin
# Remove a specific tollfree number from Powerpack - Unlink & Unrent
powerpack = api.powerpacks.get('<powerpack_uuid>')
# To Un-Rent while removing a number from powepack - Set flag to "true"
# Version 1
response = powerpack.remove_tollfree('<tollfree_number>', true)
# Version 2
response = powerpack.numberpool.tollfree.remove('<tollfree_number>', true)

puts(response)
rescue PlivoRESTError => e
puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
let plivo = require('plivo');

let client = new plivo.Client('<auth_id>', '<auth_token>');

// Remove a specific tollfree number from Powerpack - Unlink & Unrent
client.powerpacks.get("<powerpack_uuid>").then(
  // To Un-Rent while removing a number from powepack - Set flag to "true"
  function (powerpack) {
    return powerpack.remove_number("<tollfree>", true)
    // return powerpack.number_pool.tollfree.remove("<tollfree>", true)  V2
  })
.then(function (result) {
  console.log(result)
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("<auth_id>", "<auth_token>");
$client->client->setTimeout(40);

// Remove a specific tollfree number from Powerpack - Unlink & Unrent
    try {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        // To Un-Rent while removing a number from powepack - Set flag to "true"
        // Version 1
        $response = $powerpack->remove_tollfree('<tollfree_number>',array("unrent=true"));
        // Version 2
        $response = $powerpack->number_pool->tollfree->remove('<tollfree_number>', array("unrent=true"));
        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
25
26
27
package com.plivo.api;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.powerpack.Powerpack;


public class Test {
        
    public static void main(String[] args) {
        
        Plivo.init("<auth_id>", "<auth_token>");

        // Remove a specific tollfree number from Powerpack - Unlink & Unrent
        try {
            Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
            // To Un-Rent while removing a number from powepack - Set flag to "true"
            // Version 1
            powerpack.remove_tollfree().tollfree("<tollfree>").unrent(true).delete();
            //Version 2
            powerpack.numberpool.tollfree.remove().tollfree("<tollfree>").unrent(true).delete();
        } 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
30
31
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");

            // Remove a specific tollfree number from Powerpack - Unlink & Unrent
            try
            {
                // To Un-Rent while removing a number from powepack - Set flag to "true"
                var powerpack = api.Powerpacks.Get("<powerpack_uuid>");
                // Version 1
                var response = powerpack.Remove_Tollfree("<tollfree_number>", true);
                // Version 2
                var response = powerpack.numberpool.tollfree.Remove("<tollfree_number>", true);
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
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
30
31
package main

import (
	"fmt"

	plivo "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
	}

	// Remove a specific tollfree number from Powerpack - Unlink & Unrent
	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	// To Un-Rent while removing a number from powepack - Set flag to "true"
	response, err := powerpack.Remove_tollfree("<tollfree_number>", plivo.NumberRemoveParams{Unrent: true})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}