16.02.2021
user authorisation with a call

The new API method allows companies to verify client phone numbers via a call. This verification is much cheaper than SMS and will suit most websites and apps.

How does it work?

  1. Client enters a phone number on your website
  2. You generate a code and send an API request to verify the number
  3. Machine then calls the client and relays the code
  4. Client enters the digits on your website and verifies their number

Who needs it and why?

Why use phone number verification?:

  • Two Factor Authentication
  • Registration
  • Password recovery

The old client registration method using email and repeated password input is not going anywhere. However, today businesses need to verify clients using phone services more often.

There are two problems with SMS verification. It is expensive for businesses and it is not always safe, as clients can use temporary virtual numbers. That is why registration and further Two Factor Authentication via a call is the optimal identity verification method today.

How to implement

This implementation method request_checknumber is available within Zadarma open API.

Its parameters:

  • caller_id — number that is used to make a call, has to be a number connected with our service;
  • to — client phone number that the machine will call;
  • code — unique code that will be recited on the call. A set of digits that you enter and the machine voices, maximum length is 20 symbols;
  • lang — voicing language. If left empty – personal account language will be used. This is available in the following languages: English, Spanish, German, French, Polish, Russian, Ukrainian.

You generate a code, send an API request and wait for the client to enter the code on your website.

What do you need to get started?

A few easy steps to start using phone authorization for your service:

  1. Register with Zadarma
  2. Connect a virtual number (this is a required step, calls to your clients have to be made from numbers connected with us)
  3. Create API authorisation key and begin working with this method

For convenience with Zadarma API, we recommend using the official library (php, python и C# ).

Once libraries are ready, you need to set your API keys in connected files. Request example using PHP:


<?php

use Zadarma_API\Api;

require_once __DIR__.DIRECTORY_SEPARATOR.'include.php';

define('USE_SANDBOX', false);
$api = new Api(KEY, SECRET, USE_SANDBOX);

$api->call('/v1/request/checknumber/', [
	"caller_id" => "442037691880",
	"to" => "442037691881",
	"code" => "1234567890",
	"lang" => "fr"
]);

Typical response to this request (successful):


{
    "status":"success",
    "from":442037691880,
    "to":442037691881,
    "lang":"fr",
    "time":1612779278
}