> For the complete documentation index, see [llms.txt](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/integration-apis/parcels/get-all-parcels.md).

# Get All Parcels

<pre class="language-php"><code class="lang-php"><strong>GET /parcels
</strong></code></pre>

This API is used to retrieve a list of all parcels.

#### Headers

<table><thead><tr><th width="374">Key</th><th>Value</th></tr></thead><tbody><tr><td>Accept</td><td>application/json</td></tr></tbody></table>

#### Request body

Request parameters:

<table><thead><tr><th width="136">Field Name</th><th width="99">Required</th><th width="85">Type</th><th width="311">Notes</th></tr></thead><tbody><tr><td>from</td><td>no</td><td>integer</td><td><strong>Used for pagination:</strong> Specifies the starting number.<br>Default value = 0</td></tr><tr><td>to</td><td>no</td><td>integer</td><td><strong>Used for pagination:</strong> Specifies the ending number.<br>Default value = 20</td></tr></tbody></table>

{% hint style="info" %} <mark style="color:blue;">from</mark> and <mark style="color:blue;">to</mark> in the request body are optional parameters used for partial data retrieval, which is useful for pagination. The specified range should not exceed 100.
{% endhint %}

Request body example:

{% code lineNumbers="true" %}

```json
{
    "from": 0, 
    "to": 20,
    "Shiply_API_KEY": "your_api_key"
}
```

{% endcode %}

#### Response body

{% tabs %}
{% tab title="Success" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "total_count": 749,
    "draft_parcels_count": 434,
    "submitted_parcels_count": 250,
    "delivered_parcels_count": 18,
    "returned_parcels_count": 18,
    "pending_parcels_count": 17,
    "in_delivery_parcels_count": 4,
    "resolved_parcels_count": 6,
    "postponed_parcels_count": 2,
    "current_balance": 5701.5,
    "parcels": [
        {
            "parcel_code": "asnf-000-5829691",
            "description": "حقائب",
            "customer_user_id": 4,
            "driver_user_id": 3,
            "paid_driver_id": null,
            "in_account": 0,
            "parcel_status_id": 10,
            "is_locked": 0,
            "parcel_position_id": 5,
            "address_id": 1469539,
            "recipient_id": 1462520,
            "qr_code": “shiply_157555”,
            "qr_hash": "",
            "region_cost_map_id": null,
            "total_price": 226,
            "actual_price": 204,
            "parcel_delivery_cost": 20,
            "price_extra_fee": 0,
            "planned_date": "2024-11-27",
            "note": null,
            "weight": 5,
            "length": 40,
            "width": 40,
            "height": 40,
            "size_fee": 0,
            "created_at": "2024-08-31 11:25:42",
            "updated_at": "2024-11-16 15:54:43",
            "customer_invoice_id": null,
            "final_parcel_status_id": null,
            "extra_delivery_cost": 0,
            "is_replacement": 0,
            "commission": 0,
            "customer_private_note": null,
            "cell": null,
            "reference_number": null,
            "companion_parcels_count": 0,
            "discount_value": 0,
            "size": 64000,
            "total_size": 64000,
            "contents": [],
            "parcel_status": {
                "id": 10,
                "name": "Resolved",
                "ar_aliase": "تمت المعالجة",
                "en_aliase": "Resolved",
                "description": ""
            },
            "customer": {
                "id": 4,
                "first_name": "demo",
                "customer_contacts": []
            },
            "recipient": {
                "id": 1462520,
                "address_id": 1469539,
                "first_name": "llllll",
                "last_name": null,
                "note": null,
                "phone": "0598765432",
                "phone2": null,
                "is_blocked": 0,
                "created_at": "2024-11-16 11:13:59",
                "updated_at": "2024-11-16 11:13:59"
            },
            "address": {
                "id": 1469539,
                "city_id": 3,
                "village_id": 1,
                "street_name": "عمان",
                "location_updated_at": null,
                "additional_information": null,
                "order": 0,
                "created_at": "2024-11-16 11:13:59",
                "updated_at": "2024-11-16 11:13:59",
                "location_updated_by_user_id": null,
                "hasLocation": false,
                "city": {
                    "id": 9,
                    "name": "عمان"
                },
                "village": {
                    "id": 148,
                    "name": "عمان"
                }
            },
            "driver_note": {
                "id": 15361133,
                "parcel_status_id": 5,
                "parcel_position_id": 5,
                "actor_user_id": 11,
                "driver_id": 3,
                "history_type": 1,
                "note": null,
                "created_at": "2024-09-26 09:50:03",
                "updated_at": "2024-09-26 09:50:03"
            },
            "customer_note": {
                "id": 15361421,
                "parcel_status_id": 10,
                "parcel_position_id": 5,
                "actor_user_id": 4,
                "driver_id": 3,
                "history_type": 1,
                "note": "123",
                "created_at": "2024-10-05 11:44:48",
                "updated_at": "2024-10-05 11:44:48"
            },
            "companion_parcels": [],
            "promotion_usages": []
        },
	................,
	................
       ]
}

```

{% endcode %}

The response contains 2 parts:

* Parcels Counts: The number of parcels is counted based on their status, such as draft, submitted, delivered, etc.
* &#x20;<mark style="color:blue;">parcels</mark> array: This array contains information for all parcels. Each parcel includes multiple parameters, but you may want to focus on the following:\ <mark style="color:blue;">parcel\_code</mark>, <mark style="color:blue;">description</mark>, <mark style="color:blue;">qr\_code</mark>, <mark style="color:blue;">total\_price</mark>, <mark style="color:blue;">parcel\_delivery\_cost</mark>, <mark style="color:blue;">note</mark>, <mark style="color:blue;">extra\_delivery\_cost</mark>, <mark style="color:blue;">parcel\_status.name</mark>, <mark style="color:blue;">recipient.first\_name</mark>, <mark style="color:blue;">recipient.phone</mark>, <mark style="color:blue;">address.city\_id</mark>, <mark style="color:blue;">address.village\_id</mark>, <mark style="color:blue;">address.street\_name</mark>.
  {% endtab %}

{% tab title="Large range" %}
Status code: <mark style="color:red;">400</mark> <mark style="color:red;">Bad Request</mark>

{% code lineNumbers="true" %}

```json
{
    "errors": [],
    "message": "range is too big",
    "status_code": 400,
    "error_code": null,
    "extra_params": []
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">from</mark> - <mark style="color:blue;">to</mark> range exceeds 100.
{% endtab %}

{% tab title="Unauhtorized" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "errors": [
        "unauthorized"
    ]
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">Shiply\_API\_KEY</mark> is not included in the request body.
{% endtab %}
{% endtabs %}
