> For the complete documentation index, see [llms.txt](https://spice.docs.medtroniclabs.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spice.docs.medtroniclabs.org/engineering/api-documentation/spice-service/patient-search.md).

# Patient Search

| **API URL**     | {{url}}/spice-service/patient/search |
| --------------- | ------------------------------------ |
| **Method**      | POST                                 |
| **Description** | Search Patient List                  |

#### **Input:** <a href="#patientsearch-v2-input" id="patientsearch-v2-input"></a>

| **Field Name**         | **Type** | **Mandatory** | **Example**                                                                                                                             |
| ---------------------- | -------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization (Header) | String   | Yes           | Bearer 1ba363a1edf54402b51f58060aa52b11d30f99a490295adec900fdabf2b472181c0bfb165be18f4f5c430c7218a244bd29b9300d3471acc08197ccfb996118f6 |
| client                 | String   | Yes           | mob                                                                                                                                     |
| countryId              | Integer  | Yes           | Country Id                                                                                                                              |
| districtId             | Integer  | Yes           | District Id                                                                                                                             |
| limit                  | Integer  | Yes           | Limit of data to fetch                                                                                                                  |
| searchText             | String   | Yes           | Search Term to filter data                                                                                                              |
| siteId                 | Integer  | Yes           | Site id                                                                                                                                 |
| skip                   | Integer  | Yes           | Number of content to skip                                                                                                               |
| sort                   | String   | Yes           | Sort the data                                                                                                                           |
| isRedRisk              | Boolean  | Yes           | Red risk indication                                                                                                                     |
| tenantId               | Integer  | Yes           | Tenant if of user                                                                                                                       |
| type                   | String   | Yes           | Type                                                                                                                                    |

#### **Sample Input:** <a href="#patientsearch-v2-sampleinput" id="patientsearch-v2-sampleinput"></a>

{\
"countryId": 1,\
"districtId": 1,\
"limit": 15,\
"searchText": "One",\
"siteId": "9",\
"skip": 1,\
"sort": {\
"isRedRisk": true\
},\
"tenantId": 1405,\
"type": "my\_patients"\
}

#### **Output:** <a href="#patientsearch-v2-output" id="patientsearch-v2-output"></a>

| **Field Name**      | **Type** | **Comments**                      |
| ------------------- | -------- | --------------------------------- |
| message             | String   | Patient List fetched successfully |
| id                  | Integer  | Patient id                        |
| name                | String   | Patient Name                      |
| birthDate           | Date     | Data of birth of patient          |
| patientId           | BigInt   | Patinet reference id              |
| gender              | String   | Patient gender                    |
| village             | String   | Village details                   |
| villageId           | BigInt   | Village id                        |
| phoneNumber         | Bigint   | Patient Phone number              |
| phoneNumberCategory | String   | Category of patient               |
| isPregnant          | Boolean  | Pregnant status of patient        |
| isActive            | Boolean  | Patient status                    |
| status              | Boolean  | Response status                   |

#### **Sample Output:** <a href="#patientsearch-v2-sampleoutput" id="patientsearch-v2-sampleoutput"></a>

```
{
  "message": "Patients List fetched successfully.",
  "entity": {
    "patientList": [
      {
        "requestFrom": null,
        "id": "1",
        "name": "Leon wife",
        "nationalId": null,
        "birthDate": "1997-11-15T00:00:00+00:00",
        "patientId": "2211",
        "gender": "FEMALE",
        "village": "Leon Sl Village",
        "villageId": "1",
        "phoneNumber": "8665XX55",
        "phoneNumberCategory": "personal",
        "age": null,
        "memberReference": null,
        "memberId": null,
        "fhirUrl": null,
        "motherPatientId": null,
        "householdId": null,
        "isPregnant": true,
        "isActive": true,
        "diagnosisType": null,
        "identityType": null,
        "identityValue": null,
        "patientStatus": null,
        "dateOfBirth": null,
        "chw": null,
        "type": null,
        "performer": null,
        "hhid": null
      }
    ],
    "referencePatientId": null,
    "totalCount": 1
  },
  "status": true,
  "entityList": null,
  "responseCode": 200,
  "totalCount": null
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://spice.docs.medtroniclabs.org/engineering/api-documentation/spice-service/patient-search.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
