إنتقل إلى المحتوى الرئيسي

Policy Holder

important

Policy holders must be created before creating policies. The ph_erp_id is used to link policies to their holder.

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.

API Endpoints

Create Policy Holder

POST /policy-holder/create

Creates a new policy holder record.

Request Headers

HeaderTypeRequiredDescription
access-keystringYesAPI key for authentication
Content-TypestringYesMust be application/json

Request Body Parameters

ParameterTypeRequiredDescriptionAccepted Values
ph_erp_id *stringYesERP code of the policy holder. Must be unique across the system.Alphanumeric string, 1-50 characters
name *stringYesName of the policy holder.String, 1-255 characters
insurance_typestringYesInsurance type of the policy holder.Enum: NORMAL, VIP, VVIP
provincestringNoProvince of the policy holder.String, 1-255 characters
registration_numberstringNoRegistration number. Must be unique if provided.String, 1-255 characters

Response

Success Response (201 Created)
{
"ERPCode": "PH-ERP-12345",
"code": 201,
"message": "Created successfully"
}
Response Fields
FieldTypeDescription
ERPCodestringERP code of the created policy holder
codenumberHTTP status code (201)
messagestringSuccess message

Error Responses

Error Response Structure
{
"code": "number",
"message": "string"
}
Error Codes
Error CodeHTTP StatusDescription
400400Request validation failed — required fields missing or invalid
409409Conflict — duplicate ERP code, name, or registration number
Example Error Responses

Bad Request:

{
"code": 400,
"message": "Validation error: 'name' is required"
}

Conflict:

{
"code": 409,
"message": "Duplicate ERP code: PH-ERP-12345 already exists"
}
Conflict Reasons

A 409 Conflict error is returned when:

  • A policy holder with the same ph_erp_id already exists
  • A policy holder with the same name already exists
  • A policy holder with the same registration_number already exists

Code Examples

curl -X POST "https://api.{client_namespace}.najeeb.ai/v4.0/health/policy-holder/create" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ph_erp_id": "PH-ERP-12345",
"name": "Acme Insurance Holdings",
"insurance_type": "NORMAL",
"province": "Riyadh",
"registration_number": "REG-2024-001"
}'

Update Policy Holder

PATCH /policy-holder/update

Updates an existing policy holder identified by its ERP code.

Request Headers

HeaderTypeRequiredDescription
access-keystringYesAPI key for authentication
Content-TypestringYesMust be application/json

Request Body Parameters

ParameterTypeRequiredDescriptionAccepted Values
identifier *stringYesERP code of the policy holder to update.Alphanumeric string, 1-50 characters
namestringNoUpdated name of the policy holder.String, 1-255 characters
provincestringNoUpdated province.String, 1-255 characters
registration_numberstringNoUpdated registration number. Must be unique if provided.String, 1-255 characters
insurance_typestringNoUpdated insurance type.Enum: NORMAL, VIP, VVIP

Response

Success Response (200 OK)
{
"message": "Policy holder updated successfully",
"data": {
"ph_erp_id": "PH-ERP-12345",
"name": "Acme Insurance Holdings International",
"insurance_type": "NORMAL",
"province": "Jeddah",
"registration_number": "REG-2024-001"
}
}
Response Fields
FieldTypeDescription
messagestringSuccess message
dataobjectUpdated policy holder object
data.ph_erp_idstringERP code of the policy holder
data.namestringName of the policy holder
data.insurance_typestringInsurance type
data.provincestringProvince
data.registration_numberstringRegistration number

Error Responses

Error Response Structure
{
"code": "number",
"message": "string"
}
Error Codes
Error CodeHTTP StatusDescription
400400Request validation failed — invalid field values
404404Policy holder not found for the provided identifier
409409Conflict — updated values conflict with an existing policy holder
Example Error Responses

Bad Request:

{
"code": 400,
"message": "Validation error: 'identifier' is required"
}

Not Found:

{
"code": 404,
"message": "Policy holder not found"
}

Conflict:

{
"code": 409,
"message": "Duplicate name: a policy holder with this name already exists"
}

Code Examples

curl -X PATCH "https://api.{client_namespace}.najeeb.ai/v4.0/health/policy-holder/update" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"identifier": "PH-ERP-12345",
"name": "Acme Insurance Holdings International",
"province": "Jeddah"
}'