# Shipment

You can enable a mini cart view in the following requests to show changes to the cart immediately. Find out more in the [views-for-cart-modifying-operations](https://dev.ucommerce.net/readme/headless/reference/views-for-cart-modifying-operations "mention")

## Prerequisites

* `access_token` from [headless-api-authentication](https://dev.ucommerce.net/readme/headless/headless-api-authentication "mention")
* `cartId` from [#create-a-cart](https://dev.ucommerce.net/readme/headless/cart#create-a-cart "mention")
* `countryId` from from [countries](https://dev.ucommerce.net/readme/headless/reference/countries "mention")
* `shippingMethodId` from [shipping-methods](https://dev.ucommerce.net/readme/headless/reference/shipping-methods "mention")
* `priceGroupId` from the cart or from [price-groups](https://dev.ucommerce.net/readme/headless/reference/price-groups "mention")

## Add shipping information

### Request

```bash
curl -D- -X POST <base_url>/api/v1/carts/<cartId>/shipping \
        -H 'Authorization: Bearer <ACCESS_TOKEN>'
        -H 'Content-Type: application/json' \
        -d '{
            "priceGroupId": "<priceGroupId>",
            "shippingMethodId": "<shippingMethodId>",
            "shippingAddress": {
                    "attention":"<attention>",
                    "city": "<city>",
                    "companyName":"<companyName>",
                    "countryId": "<countryId>",
                    "email":"<email>",
                    "firstName": "<firstName>",
                    "lastName": "<lastName>",
                    "line1": "<addressLine1>",
                    "line2": "<addressLine2>",
                    "mobileNumber":"<mobileNumber>",
                    "phoneNumber":"<phoneNumber>",
                    "postalCode": "<postalCode>",
                    "state":"<state>",
                },
            }'
```

### Response

```json
{
"success": "true"
}
```

### Error Handling

| Error              | Description                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| BadRequest (400)   | Missing or incorrect access token; Bad or missing request data; pipeline execution fails; etc. |
| Unauthorized (401) | The token is expired.                                                                          |
| Forbidden (403)    | The token does not have access to this endpoint.                                               |
| NotFound (404)     | Cart not found; Country not found; Price group not found.                                      |

Error Response Example

```json
{
"errors":
    [
        {
            "error-description": "Country not found.",
            "error": "NotFound"
        }
    ]
}
```

## Related Articles

{% content-ref url="../error-handling" %}
[error-handling](https://dev.ucommerce.net/readme/headless/error-handling)
{% endcontent-ref %}
