> 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/change-parcel-status.md).

# Change Parcel Status

```php
POST /parcels/changeParcelStatusPosition
```

This API is used to change the status of an existing parcel.

#### Headers

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

#### Request body

Request parameters:

<table><thead><tr><th width="139">Field Name</th><th width="124">Required</th><th width="195">Type</th><th>Notes</th></tr></thead><tbody><tr><td>parcel_id</td><td>yes</td><td>array of parcel codes</td><td>It represents the <mark style="color:blue;">parcel_code</mark> of the parcel you wish to change its status.</td></tr><tr><td>status_id</td><td>yes</td><td>integer</td><td><strong>Allowed statuses:</strong>  Returned (7), Resolved (10), On the way (3), Submitted (2), Draft (1).</td></tr><tr><td>note</td><td>no</td><td>string</td><td></td></tr></tbody></table>

Request body example:

{% code lineNumbers="true" %}

```json
{
    "parcel_id": [
        "asnf-000-7811927"
    ],
    "status_id": 10, //resolved (تمت المعالجة)
    "note": "تم التواصل مع المستلم وسيقوم بالاستلام"
    "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
{
    "success": true,
    "failedToSubmit": false,
    "parcelResultStatus": {
        "allowed_parcels": [
            "asnf-000-7811927"
        ],
        "allowed_companion_parcels": [],
        "rejected_parcels": [],
        "rejected_companion_parcels": []
    }
}
```

{% endcode %}

The response contains parcel information.
{% endtab %}

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

{% code lineNumbers="true" %}

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

{% endcode %}

This response is returned when the <mark style="color:blue;">{status\_id}</mark> is not from the following:

* Returned (7)
* Resolved (10)
* On the way (3)
* Submitted (2)
* Draft (1)

Note: You can check the detailed parcel statuses here [General Definitions](/shiply-integration-documentation/general-definitions.md)
{% endtab %}

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

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "errors": [
        "one or more parcels not found"
    ]
}
```

{% endcode %}

This response is returned when one or more of <mark style="color:blue;">{parcel\_id}</mark> provided in the request body are not exist.
{% endtab %}

{% tab title="Unauthorized" %}
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 %}
