> 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/submit-parcel-and-assign-qr-code.md).

# Submit Parcel & Assign QR Code

```php
GET /parcels/assignQRCode/{parcel_id}
```

This API is used to generate a new QR code for the parcel (if not generated before) and change parcel status from "Draft" to "Submitted".

{% hint style="info" %}
**Note:** Replace <mark style="color:blue;">{parcel\_id}</mark> with the <mark style="color:blue;">parcel\_code</mark> of the parcel you wish to submit.
{% endhint %}

#### 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

{% code lineNumbers="true" %}

```json
{
    "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,
    "qr_code": "shiply_rs91357",
    "status_id": 2
}
```

{% endcode %}

The response contains 2 values:

* <mark style="color:blue;">qr\_code</mark>: The QR code assigned to the parcel.
* <mark style="color:blue;">status\_id</mark>: The current status of the parcel (can see the corresponding status from parcel statuses listed here [General Definitions](/shiply-integration-documentation/general-definitions.md)).&#x20;
  {% endtab %}

{% tab title="Parcel not found" %}
Status code: <mark style="color:red;">404 not found</mark>

{% code lineNumbers="true" %}

```json
{
    "error": "Parcel not found"
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">{parcel\_id}</mark> provided in the route does not correspond to an existing parcel.
{% endtab %}

{% tab title="Cannot edit parcel" %}
Status code: <mark style="color:red;">400</mark>

{% code lineNumbers="true" %}

```json
{
    "error": "can not edit parcel in this state."
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">{parcel\_id}</mark> provided in the route corresponds to a parcel that is neither in draft nor submitted status.
{% endtab %}

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

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "Failed to assign QR Code, ......."
}
```

{% endcode %}

This response is returned when a database error occurs while attempting to assign a QR code for the parcel.
{% 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 %}
