Latest Legacy

Update an account phone number

Change the application and subaccount associated with the specified phone number from your account.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Number/{number}/

Arguments

«««< HEAD «««< HEAD

app_id string

The application to be assigned to the phone number. If not specified, the application selected as the default_number_app of the account is assigned. For more information, refer to the default_number_app argument in application and the app_id attribute in application object.

Zentrunk customers can pass the inbound trunk_id as the app_id to map the number to the inbound trunk.

subaccount string

The auth_id of the subaccount to which this number should be added. This can be performed only by the main account.

alias string

An alias assigned to the phone number.

cnam_lookup string

Updates CNAM lookup configuration for a number. Applicable only for US local and toll-free numbers. Valid values are enabled and disabled. For other numbers, this value is null.

=======

app_id string

The application to be assigned to the phone number. If not specified, the application selected as the default_number_app of the account is assigned. For more information, refer to the default_number_app argument in application and the app_id attribute in application object.

subaccount string

The auth_id of the subaccount to which this number should be added. This can be performed only by the main account.

alias string

An alias assigned to the phone number.

9e046e8ae823cefe0149ef346648bdaf70c32df6

app_id string

The application to be assigned to the phone number. If not specified, the application selected as the default_number_app of the account is assigned. For more information, refer to the default_number_app argument in application and the app_id attribute in application object.

Zentrunk customers can pass the inbound trunk_id as the app_id to map the number to the inbound trunk.

subaccount string

The auth_id of the subaccount to which this number should be added. This can be performed only by the main account.

alias string

An alias assigned to the phone number.

cnam_lookup string

Updates CNAM lookup configuration for a number. Applicable only for US local and toll-free numbers. Valid values are enabled and disabled. For other numbers, this value is null.

ffd5bd879c2090976ffc3698d35bd69974b1d203

Response

HTTP Status Code: 202

{
  "message": "changed",
  "api_id": "5a9fcb68-582d-11e1-86da-6ff39efcb949"
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.update(
    number='12025551111',
    alias='Updated Alias', )
print(response)

# Or you could use the Number object directly to update the details
client = plivo.RestClient('<auth_id>','<auth_token>')
number = client.numbers.get(
    number='12025551111', )
response = number.update(
    alias='Updated Alias', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Number Update
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

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

begin
  response = api.numbers.update(
    '12025551111',
    alias: 'Updated Alias'
  )
  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
18
19
20
// Example for Number update

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.numbers.update(
        "12025551111",
        {
            alias: "Updated Alias",
        },
    ).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
19
<?php
/**
 * Example for Number update
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->numbers->update(
        '12025551111',
        ['alias' => 'Updated Alias']
    );
    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
package com.plivo.api.samples.number;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.number.Number;
import com.plivo.api.models.number.NumberUpdateResponse;

/**
* Example for Number update
*/
class NumberUpdate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            NumberUpdateResponse response = Number.updater("12025551111")
                .alias("Updated Alias")
                .update();

            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
30
/**
 * Example for Number Update
 */
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.Number.Update(
                    alias:"Updated Alias",
                    number:"12025551111"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN 
    -H "Content-Type: application/json" 
    -d '{"alias": "testing"}'  
    https://api.plivo.com/v1/Account/{auth_id}/Number/12025551111/
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
// Example for Number update
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.Numbers.Update(
		"12025551111",
		plivo.NumberUpdateParams{
			Alias: "Updated Alias",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}