OTP Validation
Endpoint
POST https://otp.api.engagelab.cc/v1/verifications
Authentication
Use HTTP Basic Authentication for authentication, and include Authorization in the HTTP header:
Authorization: Basic ${base64_auth_string}
Authorization: Basic ${base64_auth_string}
This code block in the floating window
The base64_auth_string is generated as follows: base64(dev_key:dev_secret)
Request Example
Request Header
POST /v1/verifications HTTP/1.1
Content-Type: application/json
Authorization: Basic amlndWFuZ2RldjpkZXZfc2VjcmV0
POST /v1/verifications HTTP/1.1
Content-Type: application/json
Authorization: Basic amlndWFuZ2RldjpkZXZfc2VjcmV0
This code block in the floating window
Request Body
{
"message_id": "1725407449772531712",
"verify_code": "667090"
}
{
"message_id": "1725407449772531712",
"verify_code": "667090"
}
This code block in the floating window
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| message_id | String | Required | The message ID corresponding to the verification code, returned by the /messages API |
| verify_code | String | Required | The verification code to be validated |
Response Parameters
Successful Response
| Field | Type | Required | Description |
|---|---|---|---|
| message_id | String | Required | The message ID corresponding to the verification code, returned by the /v1/messages API |
| verify_code | String | Required | The verification code to be validated |
| verified | Boolean | Required | The validation result. true indicates validation succeeded, and false indicates validation failed |
{
"message_id": "1725407449772531712",
"verify_code": "667090",
"verified": true
}
{
"message_id": "1725407449772531712",
"verify_code": "667090",
"verified": true
}
This code block in the floating window
Note: If a validation request is made for the verification code of the same message and the code is successfully validated, any subsequent request to this validation API will fail and return a message indicating that the verification code for this message has already been validated. In other words, verification codes that have already been successfully validated cannot be validated again.
Failed Response
The HTTP status code is 4xx or 5xx, and the response body contains the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
| code | int | Required | Error code. For details, see Error Codes |
| message | String | Required | Error details |
{
"code": 3003,
"message": "verify code has expired"
}
{
"code": 3003,
"message": "verify code has expired"
}
This code block in the floating window
Error Codes
| Error Code | HTTP Code | Description |
|---|---|---|
| 1000 | 500 | Internal error |
| 2001 | 401 | Authentication failed: the correct token was not provided |
| 2002 | 401 | Authentication failed: the token has expired or has been disabled |
| 2004 | 403 | No permission to call this API |
| 3001 | 400 | Invalid request parameter format. Please check whether the JSON content complies with the required parameter format |
| 3002 | 400 | Invalid request parameters. Please check whether the request parameters meet the requirements |
| 3003 | 400 | The verification code has expired or has already been verified. For responses with this error code, a new verification code message must be sent |
| 4001 | 400 | The message does not exist |
