Policy
Manage insurance policies, policy templates (categories, benefits, sub-benefits), patient-policy relationships, and patient benefit consumption. Policies belong to a Policy Holder and can have Members assigned through patient-policy operations. Networks are referenced when linking patients to policies.
Base URL
https://api.{client_namespace}.najeeb.ai/v4.0/health
Authentication
All API requests are authenticated using an API key passed in a dedicated header:
access-key: YOUR_API_KEY
For access key provisioning, please contact Najeeb support.
Policy Management
Create Policy
POST /policy/create
Create a new insurance policy linked to an existing policy holder. Optionally, you can add a patient to the policy in the same request using the add_patient_to_policy nested object.
A Policy Holder must exist before creating a policy. If you include add_patient_to_policy, the referenced Member and Network must also exist.
Request Body
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
policy_no * | string | Yes | Unique policy number | Alphanumeric string (e.g., POL-2024-001) |
start_date * | string | Yes | Policy start date | ISO date |
end_date * | string | Yes | Policy end date | ISO date |
created_date * | string | Yes | Date the policy was created | ISO date |
status * | string | Yes | Policy status | Enum: ACTIVE, INACTIVE, EXPIRED |
ph_erp_id * | string | Yes | ERP ID of the policy holder that owns this policy | Alphanumeric string |
add_patient_to_policy | object | No | Nested object to simultaneously add a patient to the policy | See nested object below |
add_patient_to_policy nested object:
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
member_id * | string | Yes | Member ID of the patient to add | Alphanumeric string |
network_code | string | No | Code of the network to associate | Alphanumeric string |
category_code * | string | Yes | Category code for the patient within the policy | Alphanumeric string |
start_date * | string | Yes | Patient-policy start date | ISO date |
end_date * | string | Yes | Patient-policy end date | ISO date |
Code Examples
- cURL
- JavaScript
- Python
curl -X POST \
"https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/create" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"policy_no": "POL-2024-001",
"start_date": "2024-01-01",
"end_date": "2024-12-31",
"created_date": "2024-01-01",
"status": "ACTIVE",
"ph_erp_id": "PH-ERP-12345",
"add_patient_to_policy": {
"member_id": "MEMBER001",
"network_code": "NET-001",
"category_code": "A",
"start_date": "2024-01-01",
"end_date": "2024-12-31"
}
}'
const response = await fetch(
"https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/create",
{
method: "POST",
headers: {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
policy_no: "POL-2024-001",
start_date: "2024-01-01",
end_date: "2024-12-31",
created_date: "2024-01-01",
status: "ACTIVE",
ph_erp_id: "PH-ERP-12345",
add_patient_to_policy: {
member_id: "MEMBER001",
network_code: "NET-001",
category_code: "A",
start_date: "2024-01-01",
end_date: "2024-12-31",
},
}),
}
);
const data = await response.json();
console.log(data);
import requests
url = "https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/create"
payload = {
"policy_no": "POL-2024-001",
"start_date": "2024-01-01",
"end_date": "2024-12-31",
"created_date": "2024-01-01",
"status": "ACTIVE",
"ph_erp_id": "PH-ERP-12345",
"add_patient_to_policy": {
"member_id": "MEMBER001",
"network_code": "NET-001",
"category_code": "A",
"start_date": "2024-01-01",
"end_date": "2024-12-31",
},
}
headers = {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Response
Success Response (201 Created)
{
"policy_no": "POL-2024-001",
"start_date": "2024-01-01",
"end_date": "2024-12-31",
"created_date": "2024-01-01",
"status": "ACTIVE",
"ph_erp_id": "PH-ERP-12345",
"code": 201,
"message": "Created successfully"
}
Response Fields
| Field | Type | Description |
|---|---|---|
policy_no | string | The policy number of the created policy |
start_date | string | Policy start date |
end_date | string | Policy end date |
created_date | string | Date the policy was created |
status | string | Policy status |
ph_erp_id | string | ERP ID of the policy holder |
code | number | HTTP status code (201) |
message | string | Success message |
Error Responses
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
E_BAD_REQUEST_400 | 400 | Request validation failed -- see the details array for field-level errors |
401 Unauthorized | 401 | Missing or invalid access-key |
E_EPH_01 | 404 | Policy holder not found |
E_EPA_01 | 404 | Patient not found |
E_EPA_015 | 404 | Network not found |
E_EPA_069 | 409 | Policy already exists or patient already has an active policy |
Example Error Responses
Bad Request:
{
"ErrorCode": "E_BAD_REQUEST_400",
"message": "Bad request",
"details": [
"policy_no is required",
"status must be one of the following values: ACTIVE, INACTIVE, EXPIRED"
]
}
Policy Holder Not Found:
{
"ErrorCode": "E_EPH_01",
"message": "Policy holder not found",
"details": []
}
Unauthorized:
{
"ErrorCode": "API key is required",
"message": "Unauthorized",
"details": []
}
Update Policy
PATCH /policy/policy?ph_erp_id=...&policy_no=...
Update core fields of an existing policy such as dates, plan code, or status.
Query Parameters
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
ph_erp_id * | string | Yes | ERP ID of the policy holder | Alphanumeric string |
policy_no * | string | Yes | Policy number of the policy to update | Alphanumeric string |
Request Body
All fields are optional. Only include the fields you want to update.
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
start_date | string | No | Updated start date | ISO date |
end_date | string | No | Updated end date | ISO date |
status | string | No | Updated policy status | Enum: ACTIVE, INACTIVE, EXPIRED |
plan_code | string | No | Plan code to associate with the policy | Alphanumeric string |
Code Examples
- cURL
- JavaScript
- Python
curl -X PATCH \
"https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/policy?ph_erp_id=PH-ERP-12345&policy_no=POL-2024-001" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"end_date": "2025-06-30",
"status": "ACTIVE"
}'
const params = new URLSearchParams({
ph_erp_id: "PH-ERP-12345",
policy_no: "POL-2024-001",
});
const response = await fetch(
`https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/policy?${params}`,
{
method: "PATCH",
headers: {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
end_date: "2025-06-30",
status: "ACTIVE",
}),
}
);
const data = await response.json();
console.log(data);
import requests
url = "https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/policy"
params = {
"ph_erp_id": "PH-ERP-12345",
"policy_no": "POL-2024-001",
}
payload = {
"end_date": "2025-06-30",
"status": "ACTIVE",
}
headers = {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
response = requests.patch(url, params=params, json=payload, headers=headers)
print(response.json())
Response
Success Response (200 OK)
{
"policy_no": "POL-2024-001",
"start_date": "2024-01-01",
"end_date": "2025-06-30",
"created_date": "2024-01-01",
"status": "ACTIVE",
"ph_erp_id": "PH-ERP-12345",
"code": 200,
"message": "Updated successfully"
}
Response Fields
| Field | Type | Description |
|---|---|---|
policy_no | string | The policy number |
start_date | string | Policy start date |
end_date | string | Updated policy end date |
created_date | string | Date the policy was created |
status | string | Current policy status |
ph_erp_id | string | ERP ID of the policy holder |
code | number | HTTP status code (200) |
message | string | Success message |
Error Responses
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
E_BAD_REQUEST_400 | 400 | Request validation failed -- see the details array for field-level errors |
401 Unauthorized | 401 | Missing or invalid access-key |
E_EPH_01 | 404 | Policy holder not found |
E_EPA_014 | 404 | Policy not found |
Example Error Responses
Policy Not Found:
{
"ErrorCode": "E_EPA_014",
"message": "Policy not found",
"details": []
}
Get Patient Consumption
GET /policy/patient/consumption/get?ph_erp_id=...&policy_no=...&member_id=...
Retrieve the benefit consumption details for a specific patient under a given policy. Returns the amounts eligible, utilized, ex-gratia, and a breakdown by benefit and sub-benefit.
Query Parameters
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
ph_erp_id * | string | Yes | ERP ID of the policy holder | Alphanumeric string |
policy_no * | string | Yes | Policy number | Alphanumeric string |
member_id * | string | Yes | Member ID of the patient | Alphanumeric string |
Code Examples
- cURL
- JavaScript
- Python
curl -X GET \
"https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/patient/consumption/get?ph_erp_id=PH-ERP-12345&policy_no=POL-2024-001&member_id=MEMBER001" \
-H "access-key: YOUR_API_KEY"
const params = new URLSearchParams({
ph_erp_id: "PH-ERP-12345",
policy_no: "POL-2024-001",
member_id: "MEMBER001",
});
const response = await fetch(
`https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/patient/consumption/get?${params}`,
{
method: "GET",
headers: {
"access-key": "YOUR_API_KEY",
},
}
);
const data = await response.json();
console.log(data);
import requests
url = "https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/patient/consumption/get"
params = {
"ph_erp_id": "PH-ERP-12345",
"policy_no": "POL-2024-001",
"member_id": "MEMBER001",
}
headers = {
"access-key": "YOUR_API_KEY",
}
response = requests.get(url, params=params, headers=headers)
print(response.json())
Response
Success Response (200 OK)
{
"member_id": "MEMBER001",
"category_code": "A",
"amount_eligible": 10000,
"amount_exgratia": 5000,
"amount_utilized": 1000,
"benefit_consumption": [
{
"benefit_code": "BEN-001",
"limit": 5000,
"utilized": 500
}
],
"sub_benefit_consumption": [
{
"sub_benefit_code": "SUB-BEN-001",
"limit": 2000,
"utilized": 200
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
member_id | string | Member ID of the patient |
category_code | string | Category code for the patient within the policy |
amount_eligible | number | Total amount eligible under the policy |
amount_exgratia | number | Total ex-gratia amount available |
amount_utilized | number | Total amount utilized by the patient |
benefit_consumption | array | Array of benefit consumption objects |
benefit_consumption[].benefit_code | string | Benefit code |
benefit_consumption[].limit | number | Maximum limit for the benefit |
benefit_consumption[].utilized | number | Amount utilized for the benefit |
sub_benefit_consumption | array | Array of sub-benefit consumption objects |
sub_benefit_consumption[].sub_benefit_code | string | Sub-benefit code |
sub_benefit_consumption[].limit | number | Maximum limit for the sub-benefit |
sub_benefit_consumption[].utilized | number | Amount utilized for the sub-benefit |
Error Responses
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
401 Unauthorized | 401 | Missing or invalid access-key |
E_EPH_01 | 404 | Policy holder not found |
E_EPA_014 | 404 | Policy not found |
E_EPA_01 | 404 | Patient not found |
Example Error Responses
Patient Not Found:
{
"ErrorCode": "E_EPA_01",
"message": "Patient not found",
"details": []
}
Patient-Policy Operations
Add Bulk Patients to Policy Synchronously
POST /policy/bulk-patient-to-policy
Synchronously add multiple patients to a policy in a single request. Each entry in the array specifies the patient, network, and category for the assignment.
For large datasets exceeding +3,000 members members, use the async bulk endpoint instead. The synchronous endpoint is suited for smaller batches.
Request Body
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
policy_no * | string | Yes | Policy number | Alphanumeric string |
ph_erp_id * | string | Yes | ERP ID of the policy holder | Alphanumeric string |
patients * | array | Yes | Array of patient objects to add to the policy | See patient object below |
Patient object:
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
card | string | No | Card number | Alphanumeric string |
member_id * | string | Yes | Member ID of the patient | Alphanumeric string |
name | string | No | Patient name | String, 1-255 characters |
email | string | No | Patient email address | Valid email format |
relation | string | No | Relationship to policy holder | Enum: SELF, FATHER, MOTHER, SON, DAUGHTER, SISTER, HUSBAND, WIFE, WIFE_WITHOUT_MATERNITY, MOTHER_MB, SENIOR_EMPLOYEE, FEMALE_EMPLOYEE_WITH_MAT, CHILD, SPOUSE, EMPLOYEE, OTHER |
national_id | string | No | National ID number | Alphanumeric string |
visit_visa_number | string | No | Visit visa number | Alphanumeric string |
passport | string | No | Passport number | Alphanumeric string |
phone_number | string | No | Phone number | String (e.g., +966555555555) |
address | string | No | Patient address | String, max 500 characters |
gender * | string | Yes | Patient gender | Enum: MALE, FEMALE |
marital_status * | string | Yes | Marital status | Enum: SINGLE, MARRIED, ENGAGED, UNKNOWN, WIDOWED, DIVORCED, SEPARATED |
nationality | string | No | Patient nationality | String |
date_of_birth * | string | Yes | Date of birth | ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ |
network_code | string | No | Network code to associate | Alphanumeric string |
is_vip | boolean | No | VIP flag | true, false (default: false) |
insured_notes | string | No | Notes about the insured patient | String, max 500 characters |
category_code * | string | Yes | Category code for the patient | Alphanumeric string |
additional_date | string | No | Additional date (e.g., policy addition date) | ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ |
effective_start_date * | string | Yes | Coverage start date | ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ |
effective_end_date * | string | Yes | Coverage end date | ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ |
Code Examples
- cURL
- JavaScript
- Python
curl -X POST \
"https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/bulk-patient-to-policy" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"policy_no": "POL-2024-001",
"ph_erp_id": "PH-ERP-12345",
"patients": [
{
"card": "12345",
"member_id": "MEMBER001",
"name": "Alaa",
"email": "alaa@najeeb.ai",
"relation": "SELF",
"national_id": "1234567890",
"phone_number": "+966555555555",
"gender": "MALE",
"marital_status": "SINGLE",
"nationality": "ARABIC",
"date_of_birth": "1992-01-01T00:00:00.000Z",
"network_code": "NET-001",
"is_vip": false,
"insured_notes": "Primary beneficiary",
"category_code": "A",
"additional_date": "2024-01-01T00:00:00.000Z",
"effective_start_date": "2024-01-01T00:00:00.000Z",
"effective_end_date": "2024-12-31T00:00:00.000Z"
},
{
"member_id": "MEMBER002",
"name": "Sara",
"relation": "SPOUSE",
"gender": "FEMALE",
"marital_status": "MARRIED",
"date_of_birth": "1995-06-15T00:00:00.000Z",
"network_code": "NET-001",
"category_code": "B",
"effective_start_date": "2024-01-01T00:00:00.000Z",
"effective_end_date": "2024-12-31T00:00:00.000Z"
}
]
}'
const response = await fetch(
"https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/bulk-patient-to-policy",
{
method: "POST",
headers: {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
policy_no: "POL-2024-001",
ph_erp_id: "PH-ERP-12345",
patients: [
{
card: "12345",
member_id: "MEMBER001",
name: "Alaa",
email: "alaa@najeeb.ai",
relation: "SELF",
national_id: "1234567890",
phone_number: "+966555555555",
gender: "MALE",
marital_status: "SINGLE",
nationality: "ARABIC",
date_of_birth: "1992-01-01T00:00:00.000Z",
network_code: "NET-001",
is_vip: false,
insured_notes: "Primary beneficiary",
category_code: "A",
additional_date: "2024-01-01T00:00:00.000Z",
effective_start_date: "2024-01-01T00:00:00.000Z",
effective_end_date: "2024-12-31T00:00:00.000Z",
},
{
member_id: "MEMBER002",
name: "Sara",
relation: "SPOUSE",
gender: "FEMALE",
marital_status: "MARRIED",
date_of_birth: "1995-06-15T00:00:00.000Z",
network_code: "NET-001",
category_code: "B",
effective_start_date: "2024-01-01T00:00:00.000Z",
effective_end_date: "2024-12-31T00:00:00.000Z",
},
],
}),
}
);
const data = await response.json();
console.log(data);
import requests
url = "https://api.{client_namespace}.najeeb.ai/v4.0/health/policy/bulk-patient-to-policy"
payload = {
"policy_no": "POL-2024-001",
"ph_erp_id": "PH-ERP-12345",
"patients": [
{
"card": "12345",
"member_id": "MEMBER001",
"name": "Alaa",
"email": "alaa@najeeb.ai",
"relation": "SELF",
"national_id": "1234567890",
"phone_number": "+966555555555",
"gender": "MALE",
"marital_status": "SINGLE",
"nationality": "ARABIC",
"date_of_birth": "1992-01-01T00:00:00.000Z",
"network_code": "NET-001",
"is_vip": False,
"insured_notes": "Primary beneficiary",
"category_code": "A",
"additional_date": "2024-01-01T00:00:00.000Z",
"effective_start_date": "2024-01-01T00:00:00.000Z",
"effective_end_date": "2024-12-31T00:00:00.000Z",
},
{
"member_id": "MEMBER002",
"name": "Sara",
"relation": "SPOUSE",
"gender": "FEMALE",
"marital_status": "MARRIED",
"date_of_birth": "1995-06-15T00:00:00.000Z",
"network_code": "NET-001",
"category_code": "B",
"effective_start_date": "2024-01-01T00:00:00.000Z",
"effective_end_date": "2024-12-31T00:00:00.000Z",
},
],
}
headers = {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Response
Success Response (200 OK)
Returns a summary of the bulk operation results.