👥 API tra cứu thông tin công dân
Đặc tả API
VietQR.IO (/v2/citizen)
Tra cứu thông tin công dân
API tra cứu thông tin công dân dựa vào CCCD, CMND hoặc Mã số thuế và tên công dân
Authorizations:
(x-client-idx-api-key)
Request Body schema: application/json
legalId required | string Mã định danh cá nhân (CCCD, CMND hoặc Mã số thuế) của công dân |
legalName required | string Tên công dân |
Responses
Request samples
- Payload
Content type
application/json
{- "legalId": "8589715960",
- "legalName": "NGUYEN MINH KHANH"
}
Response samples
- 200
Content type
application/json
Example
Success - Thành công
{- "code": "00",
- "desc": "Success - Thành công",
- "data": {
- "taxId": "8589715960",
- "name": "Nguyễn Minh Khánh"
}
}
Code mẫu
- CURL
- Javascript (Axios)
- C#
curl --location --request POST 'https://api.vietqr.io/v2/citizen' \
--header 'x-client-id: <CLIENT_ID_HERE>' \
--header 'x-api-key: <API_KEY_HERE>' \
--header 'Content-Type: application/json' \
--data-raw '{
"legalId":"8589715960",
"legalName":"NGUYEN MINH KHANH"
}'
var axios = require('axios');
var data = JSON.stringify({
"legalId":"8589715960",
"legalName":"NGUYEN MINH KHANH"
});
var config = {
method: 'post',
url: 'https://api.vietqr.io/v2/citizen',
headers: {
'x-client-id': '<CLIENT_ID_HERE>',
'x-api-key': '<API_KEY_HERE>',
'Content-Type': 'application/json',
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
var client = new RestClient("https://api.vietqr.io/v2/citizen");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("x-client-id", "<CLIENT_ID_HERE>");
request.AddHeader("x-api-key", "<API_KEY_HERE>");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@" ""legalId"": ""8589715960""," + "\n" +
@" ""legalName"": ""NGUYEN MINH KHANH""" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content)