> For the complete documentation index, see [llms.txt](https://docs.violet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violet.io/prism/checkout-guides/carts-and-bags/shipping-methods.md).

# Shipping Methods

Shipping Methods are applied to Violet at the `Bag` level, since each Merchant can have their own shipping configurations. Once a shipping address has been added to a cart, you can use our Shipping Method endpoints to retrieve and apply methods.

{% hint style="info" %}
Violet shows shipping methods based on what the Merchant has configured in their store through their e-commerce platform. They do not configure these in Violet. For example, you can learn about how Shopify stores configure shipping methods [here](https://merchant-help.violet.io/platform-guides/shopify/shipping).
{% endhint %}

**Retrieve Shipping Methods**

You can use the [Retrieve Shipping Methods](/api-reference/orders-and-checkout/cart-shipping/get-available-shipping-methods.md) endpoint to retrieve shipping methods, once a shipping address has been added to the Order, as seen below:

```bash
curl https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/shipping/available \
-H "X-Violet-App-Id: your-app-id-here" \
-H "X-Violet-App-Secret: your-app-secret-here" \
-H "X-Violet-Token: your-token-here" \
-H "Content-type: application/json"
```

This call is at the Cart level, however, notice that the response contains shipping methods at the Bag (i.e. merchant) level.

```json
[
    {
        "bag_id": 20440,
        "shipping_methods": [
            {
                "carrier": "OTHER",
                "label": "International Shipping",
                "price": 2000,
                "shipping_method_id": "shopify-International%20Shipping-20.00",
                "bag_id": 20440
            }
        ]
    },
		{
        "bag_id": 20441,
        "shipping_methods": [
            {
                "carrier": "USPS",
                "label": "US Domestic",
                "price": 999,
                "shipping_method_id": "shopify-usps%20Shipping-9.99",
                "bag_id": 20441
            }
        ]
    }
]
```

**Applying Shipping Methods**

Once you’ve retrieved shipping methods, you can use the [Apply Shipping Methods](/api-reference/orders-and-checkout/cart-shipping/set-shipping-methods.md) endpoint to attach these shipping methods to `Bags`. Each bag in a cart will require its own shipping method. For this reason, data is passed in as a collection of shipping methods, one for each bag. If you only have one bag in your cart you will pass in a collection consisting of one shipping method, as seen below:

```bash
curl -X POST https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/shipping \
-H "X-Violet-App-Id: your-app-id-here" \
-H "X-Violet-App-Secret: your-app-secret-here" \
-H "X-Violet-Token: your-token-here" \
-H "Content-type: application/json" \
-d '[{"bag_id": 1, "shipping_method_id": "usps-flatrate"}]'
```

The response will then be an `Order` object, on which you will notice that now, each bag on the order you are applying shipping methods to will contain a `shipping_method` object. If there are any errors while applying shipping methods, the order will return with errors listed in the `errors` field on the object.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.violet.io/prism/checkout-guides/carts-and-bags/shipping-methods.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
