Verify
อัพเดทล่าสุด :2024-03-08
Endpoint
POST https://otp.api.engagelab.cc/v1/verifications
Authentication
Adopts HTTP Basic Authentication method. Add Authorization in the HTTP Header:
Authorization: Basic ${base64_auth_string}
Authorization: Basic ${base64_auth_string}
โค้ดนี้โชว์เป็นหน้าต่างลอย
The generation algorithm for the above base64_auth_string is: 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
โค้ดนี้โชว์เป็นหน้าต่างลอย
Request Body
{
"message_id": "1725407449772531712",
"verify_code": "667090"
}
{
"message_id": "1725407449772531712",
"verify_code": "667090"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Request Parameters
Parameter | Type | Option | Description |
---|---|---|---|
message_id | String | Required | The message ID associated with the verification code, returned by the /messages endpoint |
verify_code | String | Required | The verification code to be validated |
Response Parameters
Success Response
Field | Type | Option | Description |
---|---|---|---|
message_id | String | Required | The message ID associated with the verification code, returned by the /v1/messages endpoint |
verify_code | String | Required | The verification code to be validated |
verified | Boolean | Required | Verification result, true for a successful validation, false for a failure |
{
"message_id": "1725407449772531712",
"verify_code": "667090",
"verified": true
}
{
"message_id": "1725407449772531712",
"verify_code": "667090",
"verified": true
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Note, for the same message's verification code, if the validation request is successful, any subsequent validation requests will fail, indicating that the verification for this message has already been completed; verification codes that have been successfully verified cannot be validated again.
Failure Response
HTTP status code of 4xx or 5xx, response body includes the following fields:
Field | Type | Option | Description |
---|---|---|---|
code | int | Required | Error code, see Error Codes for details |
message | String | Required | Error details |
{
"code": 3003,
"message": "verify code has expired"
}
{
"code": 3003,
"message": "verify code has expired"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Error Codes
Error Code | HTTP Code | Description |
---|---|---|
1000 | 500 | Internal error |
2001 | 401 | Authentication failed, incorrect or missing token |
2002 | 401 | Authentication failed, token expired or has been disabled |
2004 | 403 | No permission to call this API |
3001 | 400 | Invalid request parameter format, please ensure it matches the required JSON format |
3002 | 400 | Incorrect request parameters, please verify they meet the requirements |
3003 | 400 | Verification code expired or already verified, a new verification message needs to be sent for this error code |
4001 | 400 | The message does not exist |