---
# System prepended metadata

title: CHIP-API Doc
tags: [masm]

---

## ENVIRONMENTS:
1. TEST

[BASE URL] (https://simplehealth.cloud)

2. PRODUCTION
 
TBC

## LOG IN:

| POST | /login-app| 
| -------- | -------- | 
| OK     | 200     | 

**Path Parameters:**

| Parameter | Data Type | Optionality |
| -------- | -------- | -------- |
| username     | varchar     | Required     |
| password | varchar | Required |

**REQUEST BODY**
```
{
    "username": "XXXXXXX",
    "password": "*******"
}
```
## SUCCESSFUL CALL SAMPLE ##
| GET | /api/v1/membership/{membership_number}| 
| -------- | -------- | 
| OK     | 200     | 

Successful API calls e.g. sending an existent membership number will result in the following message:
```
{
 "success": false,
 "msg": null,
 "data": { // full details
 
 }
}
```

## UNSUCCESSFUL CALL SAMPLE ##
| GET | /api/v1/membership/{membership_number}/{suffix} | 
| -------- | -------- | 
| OK     | 200     | 

API calls with a business error, e.g. sending a non-existent ```membership_number``` will result in the following message:
```
{
 "success": false,
 "msg": "No such member was found",
 "data": null
}
```


## MEMBER LOOKUP API

| GET | /api/v1/membership/{membership_number}| 
| -------- | -------- | 
| OK     | 200     | 

**Path Parameters:**

| Parameter | Data Type | Optionality |
| -------- | -------- | -------- |
| membership_number     | varchar     | Required 



**RESPONSE**

```mermaid
{
    "success": true,
    "msg": null,
    "data": {
        "principal": {
            "member_id": 14,
            "national_id": "987654321",
            "membership_number": "12599-00",
            "suffix_number": "00",
            "payer": "TNM",
            "shortfall": false,
            "wait_period": false,
            "excess": false,
            "waiver": false,
            "phone_number": "08479983933",
            "email_address": "rmatrutto@gmail.com",
            "first_name": "FELIX",
            "other_names": "NOAH",
            "last_name": "KIM",
            "gender": "MALE",
            "date_of_birth": "1990-11-28",
            "scheme_type": "CORPORATE",
            "status": "ACTIVE",
            "relationship": "PRINCIPAL",
            "dependant_type": "PRINCIPAL",
            "mra_number": 1234567,
            "last_paid": "2024-04-01"
        },
        "dependants": [
            {
                "member_id": 15,
                "national_id": "987654321",
                "membership_number": "12599-01",
                "suffix_number": "01",
                "payer": "TNM",
                "shortfall": false,
                "wait_period": false,
                "excess": false,
                "waiver": false,
                "phone_number": "098242232",
                "email_address": "rmatrutto@gmail.com",
                "first_name": "MARY",
                "other_names": "ROSE",
                "last_name": "KIM",
                "gender": "FEMALE",
                "date_of_birth": "1995-11-28",
                "scheme_type": "CORPORATE",
                "status": "ACTIVE",
                "relationship": null,
                "dependant_type": "ADULT",
                "mra_number": 1234567,
                "last_paid": "2024-04-01"
            },
            {
                "member_id": 16,
                "national_id": "987654321",
                "membership_number": "12599-02",
                "suffix_number": "02",
                "payer": "TNM",
                "shortfall": false,
                "wait_period": false,
                "excess": false,
                "waiver": false,
                "phone_number": "082323433",
                "email_address": "rmatrutto@gmail.com",
                "first_name": "DAN",
                "other_names": "JAMES",
                "last_name": "MWAYI",
                "gender": "FEMALE",
                "date_of_birth": "2000-11-28",
                "scheme_type": "CORPORATE",
                "status": "ACTIVE",
                "relationship": null,
                "dependant_type": "CHILD",
                "mra_number": 1234567,
                "last_paid": "2024-04-01"
            }
        ]
    }
}

```


## MEMBER BENEFIT API
| GET | /api/v1/membership/{member_id}/benefits | 
| -------- | -------- | 
| OK     | 200     | 

**Path Parameters:**

| Parameter | Data Type | Optionality |
| -------- | -------- | -------- |
| member_id     | Number     | Required     |

```
{
   {
    "success": true,
    "msg": null,
    "data": [
        {
            "member_benefit_id": 39,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Ophthalmology Limit"
        },
        {
            "member_benefit_id": 40,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Mental Health Limit"
        },
        {
            "member_benefit_id": 41,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Blood Transfusion (BLD)"
        },
        {
            "member_benefit_id": 42,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Braces (OPD)"
        },
        {
            "member_benefit_id": 266,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Ophthalmology Limit"
        },
        {
            "member_benefit_id": 268,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Mental Health Limit"
        },
        {
            "member_benefit_id": 270,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Blood Transfusion (BLD)"
        },
        {
            "member_benefit_id": 272,
            "balance": 0.0,
            "member_id": 5,
            "product_id": 11,
            "product": "EXECUTIVE SILVER",
            "benefit_status": "ACTIVE",
            "benefit_name": "Braces (OPD)"
        }
    ]
}

```

## SERVICE PROVIDER ALL TARIFFS API

| GET | /api/v1/provider/{provider_code}/tariffs | 
| -------- | -------- | 
| OK     | 200     | 

**Path Parameters:**

| Parameter | Data Type | Optionality |
| -------- | -------- | -------- |
| provider_code     | Integer     | Required     |


**RESPONSE**

```
{
  "success":true,
  "msg":null,
  "data": [
    {
      "code": 33046,
      "description": "Abiraterone Acetate",
      "authorization_required": true,
      "tax": 0,
      "value": 90000,
      "category": "drug",
      "class": "sample class",
      "provider_id": 1234,
      "provider_name": "Adventist Hospital Blantyre"
    },
    {
      "code": 53021,
      "description": "URINE ANALYSIS(CHEMICAL)",
      "authorization_required": false,
      "tax": 0,
      "value": 119185,
      "category": "lab",
      "class": "sample class",
      "provider_id": 1234,
      "provider_name": "Adventist Hospital Blantyre"
    }
  ]
}
```


## SERVICE PROVIDER SPECIFIC TARIFF API

| GET | /api/v1/provider/{provider_code}/tariffs/{tariff_code} | 
| -------- | -------- | 
| OK     | 200     | 

**Path Parameters:**

| Parameter | Data Type | Optionality |
| -------- | -------- | -------- |
| provider_code     | Integer     | Required     |
| tariff_code | varchar | Required |


**RESPONSE**

```
{
"success":true,
"msg": null,
"data":{
  "code": "33046",
  "code_description": "Abiraterone Acetate",
  "authorization_required": "Y",
  "tax": 0,
  "value": 90000,
  "category": "drug",
  "class": "sample class",
  "provider_id": 1234,
  "provider_name": "Adventist Hospital Blantyre"
}
}
```

## SERVICE PROVIDER API

| GET | /api/v1/providers | 
| -------- | -------- | 
| OK     | 200     | 

**Request Parameters:**

| Parameter | Data Type | Optionality |
| -------- | -------- | -------- |
| page     | Integer     | Required     |
| size | Integer | Required |

**RESPONSE**

```
{
"success":true,
"msg":null,
"data":
    [
      {
        "provider_code": "2120131",
        "provider_type": "Hospital",
        "provider_name": "MASM Clinic Kanjedza"
      },
      {
        "provider_code": "2120132",
        "provider_type": "Hospital",
        "provider_name": "MASM Clinic Area 12"
      }
    ],
"results":300
}

```


## CLAIMS SUBMISSION API

This API call will generate a claim number on the core system sent back in the ```data``` field of a successful ```JSON``` response.


| POST | /api/v1/claims/submit | 
| -------- | -------- | 
| OK     | 200     | 

**REQUEST BODY**


```
{
    "provider_id": 34,
    "provider_name": "MASM CLinic 12",
    "member_name": "John Banda",
    "member_number": "JC9989-00",
    "verification_mode": "BIOMETRIC",
    "claim_date": "20-10-2023",
    "benefit": "Outpatient",
    "benefit_id": 45,
    "sub_benefit": "Dental",
    "sub_benefit_id": 50,
    "booking_id": 1,
    "documents": [
        {
            "id": 123,
            "document_type": "INVOICE",
            "path": "path/to/document",
            "format": "tiff"
        },
        {
            "id": 123,
            "document_type": "INVOICE",
            "path": "path/to/document",
            "format": "tiff"
        }
    ],
    "diagnoses": [
        {
            "code": "J00",
            "standard": "ICD10",
            "description": "Acute nasopharyngitis [Common Cold]"
        }
    ],
    "invoices": [
        {
            "invoice_number": "HO12434",
            "invoice_date": "20-10-2023",
            "amount": 50000,
            "currency": "MWK",
            "line_items": [
                {
                    "description": "Consultation",
                    "unit_price": 20000,
                    "quantity": 1,
                    "line_total": 20000
                },
                {
                    "description": "BRUFEN 200MG TABS 500",
                    "unit_price": 3000,
                    "quantity": 10,
                    "line_total": 30000
                }
            ]
        }
    ]
}
```

**RESPONSE**

```
{
    "success": true,
    "msg": null,
    "data": {
        "id": 9,
        "claimNumber": null,
        "providerName": "MASM CLinic 12",
        "providerCode": 34,
        "benefit": "Outpatient",
        "memberNumber": "JC9989-00",
        "memberName": "John Banda",
        "preAuthNumber": null,
        "diagnoses": [],
        "status": "PENDED",
        "datePicked": null,
        "invoices": [],
        "documents": [],
        "verificationMode": "BIOMETRIC"
    }
}

```

## BENEFIT BOOKING API
This API call will generate a booking number on the core system sent back in the ```data``` field of a successful ```JSON``` response.
| POST | /api/v1/claims/booking | 
| -------- | -------- | 
| OK     | 200     | 

**REQUEST BODY**
```
{
    "provider_id":1,
    "provider_name": "Adventist Hospital",
    "benefit_id":1,
    "membership_number": "HCP/90909-01",
    "member_id":5,
    "amount": 20000,
    "transaction_date": "20-10-2023"
}
```
**RESPONSE**

```
{
  "success": true,
  "msg": null,
  "data":  {
        "booking_id": 8,
        "benefitId": 1,
        "memberId": 5,
        "providerId": 1,
        "amount": 20000,
        "startDate": "2024-03-22",
        "expiry": "2024-03-24",
        "treatmentDate": "2024-03-22",
        "transactionDate": "2023-10-20",
        "bookingType": 1,
        "userId": 1,
        "productVersionId": 1
  }
}

```

## PRE-AUTHORIZATION API
This API call will generate a pre-authorization number on the core system sent back in the ```data``` field of a successful ```JSON``` response.
| POST | /api/v1/claims/pre_authorization | 
| -------- | -------- | 
| OK     | 200     | 

**REQUEST BODY**
```
{
    "provider_id": 1,
    "preauth_type": 1,
    "benefit_id": 1,
    "membership_number": "HCP/90909-01",
    "member_id": 5,
    "reserve": 20000,
    "treatment_date": "20-10-2023",
    "start_date": "20-10-2023",
    "expiry_date": "20-10-2023",
    "effective_date": "20-10-2023",
    "pro_ver_id": 1
}
```
**RESPONSE**

```
{
,
    "success": true,
    "msg": null,
    "data": {
        "preauth_id": 3,
        "provider_id": 1,
        "preauth_type": 1,
        "treatment_date": "2023-10-20",
        "start_date": "2023-10-20",
        "expiry_date": "2023-10-20",
        "effective_date": "2023-10-20",
        "benefit_id": 1,
        "reserve": 20000,
        "member_id": 5,
        "transaction_date": "2024-03-22T06:57:50.628364363",
        "productVersionId": 1,
        "userId": 1
     }
}
```