> 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/calculate-parcel-extra-size-fee.md).

# Calculate Parcel Extra Size Fee

```php
POST /parcels/calculateSizeExtraFee
```

This API is used to calculate the additional cost incurred for a parcel due to its extra size (for size > customer default parcel size).

#### 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="155">Field Name</th><th width="104">Required</th><th width="93">Type</th><th>Notes</th></tr></thead><tbody><tr><td>village_id</td><td>yes</td><td>integer</td><td>It must be a valid <strong>village</strong> id selected from the list retrieved by this API: <a data-mention href="/shiply-integration-documentation/integration-apis/shipping-address/get-cities-and-villages.md">Get Cities And Villages</a></td></tr><tr><td>length</td><td>yes</td><td>integer</td><td></td></tr><tr><td>width</td><td>yes</td><td>integer</td><td></td></tr><tr><td>height</td><td>yes</td><td>integer</td><td></td></tr><tr><td>parcel_id</td><td>no</td><td>string</td><td>This refers to the <mark style="color:blue;">parcel_code</mark> of the parcel.</td></tr><tr><td>companion_id</td><td>no</td><td>integer</td><td>Companion parcel id, if included then calculate extra size fee for it.</td></tr></tbody></table>

Request body example:

{% code lineNumbers="true" %}

```json
{
    "village_id": 105,   
    "length": 80, 
    "width": 40, 
    "height": 80, 
    "parcel_id": "zs6b-7294603",
    "companion_id": 5,
    "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,
    "rejectSize": false,
    "result": "التكلفة الاضافية = 44 يرجى التنسيق مع المكتب",
    "message": "يرجى التسيق مع المكتب لتسليمنا الطلب",
    "fee": 44
}
```

{% endcode %}

The response contains multiple values which are:

* <mark style="color:blue;">rejectSize</mark>: Flag to indicate if the size is rejected or accepted, if false then accepted else then rejected.
* <mark style="color:blue;">result</mark>: Returns a combination of the extra size fee and a message.
* <mark style="color:blue;">message</mark>: The message that will be displayed to the customer.
* <mark style="color:blue;">fee</mark>: The parcel extra size fee.
  {% endtab %}

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

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "Parcel not found"
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">{parcel\_id}</mark> provided in the request body does not correspond to an existing 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 %}
