# Retreive Delivery Orders

## Get delivery orders

<mark style="color:blue;">`GET`</mark> `https://integrations.mipos.shop/api/v1/orders/{store_id}`

Provide a list of all delivery orders from a store in the last 10 minutes that the POS has not sent the status: \
ACCET -> <https://mipos.gitbook.io/public-api/delivery-orders/successful-order-creation\\>
DENY -> <https://mipos.gitbook.io/public-api/delivery-orders/order-creation-failed>

#### Path Parameters

| Name      | Type   | Description              |
| --------- | ------ | ------------------------ |
| store\_id | string | Id store on the platform |

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Authorization | string | Bearer {access\_token} |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "message": "Orders.",
    "data": [
        {
            "external_id": "01f1b8ce-a65d-4876-a72f-8f549f3566b7",
            "created_at": "2020-03-20T04:51:03Z",
            "total": 25800,
            "customer": "Brenda E.",
            "store_id": "3",
            "order_number": "566B7",
            "instructions": "",
            "items": [
                {
                    "external_id": "13753",
                    "name": "El Xolo",
                    "quantity": 2,
                    "unit_value": 10900,
                    "total_unit_value": 12900,
                    "total_value": 25800,
                    "instructions": "",
                    "modifiers": [
                        {
                            "external_id": "3006",
                            "name": "Elige Tus  Papas",
                            "quantity": 1,
                            "unit_value": 0,
                            "total_value": 0
                        },
                        {
                            "external_id": "3012",
                            "name": "Elige tu salchicha",
                            "quantity": 1,
                            "unit_value": 2000,
                            "total_value": 2000
                        }
                    ]
                }
            ],
           "discount_value": 800,
           "delivery_id": 1
        }
    ]
}
```

{% endtab %}

{% tab title="401 " %}

```
"Unauthorized."
```

{% endtab %}

{% tab title="409 " %}

```javascript
{
    "message": [
        "store_id is required.",
        "Store not found.",
        "Could not get the orders of this store."
    ],
    "data": null
}
```

{% endtab %}
{% endtabs %}

## Get filtered orders

<mark style="color:green;">`POST`</mark> `https://integrations.mipos.shop/delivery_data/v1/orders`

This endpoint allows you to get all orders filtered by the  specified parameters.

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Content-Type  | string | application/json      |
| Authorization | string | Bearer{access\_token} |

#### Request Body

| Name          | Type   | Description                      |
| ------------- | ------ | -------------------------------- |
| order\_status | string | Order status(accepter, rejected) |
| order\_number | string | External order number            |
| to\_date      | string | Until specified date             |
| from\_date    | string | Starting from specified date     |
| page          | number | Current page number              |
| store\_ids    | array  | Store ids to search for          |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": "Orders.",
    "data": {
        "total_count": 1,
        "total_pages": 0,
        "orders": [
            {
                "delivery_id": 2,
                "delivery_name": "Rappi",
                "internal_store_id": 10,
                "order_number": "4180290",
                "token": "9F9A70B9E3AEEA445DAE4A5687A80633",
                "external_id": "4180290",
                "order": {
                    "id": "4180290",
                    "totalValue": 3500,
                    "createdAt": "2020-06-25 09:26:10",
                    "products": [
                        {
                            "id": "2134995147",
                            "name": "Agua ",
                            "comments": null,
                            "units": 1,
                            "unitPrice": 3500,
                            "discountPercentage": 0,
                            "unitPriceDiscount": 3500,
                            "totalPrice": 3500,
                            "totalPriceWithDiscount": 3500,
                            "toppings": [
                                {
                                    "id": "340182912",
                                    "name": "Agua con gas",
                                    "units": 1,
                                    "price": 0,
                                    "toppingCategoryId": ""
                                }
                            ]
                        }
                    ],
                    "totalValueWithDiscount": 3500,
                    "deliveryMethod": "delivery",
                    "paymentMethod": "cc",
                    "charges": {
                        "shipping": 0,
                        "service_fee": 0
                    }
                },
                "client": {
                    "id": 0,
                    "firstName": "CONSUMIDOR",
                    "lastName": "FINAL"
                },
                "store": {
                    "id": "900103650",
                    "name": "MiPos Test Store"
                }
            }
        ]
    }
}
```

{% endtab %}

{% tab title="401 " %}

```
Unauthorized.
```

{% endtab %}

{% tab title="422 " %}

```
{
    "store_ids": [
        "The store ids field is required."
    ],
    "page": [
        "The page field is required."
    ]
}
```

{% 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://mipos.gitbook.io/public-api/delivery-orders/retreive-delivery-orders.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.
