Latest Legacy

Initiate number verification

This method lets you initiate the number verification.

API Endpoint

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

Attributes

phone_number (Mandatory)

The phone number for verification must be provided in E.164 format. This is mandatory for creating the VerifiedCallerID object.

alias (optional)

The unique name associated with the verified caller ID

channel (optional)

The method channel used to receive the OTP.

  • Possible values: sms, call
  • Default: sms
subaccount (optional)

A valid sub-account Auth ID.
Default: None

Response

{
  "api_id": "654a7ca7-b9cc-4285-86f7-cf581f50409f",
  "message": "Verification code is sent to number +12025551XXX which is valid for 15 minutes",
  "verification_uuid": "f87836bd-f3c0-41bb-9498-125e6faaa4d4"
}

Example Request

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

client = plivo.RestClient('<Auth>', '<Token>')

response = client.verify_callerids.initiate_verify(phone_number='<phone_number>',
                                                   alias='<alias>',
                                                     channel='call/sms',
                                                     subaccount='<subaccount>')

print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions


api = RestClient.new("<auth>", "<token>")
begin
    response = api.verify_caller_id.initiate(
        phone_number="91XXXXXXXXXX", channel="sms", alias_ = "test",subaccount="<subAccountAuth>" 
    )
    
    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
var plivo = require('plivo');

(function main() {
    'use strict';
    
    var client = new plivo.Client("<auth_id>","<auth_token>");
    client.verify.initiate('<phoneNumber>',{
    channel : '<call/sms>',
    alias : '<TestAlias>',
    subAccount  : '<SubAccount>'
    }).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
20
21
22
<?php
/**
 * Example for initiat verify api request
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth>","<token>");

try {
    
    $response = $client->verifyCallerId->initiate("+91XXXXXXXXX", [
        "alias" => "test",
        "subaccount" => "<Subaccount>",
        "channel" => "Call"   
    ]);

        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
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.verify.InitiateVerifyResponse;
import com.plivo.api.models.verify.Verify;

import java.io.IOException;

public class verificationCallerID {

  public static void main(String[] args) {
    Plivo.init("<auth>", "<token>");
     try {
      InitiateVerifyResponse response = Verify.initiateVerify().phoneNumber("91XXXXXXXXXX").alias("test").channel("call").create();
      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
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.VerifyCallerId.Initiate("<phone_number>", "<call/sms>", "<alias-test>","<subaccount>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Console.WriteLine("Exception: " + e);
            }
        }
    }
}
1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"phone_number": "+12025551XXX","alias":"US Mainland"}' \
    https://api.plivo.com/v1/Account/{auth_id}/VerifiedCallerId/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
import (
	"fmt"
	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<Auth>", "<Token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.VerifyCallerId.InitiateVerify(plivo.InitiateVerify{PhoneNumber: "<phoneNumber>", Alias: "<TestAlias>", Channel : "<call/sms>", SubAccount: "<SubAccount>"})

	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)