# Branded to Generic

<mark style="color:green;">`POST`</mark> [`{{apiUrl}}patient/medicines/branded_to_generic`](https://api.evitalrx.in/v1/patient/medicines/branded_to_generic)

Get Alternate medicines with the best in terms of Expiry, Margin, and Price.

#### Request Body

| Name                                            | Type              | Description                                                                                                                                                                                                                   |
| ----------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apikey<mark style="color:red;">\*</mark>        | String            | Authentication Token                                                                                                                                                                                                          |
| medicine\_ids<mark style="color:red;">\*</mark> | Stringified Array | <p>Array of medicine\_ids in the form data</p><p></p><p>\["eGMwtMdst4OkfNrNoAFxRw",  "77eruTI3h1JUg4RqaV20JQ=="]</p>                                                                                                          |
| order\_by                                       | String            | <p>must be one of <strong>epm, mep, pem</strong></p><p></p><p><strong>epm</strong>: Expiry -> Price -> Margin</p><p><strong>mep</strong>: Margin -> Expiry -> Price</p><p><strong>pem</strong>: Price -> Expiry -> Margin</p> |

{% tabs %}
{% tab title="200: OK Success" %}

```json
{
    "status_code": "1",
    "status_message": "Success",
    "datetime": "2022-11-17 10:30:42",
    "data": {
        "eGMwtMdst4OkfNrNoAFxRw==": { // medicine_id
            "data": [],
            "message": "alternative not found",
            "status": 0
        },
        "77eruTI3h1JUg4RqaV20JQ==": {
            "data": [
                {
                    "mrp": 204.97,
                    "batch": "C2VAV19",
                    "expiry": "11-23",
                    "packing_size": "1 Bottle of  5 Ml",
                    "medicine_name": "Moxicip D Eye Drop",
                    "manufacturer_name": "Cipla Ltd",
                    "margin_percentage": "23.20",
                    "medicine_id": "M1AGVZYv89bWlk7/oWbG4Q=="
                }
            ],
            "message": "success",
            "status": 1
        }
    }
}
```

{% endtab %}

{% tab title="200: OK No Medicines found" %}

```json
{
    "status_code": "1",
    "status_message": "Success",
    "datetime": "2022-12-08 16:20:45",
    "data": {
        "1iFlObGAoedKDQW27+2EQw==": {
            "data": [],
            "message": "alternative not found",
            "status": 0
        }
    }
}
```

{% endtab %}

{% tab title="200: OK Validation Error" %}

```json
{
    "status_code": "0",
    "status_message": "Invalid medicine key",
    "datetime": "2022-12-07 11:24:25",
    "data": null
}
```

{% endtab %}
{% endtabs %}


---

# 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://docs.evitalrx.in/api-for-patient-app/medicines/branded-to-generic.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.
