API Server Documentation
API Client Documentation can be found here.
Credentials
You must have an account with Dentity to use our APIs. You can create an account by visiting this link. Once you are signed up, go to Website Settings and you will get access to your API Key and Account Secret.
API Endpoints
POST: https://api.dentity.com/core/api/v1/verification.
This creates a new verification request from a customer’s information.
Request
{
"key": "sample_15fa31da59f69041641984405622",
"phoneNumber": {
"dialCode": "+84",
"phone": "0969449743"
},
"callbackUrl": "test.com"
}
- “key”: Your domain’s API Key
- “phoneNumber”: Your phone number
- “callbackUrl” (Optional): Partner will get verification status when user start process to verify
Response
{
"data": {
"_id": "61e7c75a9426d3001241d5ad",
"status": "pending"
}
}
- “_id”: Unique verification ID
- “status”: Verification status (pending, verified, or failed)
Note:
- When you send request, your phone will get SMS to start the next process.
- If your account is not verified, you have to start the process to verify your account information by Dentity’s system first.
GET: https://api.dentity.com/core/api/v1/verificationId/status
This returns the status of a verification request.
Request
GET – https://api.dentity.com/core/api/v1/61e7c75a9426d3001241d5ad/status
Response
{
"data": {
"_id": "61e7c75a9426d3001241d5ad",
"status": "pending"
}
}
- “_id”: Unique verification ID
- “status”: Verification status (pending, verified, or failed)
The status of the verification will be one of the strings listed above.
Verification Webhook
In this case you will likely need to know when the customer is verified so that you can approve their order. This can be done using the callbackUrl option, which will make a request from our system to yours when the verification status is updated, such as when the verification is verified or failed.
We will send a PUT request to the callback URL with the following data in JSON format:
{
"_id": "61e7c75a9426d3001241d5ad",
"status": "verified",
}
The request will also have the “Dentity-Signature” header which should be used to verify that the request came from us. Below is an example in NodeJS:
const crypto = require('crypto');
function verifySignature(data, headers) {
const key = headers['Dentity-Signature'];
const hash = crypto
.createHmac('sha256', 'SECRET KEY')
.update(JSON.stringify(data))
.digest('base64');
return crypto.timingSafeEqual(Buffer.from(hash), Buffer.from(key));
}
If you would like to receive a webhook for all requests, contact us to set up an automatic webhook for your account.