Skip to content

Dispensary Service

Description#

Dispensary Service — an integration service with Egov, designed to monitor a person's registration status in narcological, psychoneurological, and anti-tuberculosis dispensaries.

For convenient integration through Backend API, use Swagger (OpenAPI).


Terms#

  • Subject — the person who is the object of the dispensary check request.
  • IIN — Individual Identification Number of a citizen of the Republic of Kazakhstan.

Steps#

1. Obtaining an Organization API-KEY#

The first step to use the technology is to obtain the organization’s API-KEY.
To get it, log in to your personal account at this link.
The API-KEY can be found in the Backend Api Key field.

Example of an API-KEY:

API-KEY: Efy202XKbVAWRu...

Note

For illustration purposes, a shortened API KEY is shown. The actual length is 47+ characters.

2. Access Check for the Dispensary Service#

The integration is now performed in two steps:

  1. Access check (endpoint /access/)
  2. Retrieving results (endpoint /retrieve/)

Step 1. Access Check#

Request URL:
https://kyc.biometric.kz/api/v1/backend/dispensary/access/

Request format Method
JSON POST

Request fields:

Field name Type Required Description
api_key String Yes Organization API KEY
iin String Yes IIN of the subject

Request examples:

curl -X POST 'https://kyc.biometric.kz/api/v1/backend/dispensary/access/'   -H 'Content-Type: application/json'   -d '{
  "api_key": "<organization_api_key>",
  "iin": "<subjects_iin>"
}'
import requests
import json

url = "https://kyc.biometric.kz/api/v1/backend/dispensary/access/"
payload = json.dumps({
  "api_key": "<organization_api_key>",
  "iin": "<subjects_iin>"
})
headers = {'Content-Type': 'application/json'}

response = requests.post(url, headers=headers, data=payload)
print(response.json())
let myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

let raw = JSON.stringify({
  "api_key": "<organization_api_key>",
  "iin": "<subjects_iin>"
});

let requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw
};

fetch("https://kyc.biometric.kz/api/v1/backend/dispensary/access/", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Step 2. Retrieving the Result#

Request URL:
https://kyc.biometric.kz/api/v1/backend/dispensary/retrieve/

Request format Method
JSON POST

Request fields:

Field name Type Required Description
api_key String Yes Organization API KEY
iin String Yes IIN of the subject

Request examples:

curl -X POST 'https://kyc.biometric.kz/api/v1/backend/dispensary/retrieve/'   -H 'Content-Type: application/json'   -d '{
  "api_key": "<organization_api_key>",
  "iin": "<subjects_iin>"
}'
import requests
import json

url = "https://kyc.biometric.kz/api/v1/backend/dispensary/retrieve/"
payload = json.dumps({
  "api_key": "<organization_api_key>",
  "iin": "<subjects_iin>"
})
headers = {'Content-Type': 'application/json'}

response = requests.post(url, headers=headers, data=payload)
print(response.json())
let myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

let raw = JSON.stringify({
  "api_key": "<organization_api_key>",
  "iin": "<subjects_iin>"
});

let requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw
};

fetch("https://kyc.biometric.kz/api/v1/backend/dispensary/retrieve/", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Response example#

{
  "result_json": {
    "narcological_account": {
      "RU": "Не состоит на учете в наркологической организации",
      "KZ": "Наркологиялық ұйымда диспансерлік есепте тұрмайды"
    },
    "psychoneurological_account": {
      "RU": "Не состоит на учете в психоневрологической организации",
      "KZ": "Психоневрологиялық ұйымда диспансерлік есепте тұрмайды"
    },
    "antitubercular_account": {
      "RU": "Не состоит на учете в противотуберкулезной организации",
      "KZ": "Туберкулезге қарсы ұйымда диспансерлік есепте тұрмайды"
    }
  },
  "backend_session_id": "backend_session_id"
}

Errors#

Status code Response Description
409 Could not send request to dispensary service Failed to send a request to the dispensary service
400 Subscription has not started Subscription has not yet started
400 No active or future subscription for technology No active or upcoming subscription for the technology
400 Client does not have subscription The client has no subscription. Read more — here
400 Could not connect to dispensary service Failed to connect to the dispensary service