Network
The Network module allows you to create and manage medical networks. Networks group medical providers together and can be associated with insurance policies to define which providers are eligible to serve members under a given plan.
Base URL
https://api.{client_namespace}.najeeb.ai/v4.0/health
Replace {client_namespace} with your organization's assigned namespace.
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 Network
POST /network/create
Create a new medical network.
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
access-key | string | Yes | API key for authentication |
Content-Type | string | Yes | Must be application/json |
Request Body Parameters
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
name * | string | Yes | The name of the network. Must be unique. | String, 1-255 characters |
is_vip | boolean | No | Whether this network is designated as VIP. | true, false (default: false) |
Response
Success Response (201 Created)
{
"internal_id": 1,
"name": "City General Hospital Network",
"is_vip": false,
"code": 201,
"message": "Network created successfully"
}
Response Fields
| Field | Type | Description |
|---|---|---|
internal_id | integer | The unique identifier of the created network |
name | string | The name of the network |
is_vip | boolean | VIP status of the network |
code | integer | HTTP status code (201) |
message | string | Human-readable success message |
Error Responses
Error Response Structure
{
"ErrorCode": "string",
"message": "string",
"details": ["string"]
}
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
E_BAD_REQUEST_400 | 400 | Request validation failed -- the request body is malformed or missing required fields |
401 Unauthorized | 401 | Missing or invalid access-key |
E_CONFLICT_409 | 409 | A network with the same name already exists |
Example Error Responses
Bad Request:
{
"ErrorCode": "E_BAD_REQUEST_400",
"message": "Bad request",
"details": [
"name must be a string",
"name should not be empty"
]
}
Unauthorized:
{
"ErrorCode": "API key is required",
"message": "Unauthorized",
"details": []
}
Conflict:
{
"ErrorCode": "E_CONFLICT_409",
"message": "A network with this name already exists",
"details": []
}
Code Examples
- cURL
- JavaScript
- Python
curl -X POST "https://api.{client_namespace}.najeeb.ai/v4.0/health/network/create" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "City General Hospital Network",
"is_vip": false
}'
const response = await fetch(
"https://api.{client_namespace}.najeeb.ai/v4.0/health/network/create",
{
method: "POST",
headers: {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "City General Hospital Network",
is_vip: false,
}),
}
);
const data = await response.json();
console.log(data);
import requests
response = requests.post(
"https://api.{client_namespace}.najeeb.ai/v4.0/health/network/create",
headers={
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"name": "City General Hospital Network",
"is_vip": False,
},
)
result = response.json()
print(result)
Update Network
PATCH /network/update/:id
Update an existing network by its ID. You can modify the network name, VIP status, or both.
At least one field (name or is_vip) must be provided in the request body.
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
access-key | string | Yes | API key for authentication |
Content-Type | string | Yes | Must be application/json |
Path Parameters
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
id * | integer | Yes | The unique identifier of the network | Positive integer |
Request Body Parameters
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
name | string | No | The updated name of the network. Must be unique. | String, 1-255 characters |
is_vip | boolean | No | The updated VIP status of the network. | true, false |
Response
Success Response (200 OK)
{
"id": 1,
"name": "Updated Network Name",
"is_vip": true,
"code": 200,
"message": "Network updated successfully"
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | integer | The unique identifier of the network |
name | string | The updated name of the network |
is_vip | boolean | The updated VIP status of the network |
code | integer | HTTP status code (200) |
message | string | Human-readable success message |
Error Responses
Error Response Structure
{
"ErrorCode": "string",
"message": "string",
"details": ["string"]
}
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
E_BAD_REQUEST_400 | 400 | Request validation failed -- the request body is malformed or contains invalid data |
401 Unauthorized | 401 | Missing or invalid access-key |
E_NOT_FOUND_404 | 404 | No network exists with the specified id |
E_CONFLICT_409 | 409 | A network with the same name already exists |
Example Error Responses
Bad Request:
{
"ErrorCode": "E_BAD_REQUEST_400",
"message": "Bad request",
"details": [
"At least one field (name or is_vip) must be provided"
]
}
Unauthorized:
{
"ErrorCode": "API key is required",
"message": "Unauthorized",
"details": []
}
Not Found:
{
"ErrorCode": "E_NOT_FOUND_404",
"message": "Network not found",
"details": []
}
Conflict:
{
"ErrorCode": "E_CONFLICT_409",
"message": "A network with this name already exists",
"details": []
}
Code Examples
- cURL
- JavaScript
- Python
curl -X PATCH "https://api.{client_namespace}.najeeb.ai/v4.0/health/network/update/1" \
-H "access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Network Name",
"is_vip": true
}'
const networkId = 1;
const response = await fetch(
`https://api.{client_namespace}.najeeb.ai/v4.0/health/network/update/${networkId}`,
{
method: "PATCH",
headers: {
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Updated Network Name",
is_vip: true,
}),
}
);
const data = await response.json();
console.log(data);
import requests
network_id = 1
response = requests.patch(
f"https://api.{{client_namespace}}.najeeb.ai/v4.0/health/network/update/{network_id}",
headers={
"access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"name": "Updated Network Name",
"is_vip": True,
},
)
result = response.json()
print(result)
Find All Networks
GET /network/find-all
Retrieve a paginated list of networks with optional filtering by name and VIP status.
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
access-key | string | Yes | API key for authentication |
Query Parameters
| Parameter | Type | Required | Description | Accepted Values |
|---|---|---|---|---|
name | string | No | Filter by network name (case-insensitive partial match). | String |
is_vip | boolean | No | Filter by VIP status. | true, false |
limit * | number | Yes | Number of records per page. | Integer, 1-100 (default: 10) |
skip * | number | Yes | Number of records to skip (offset). | Integer, minimum 0 (default: 0) |
Response
Success Response (200 OK)
{
"total_count": 25,
"code": 200,
"message": "Networks found successfully",
"data": [
{
"id": 1,
"name": "City General Hospital Network",
"is_vip": false
},
{
"id": 2,
"name": "Premium Care VIP Network",
"is_vip": true
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
total_count | integer | Total number of networks matching the filters |
code | integer | HTTP status code (200) |
message | string | Human-readable success message |
data | array | Array of network objects |
data[].id | integer | The unique identifier of the network |
data[].name | string | The name of the network |
data[].is_vip | boolean | VIP status of the network |
Error Responses
Error Response Structure
{
"ErrorCode": "string",
"message": "string",
"details": ["string"]
}
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
E_BAD_REQUEST_400 | 400 | Request validation failed -- invalid query parameters (e.g., limit out of range) |
401 Unauthorized | 401 | Missing or invalid access-key |
Example Error Responses
Bad Request:
{
"ErrorCode": "E_BAD_REQUEST_400",
"message": "Bad request",
"details": [
"limit must not be greater than 100",
"skip must not be less than 0"
]
}
Unauthorized:
{
"ErrorCode": "API key is required",
"message": "Unauthorized",
"details": []
}
Code Examples
- cURL
- JavaScript
- Python
# Fetch the first page of all networks
curl -X GET "https://api.{client_namespace}.najeeb.ai/v4.0/health/network/find-all?limit=10&skip=0" \
-H "access-key: YOUR_API_KEY"
# Filter by name and VIP status
curl -X GET "https://api.{client_namespace}.najeeb.ai/v4.0/health/network/find-all?name=city&is_vip=false&limit=10&skip=0" \
-H "access-key: YOUR_API_KEY"
const params = new URLSearchParams({
name: "city",
is_vip: "false",
limit: "10",
skip: "0",
});
const response = await fetch(
`https://api.{client_namespace}.najeeb.ai/v4.0/health/network/find-all?${params}`,
{
method: "GET",
headers: {
"access-key": "YOUR_API_KEY",
},
}
);
const data = await response.json();
console.log(`Total networks: ${data.total_count}`);
console.log(data.data);
import requests
response = requests.get(
"https://api.{client_namespace}.najeeb.ai/v4.0/health/network/find-all",
headers={
"access-key": "YOUR_API_KEY",
},
params={
"name": "city",
"is_vip": False,
"limit": 10,
"skip": 0,
},
)
data = response.json()
print(f"Total networks: {data['total_count']}")
print(data["data"])