# Prescription Create

| **API URL**     | {{url}}/spice-service/prescription-request/create |
| --------------- | ------------------------------------------------- |
| **Method**      | POST                                              |
| **Description** | Prescription create for the patient               |

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

| **Field Name**         | **Type** | **Mandatory** | **Example**                                                                                                                             |
| ---------------------- | -------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| encounter              | String   | Yes           | Encounter details of the patient                                                                                                        |
| id                     | Bigint   | Yes           | Encounter id                                                                                                                            |
| patientReference       | Bigint   | yes           | Patient Reference                                                                                                                       |
| referred               | Boolean  | Yes           | Patient referred status                                                                                                                 |
| patientId              | Bigint   | Yes           | Patient id                                                                                                                              |
| memberId               | Bigint   | Yes           | Household member ID                                                                                                                     |
| startTime              | Date     | Yes           | Start Time                                                                                                                              |
| endTime                | Date     | Yes           | End Time                                                                                                                                |
| provenance             | String   | Yes           | Provenance details of the organization                                                                                                  |
| latitude               | Long     | Yes           | Location of the registration                                                                                                            |
| longitude              | Long     | Yes           | Location of the registration                                                                                                            |
| visitNumber            | Bigint   | Yes           | Visit Number of patient                                                                                                                 |
| prescriptions          | String   | Yes           | Prescriptions details                                                                                                                   |
| prescribedDays         | Bigint   | Yes           | Prescribed Days                                                                                                                         |
| medicationName         | String   | Yes           | Medication Name                                                                                                                         |
| medicationId           | Bigint   | Yes           | Medication Id                                                                                                                           |
| frequency              | Bigint   | Yes           | Medication Frequency                                                                                                                    |
| frequencyName          | String   | Yes           | Medication Frequency Name                                                                                                               |
| prescribedSince        | Date     | Yes           | Prescribed Since                                                                                                                        |
| endDate                | Date     | Yes           | End Date                                                                                                                                |
| isActive               | Boolean  | Yes           | Active status check                                                                                                                     |
| isDeleted              | Boolean  | Yes           | Deleted check                                                                                                                           |
| codeDetails            | String   | Yes           | Code Details                                                                                                                            |
| code                   | String   | Yes           | Code for prescribtion                                                                                                                   |
| url                    | String   | Yes           | URL for the prescribtion                                                                                                                |
| signature              | String   | Yes           | Signature for prescribed                                                                                                                |
| Authorization (Header) | String   | Yes           | Bearer 1ba363a1edf54402b51f58060aa52b11d30f99a490295adec900fdabf2b472181c0bfb165be18f4f5c430c7218a244bd29b9300d3471acc08197ccfb996118f6 |
| client                 | String   | Yes           | mob                                                                                                                                     |

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

{\
"encounter": {\
"id": null,\
"patientVisitId": null,\
"patientReference": "1",\
"referred": false,\
"patientId": "22",\
"patientStatus": null,\
"memberId": "1",\
"startTime": null,\
"endTime": null,\
"householdId": null,\
"provenance": {\
"userId": "1",\
"spiceUserId": 22,\
"organizationId": "9",\
"modifiedDate": "2025-01-22T06:14:45+00:00"\
},\
"latitude": null,\
"longitude": null,\
"visitNumber": 0,\
"visitId": null\
},\
"prescriptions": \[\
{\
"prescribedDays": 51,\
"medicationName": "Paracetomol",\
"medicationId": "22",\
"frequency": 1,\
"frequencyName": "OD",\
"prescribedSince": "2025-01-22T06:14:45+00:00",\
"endDate": null,\
"prescriptionId": null,\
"discontinuedReason": null,\
"discontinuedDate": null,\
"encounterId": null,\
"isActive": true,\
"isDeleted": false,\
"codeDetails": {\
"code": ", m",\
"url": ",m"\
},\
"classificationName": null,\
"brandName": null,\
"dosageFrequencyName": null,\
"dosageUnitName": null,\
"dosageUnitValue": null,\
"instructionNote": null,\
"dosageFormName": null,\
"prescriptionRemainingDays": 0,\
"prescriptionFilledDays": 0,\
"dispenseRemainingDays": 0,\
"lastReFillDate": null,\
"reason": null\
}\
],\
"signature": "sample\_file",\
"signatureFile": null,\
"prescriptionId": null,\
"discontinuedReason": null,\
"provenance": null\
}

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

| **Field Name**   | **Type** | **Comments**                              |
| ---------------- | -------- | ----------------------------------------- |
| message          | String   | Prescription created/updated Successfully |
| patientReference | BigInt   | Patinet reference id                      |
| encounterId      | BigInt   | Encounter Id                              |
| status           | Boolean  | Response status                           |

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

```
{
  "message": "Prescription created/updated Successfully.",
  "entity": {
    "patientReference": "1",
    "encounterId": "2"
  },
  "status": true,
  "entityList": null,
  "responseCode": 200,
  "totalCount": null
}
```


---

# Agent Instructions: 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:

```
GET https://spice.docs.medtroniclabs.org/engineering/api-documentation/spice-service/prescription/prescription-create.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
