Mobile Number Two-Factor Verification API Integration Guide

This document introduces a Mobile Number Two-Factor Verification API integration guide, which can be used to verify the authenticity and consistency of a mobile number and name.

Application Process

To use the Mobile Number Two-Factor Verification API, first go to the orchats Console to obtain your API Token for later use.

If you have not yet logged in or registered, you will be automatically redirected to the login page to register and log in. Once completed, you will be automatically returned to the current page.

📘 Full documentation: Mobile Number Two-Factor Verification API →

Basic Usage

First, let's look at the basic usage: enter a mobile number to obtain the processed result. To begin, you simply need to pass a mobile field. We can then fill in the corresponding content on the interface, as shown below:

As you can see, we have set the Request Headers here, including:

  • accept: The desired response format, set here to application/json, meaning JSON format.
  • authorization: The key for calling the API, which can be selected directly from the dropdown after application.

We have also set the Request Body, including:

  • name: The name of the user to be processed, a required parameter.
  • mobile: The mobile number to be processed, a required parameter.
  • encryption: Optional encryption parameters for sensitive fields (if sending encrypted data).

After making the selections, you can see that the corresponding code has also been generated on the right, as shown below:

Click the “Try” button to test it. As shown above, we obtained the following result:

{
  "result": "0",
  "description": "验证结果一致"
}

The returned result contains several fields, described as follows:

  • result, the verification result code, with billing as follows.
    • Billable result codes:
      • 0: Verification result is consistent
      • 1: Verification result is inconsistent
    • Non-billable result codes:
      • -1: No record found
      • -2: Unknown engine error
      • -3: Engine service error
      • -4: Name validation failed
      • -5: Invalid mobile number
      • -6: The number of verification attempts has exceeded the daily limit; please try again the next day
  • description, description of the business result.

As you can see, the authenticity and consistency of the mobile number and name have been checked.

Additionally, if you want to generate the corresponding integration code, you can directly copy the generated code. For example, the CURL code is as follows:

curl -X POST 'https://api.orchats.repoingest.com/identity/phone/check-2e' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "name": "***",
  "mobile": "***"
}'

The Python integration code is as follows:

import requests

url = "https://api.orchats.repoingest.com/identity/phone/check-2e"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "name": "***",
    "mobile": "***"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)

Error Handling

When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:

  • 400 token_mismatched: Bad request, possibly due to missing or invalid parameters.
  • 400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.
  • 401 invalid_token: Unauthorized, invalid or missing authorization token.
  • 429 too_many_requests: Too many requests, you have exceeded the rate limit.
  • 500 api_error: Internal server error, something went wrong on the server.

Example Error Response

{
  "success": false,
  "error": {
    "code": "api_error",
    "message": "fetch failed"
  },
  "trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}

Conclusion

Through this document, you have learned how to use the Mobile Number Two-Factor Verification API to verify the authenticity and consistency of a mobile number and name. We hope this document helps you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.