Verification API Documentation

You can use Messente's HTTP SMS API to verify your client's phone number

Messente has lots of ready-made libraries for easy integration - go and check out Messente API Libraries.

How to Verify client's phone number with Messente

  1. Use Verification API to send and verify PIN codes
  2. Use ready-made Verification Widget for super-fast integration

Verifying PIN Code

After starting authentication, you must verify the PIN code of the user.

Request URL

Request to register a service will be made to the following URL:

PUT https://api.verigator.com/v1/service/service/{ServiceId}/users/{UserID}/auth

Where {ServiceID} in the URL will be replaced with your ServiceID and {UserID} will be replaced with UserID of the user.

Request headers

HTTP header Description Required
Content-Type application/json Yes
Accept application/json Yes
X-Service-Auth Refer to authentication section on how to authenticate your API calls with Messente API username and password Yes

Request body (JSON encoded)

Key Description Required
method totp - Prefer TOTP verification with Verigator App. In case app is not set up for this user, Verigator will fallback to SMS automatically.
sms - Start SMS-based authentication
Yes
token PIN code entered by the User  Yes

Response body (JSON encoded)

Key Value
method totp - TOTP authentication method was used
sms - SMS-based authentication was initiated
verified true - Verification was successful, allow user to log in
false - Verification failed, deny access for this user
HTTP Response Codes
STATUS code Value Description
200 OK Request was successful
401 Authentication required
Missing authentication headers (X-Service-Auth)
403 Forbidden Forbidden request
404 Not found Verifitacion with auth_id was not found
422 Invalid data Invlalid request body - check the format and if it was correctly JSON encoded

Examples

from messente.verigator.api import Api

# Initialize API
api = Api("messente-api-username", "messente-api-password")

# Create your service
service = api.services.get("my-service-id")

# Initialize user
user = api.users.get(service.id, "verigator-user-id")

# Start authentication
api.auth.initiate(service.id, user.id, api.auth.METHOD_TOTP)

# Verify token
verified = api.auth.verify(service.id, user.id, token)

public static final String API_USERNAME = "";
public static final String API_PASSWORD = "";
public static final String VERIGATOR_SERVICE_ID = "";

// Initialize the Verigator API with your Messente API credentials
Verigator verigator = new Verigator(API_USERNAME, API_PASSWORD);

// After creating the service, for all future requests you get Service instance like this:
service = Service.get(verigator, VERIGATOR_SERVICE_ID);

// Now you can start syncing your service's users to Verigator
User user = service.registerUser("youremail@example.com", "+3725555555");

// You can use SMS or TOTP (verification via Verigator app)
user.authenticateUsingTotp();

VerificationResponse verificationResponse = user.verifyPin("123456");

if (verificationResponse.isVerified()) {
  System.out.println("Verification successful!");
} else {
  System.out.println("Verification FAILED!");
}