# Verification | Sinch

Sinch offers a platform for phone number verification. It consists of different software development kits (the Sinch SDKs) that you integrate with your smartphone or web application and cloud based back-end services as well as a REST API. Together, they enable SMS, Flashcall, Phone Call, WhatsApp, and Data verification in your application.
Verify users with SMS, flash calls (missed calls), a regular call, a WhatsApp message, or data verification. This document serves as a user guide and documentation on how to use the Sinch Verification REST APIs.
The Sinch Verification API is used to verify mobile phone numbers. It's consumed by the Sinch Verification SDK, but it can also be used by any backend or client directly.
The Sinch service uses five different verification methods:
- [SMS](https://developers.sinch.com/docs/verification/api-reference/verification/section/sms-verification)
: Sending an SMS message with an OTP code
- [FlashCall](https://developers.sinch.com/docs/verification/api-reference/verification/section/flashcall-verification)
: Placing a flashcall (missed call) and detecting the incoming calling number (CLI)
- [Phone Call](https://developers.sinch.com/docs/verification/api-reference/verification/section/phone-call-verification)
: Placing a PSTN call to the user's phone and playing a message containing the code
- [WhatsApp](https://developers.sinch.com/docs/verification/api-reference/verification/section/whatsapp-verification)
: Sending a WhatsApp message with an OTP code
- [Data](https://developers.sinch.com/docs/verification/api-reference/verification/section/data-verification)
: By accessing internal infrastructure of mobile carriers to verify if given verification attempt was originated from device with matching phone number

If you want to use data verification, please contact your account manager.
## Authentication
For general information on how to use the Sinch APIs including methods, types, errors and authorization, please visit the [Authentication](https://developers.sinch.com/docs/verification/api-reference/authentication/) page.
Available authentication methods are:
- [Application Signed Request](https://developers.sinch.com/docs/verification/api-reference/authentication/application-signed-request)
: Strongest method, recommended for production use
- [Basic Authentication](https://developers.sinch.com/docs/verification/api-reference/authentication/basic-authentication)
: Strong and easy, recommended for prototyping
- [Public Authentication](https://developers.sinch.com/docs/verification/api-reference/authentication/public-authentication)
: Weak method, suitable only for specific scenarios

### Authorization
You can set the minimum required authentication level in the Dashboard. Verification API rejects requests using weaker authentication methods than configured. Some endpoints may require stronger authentication than the set minimum.
# FlashCall verification
With the flashCall verification method, a user's phone number is verified by triggering a "missed call" towards this number. The call is automatically intercepted by the Android SDK in the mobile app and blocked automatically. iOS and JavaScript use cases require manual interaction where user has to enter incoming phone call number in the application.
To initiate a flashCall verification, visit [Android SDK documentation](https://developers.sinch.com/docs/verification/android/android-the-verification-process). For additional security, it's recommended that you control which verification requests should proceed and which ones not, by listening in your backend for the [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent) and respond accordingly. Your backend will be notified on the result of the verification with the [Verification Result Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationresultevent).
# SMS verification
With the SMS verification method, a user's phone number is verified by sending an SMS containing an OTP code to this number. In the case of iOS or JavaScript, the user needs to enter the OTP manually or semi-manually in the application, while for Android there is an option of intercepting the SMS message delivery and capturing the OTP code automatically.
To initiate an SMS verification, check the [iOS](https://developers.sinch.com/docs/verification/ios.md) or [Android](https://developers.sinch.com/docs/verification/android.md) documentation. For additional security, it's recommended that you control which verification requests should proceed and which ones not, by listening in your backend for the [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent) and respond accordingly. Your backend will be notified on the result of the verification with the [Verification Result Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationresultevent).
## Set SMS language
It's possible to specify the content language for SMS verification. The desired language is set in the initiate verification request 'Accept-Language' header. Setting this header is optional. If not included the application's default SMS content language is used, which by default is en-US. If an SMS template for the desired language is not found it's defaulted to 'en-US' unless a different default language has been defined for the requesting application.
More information on the 'Accept-Language' header can be found from [IETF](https://tools.ietf.org/html/rfc3282) and the [HTTP/1.1 documentation](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4).
The content language specified in the API request or in the callback can be overridden by carrier provider specific templates, due to compliance and legal requirements, such as [US shortcode requirements](https://community.sinch.com/t5/SMS/Sinch-US-Short-Code-Onboarding-Overview/ta-p/7085).
*Example* - SMS verification specifying content language

```html
Headers: ... Accept-Language: es-ES ... [POST]
https://verification.api.sinch.com/verification/v1/verifications
```

```json
{
  "identity": { "type": "number", "endpoint": "+46700000001" },
  "method": "sms"
}
```
The actual language that was selected is returned in the `Content-Language` HTTP content header. As outlined above, this may differ from the requested language due to either that language not having SMS content defined, or it being overridden by provider requirements.
*Example* - SMS verification response with selected content language
#### Response

```html
Headers: ... Content-Length: 103 Content-Language: es-ES Content-Type:
application/json; charset=utf-8 Expires: -1 ...
```

```json
{
  "id": "1087388",
  "sms": {
    "template": "Tu código de verificación es {{CODE}}.",
    "interceptionTimeout": 120
  }
}
```
# Phone Call verification
With the Phone Call verification method, a user's phone number is verified by receiving a phone call and hearing a pre-recorded or text-to-speech message containing OTP code. The user is then expected to enter this code in the application.
To initiate a Phone Call verification, check the [Start Verification](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-start/startverification) documentation. For additional security, it's recommended that you control which verification requests should proceed and which ones not, by listening in your backend for the [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent) and respond accordingly. Your backend will be notified on the result of the verification with the [Verification Result Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationresultevent).
# WhatsApp verification
With the WhatsApp verification method, a user's phone number is verified by sending a WhatsApp message containing an OTP code to this number. The user then enters the code in your application, or copies it with the **Copy code** button in the message. The phone number must have an active WhatsApp account; if it doesn't, the message can't be delivered and the verification fails.
To initiate a WhatsApp verification, call the [Start Verification](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-start/startverification) API with `method` set to `whatsapp`, then submit the code entered by the user with the [Report Verification](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-report/reportverificationbyid) API. The Android, iOS, and JVM Verification SDKs don't support WhatsApp verification. For additional security, it's recommended that you control which verification requests should proceed and which ones not, by listening in your backend for the [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent) and respond accordingly. Your backend will be notified on the result of the verification with the [Verification Result Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationresultevent).
*Example* - Start a WhatsApp verification

```json
{
  "identity": { "type": "number", "endpoint": "+46700000001" },
  "method": "whatsapp"
}
```
By default, the OTP code contains numbers only. When the verification request originates from your backend and is signed via an [Application signed request](https://developers.sinch.com/docs/verification/api-reference/authentication/application-signed-request), you can set `whatsappOptions.codeType` to `Numeric`, `Alpha`, or `Alphanumeric`. You can also set `whatsapp.codeType` in your response to the [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent).
WhatsApp requires that users agree to receive messages from your business on WhatsApp before you message them. Make sure your app collects this consent, for example with a checkbox next to the phone number field, before it starts a WhatsApp verification. Sinch registers the opt-in with WhatsApp for you when the verification starts.
## Sender
WhatsApp messages are sent from a WhatsApp Business Account (WABA) linked to a phone number. The sender's name and phone number are what the user sees in WhatsApp.
- Sinch test sender: you can start testing WhatsApp verification right away with the sender Sinch provides, with no WhatsApp Business setup on your side. Messages are sent from a Sinch-owned phone number under the Sinch business name, using the Sinch authentication template described below. You can choose the message language and the code type, but you can't change the sender name, the phone number, or the template. Use it to build and test your integration, not for production traffic.
- Your own sender: for production, your users should receive verification codes from your own business name. Contact your account manager to set up a WhatsApp sender for your application.

## Authentication templates
WhatsApp only allows verification codes to be sent with [authentication templates](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/authentication-templates) that Meta has approved. Because of this, you can't send a custom message text with WhatsApp verification, the way you can with SMS.
The message body is fixed by Meta and translated by Meta into each supported language. In English it reads:

```text
<VERIFICATION_CODE> is your verification code.
```
An authentication template can be configured to a limited extent:
- Security recommendation: an optional line asking the user not to share the code, such as
*For your security, do not share this code.*
- Code expiration: an optional footer saying how long the code is valid, such as
*This code expires in 10 minutes.*
 The value can be from 1 to 90 minutes.
- Copy code button: a button that copies the code to the clipboard, so the user can paste it into your app.

Links, media, and emojis aren't allowed in authentication templates, and the code itself can be up to 15 characters long. If you use your own sender, contact your account manager to agree on the template configuration.
## Set WhatsApp language
The language of the WhatsApp message is set the same way as for SMS: with the `Accept-Language` header of the start verification request, or with `whatsapp.acceptLanguage` in your response to the [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent), which takes precedence over the header. Both are optional. If neither is set, the message is sent in English (`en-US`). If Sinch has set a fixed WhatsApp language for your application, that language is always used.
Use the same language codes as for SMS, for example `es-ES` or `pt-BR`. They're converted to the WhatsApp format (`es_ES`, `pt_BR`) for you. Only the first language in the list is used.
Unlike SMS, WhatsApp verification doesn't fall back to English when the requested language isn't one of the [languages WhatsApp supports](https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages). The verification fails with an error instead.
*Example* - WhatsApp verification specifying content language

```html
Headers: ... Accept-Language: es-ES ... [POST]
https://verification.api.sinch.com/verification/v1/verifications
```

```json
{
  "identity": { "type": "number", "endpoint": "+46700000001" },
  "method": "whatsapp"
}
```
# Data verification
With the data verification method, a user's phone number is verified by mobile carrier's infrastructure itself. This method requires cellular data usage on end-user's device and is currently limited in its coverage.
If you want to use data verification, please contact your account manager.
# How to use the Verification APIs
In combination with the Mobile or Web SDK (recommended)
The following diagram shows how to use the Verification APIs when using the iOS, Android or JavaScript SDKs to initiate a verification.
![verification.png](https://developers.sinch.com/images/verification/1ad7295-verification.png)
In this scenario, the *Verification Request* and *Report Verification* APIs don't need to be called explicitly by the app, since the SDK is handling that for you.
If you have configured a verification callback URL in the Sinch Portal (recommended), with every verification that's initiated by the app, Sinch will send a [Verification Request Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent) to your backend, to get permission to perform the verification. If your backend allows the verification request to proceed, Sinch will trigger a flashcall, SMS, WhatsApp message or call towards the phone to be verified. Once the phone receives the flash-call, SMS, WhatsApp message or voice call, the SDK will report back the CLI or OTP respectively so that the Sinch dashboard can compare its validity. The Sinch backend responds with the result of the verification to the client and sends a [Verification Result Event](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationresultevent) to your backend. The status of a verification can also be queried ad-hoc by using the Verification status APIs: [by ID](https://developers.sinch.com/docs/verification/api-reference/verification/verification-status/verificationstatusbyid), [by identity](https://developers.sinch.com/docs/verification/api-reference/verification/verification-status/verificationstatusbyidentity), or [by reference](https://developers.sinch.com/docs/verification/api-reference/verification/verification-status/verificationstatusbyreference).
## Without the mobile or web SDK
If you are not using the mobile or web Verification SDKs, then you need to implement all the client logic for intercepting calls (in case of flashcalls) and reporting the CLI or OTP (in case of SMS, WhatsApp or Phone Call verification) inside your app. The following diagram shows how to use Sinch Verification in this scenario.
![verification_without_sdk.png](https://developers.sinch.com/images/verification/82d9a08-verification_without_sdk.png)
The verification requests will be triggered from your backend towards Sinch with the [Verification Request API](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-start/startverification), by doing a [signed request](https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request). Sinch dashboard will respond with the CLI filter (for flashcalls) or the template (in case of an SMS), or the polling intervals (in case of a Phone Call). As soon as the flashcall or SMS is received by your app, your backend will need to report back to Sinch the CLI or OTP that was reported through the [Report Verification API](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-report/reportverificationbyidentity). Sinch will respond with the result of the verification.

Version: 2.0.1
License: MIT

## Servers

```
https://verification.api.sinch.com
```

## Security

### Basic

For more information about basic authentication, see [Basic Authentication](https://developers.sinch.com/docs/verification/api-reference/authentication/).

Type: http
Scheme: basic

### Application

For more information about application request signing authentication, see [Request Signing](https://developers.sinch.com/docs/verification/api-reference/authentication/application-signed-request).

Type: apiKey
In: header
Name: Authentication

## Download OpenAPI description

 - [Verification | Sinch](https://developers.sinch.com/_bundle/docs/verification/api-reference/verification.yaml)

## Verifications start

 - [POST /verification/v1/verifications](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-start/startverification.md): This method is used by the mobile and web Verification SDKs to start a verification. It can also be used to request a verification from your backend, by making an request.
## Verifications report

 - [PUT /verification/v1/verifications/number/{endpoint}](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-report/reportverificationbyidentity.md): Report the received verification code to verify it, using the identity of the user (in most cases, the phone number). For an SMS, WhatsApp or Phone Call verification, this is the OTP code. For FlashCa
 - [PUT /verification/v1/verifications/id/{id}](https://developers.sinch.com/docs/verification/api-reference/verification/verifications-report/reportverificationbyid.md): Report the received verification code to verify it, using the Verification ID of the Verification request.
## Verifications status

 - [GET /verification/v1/verifications/id/{id}](https://developers.sinch.com/docs/verification/api-reference/verification/verification-status/verificationstatusbyid.md): Queries the verification result by sending the verification ID. With this query you can get the result of a verification.
 - [GET /verification/v1/verifications/{method}/number/{endpoint}](https://developers.sinch.com/docs/verification/api-reference/verification/verification-status/verificationstatusbyidentity.md): Queries the verification result by sending the verification Identity (usually a phone number) and its method. With this query you can get the result of a verification.
 - [GET /verification/v1/verifications/reference/{reference}](https://developers.sinch.com/docs/verification/api-reference/verification/verification-status/verificationstatusbyreference.md): Queries the verification result by sending the verification Reference. With this query you can get the result of a verification.
## Verifications callbacks

 - [POST VerificationRequestEvent](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationrequestevent.md): This callback event is a POST request to the specified verification callback URL and is triggered when a new verification request is made from the SDK client or the Verification Request API. This call
 - [POST VerificationResultEvent](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/verificationresultevent.md): This callback event is a POST request to the specified verification callback URL and triggered when a verification has been completed and the result is known. It's used to report the verification resu
 - [POST SmsDeliveredEvent](https://developers.sinch.com/docs/verification/api-reference/verification/verification-callbacks/smsdeliveredevent.md): This callback event is a POST request to the specified verification callback URL and is triggered when an SMS delivery receipt is received. It is used to report the final delivery status of the verifi
