> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get available shipping rates

> This return available shipping rates for country based on order amount

This return available shipping rates for country based on order amount

```http theme={null}
POST https://services.leadconnectorhq.com/store/shipping-zone/shipping-rates
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Body

<ParamField body="altId" type="string" required default="6578278e879ad2646715ba9c">
  Account Id or Agency Id
</ParamField>

<ParamField body="altType" type="string" required>
  Posibles valores: 'account'
</ParamField>

<ParamField body="country" type="string" required default="US">
  Country code of the customer Posibles valores: 'US', 'CA', 'AF', 'AX', 'AL', 'DZ', 'AS', 'AD', 'AO', 'AI', 'AQ', 'AG', 'AR', 'AM', 'AW', 'AU', 'AT', 'AZ', 'BS', 'BH', 'BD', 'BB', 'BY', 'BE', 'BZ', 'BJ', 'BM', 'BT', 'BO', 'BA', 'BW', 'BV', 'BR', 'IO', 'BN', 'BG', 'BF', 'BI', 'KH', 'CM', 'CV', 'KY', 'CF', 'TD', 'CL', 'CN', 'CX', 'CC', 'CO', 'KM', 'CG', 'CD', 'CK', 'CR', 'CI', 'HR', 'CU', 'CY', 'CZ', 'DK', 'DJ', 'DM', 'DO', 'EC', 'EG', 'SV', 'GQ', 'ER', 'EE', 'ET', 'FK', 'FO', 'FJ', 'FI', 'FR', 'GF', 'PF', 'TF', 'GA', 'GM', 'GE', 'DE', 'GH', 'GI', 'GR', 'GL', 'GD', 'GP', 'GU', 'GT', 'GG', 'GN', 'GW', 'GY', 'HT', 'HM', 'VA', 'HN', 'HK', 'HU', 'IS', 'IN', 'ID', 'IR', 'IQ', 'IE', 'IM', 'IL', 'IT', 'JM', 'JP', 'JE', 'JO', 'KZ', 'KE', 'KI', 'KP', 'XK', 'KW', 'KG', 'LA', 'LV', 'LB', 'LS', 'LR', 'LY', 'LI', 'LT', 'LU', 'MO', 'MK', 'MG', 'MW', 'MY', 'MV', 'ML', 'MT', 'MH', 'MQ', 'MR', 'MU', 'YT', 'MX', 'FM', 'MD', 'MC', 'MN', 'ME', 'MS', 'MA', 'MZ', 'MM', 'NA', 'NR', 'NP', 'NL', 'AN', 'NC', 'NZ', 'NI', 'NE', 'NG', 'NU', 'NF', 'MP', 'NO', 'OM', 'PK', 'PW', 'PS', 'PA', 'PG', 'PY', 'PE', 'PH', 'PN', 'PL', 'PT', 'PR', 'QA', 'RE', 'RO', 'RU', 'RW', 'SH', 'KN', 'LC', 'MF', 'PM', 'VC', 'WS', 'SM', 'ST', 'SA', 'SN', 'RS', 'SC', 'SL', 'SG', 'SX', 'SK', 'SI', 'SB', 'SO', 'ZA', 'GS', 'KR', 'ES', 'LK', 'SD', 'SR', 'SJ', 'SZ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'TZ', 'TH', 'TL', 'TG', 'TK', 'TO', 'TT', 'TN', 'TR', 'TM', 'TC', 'TV', 'UG', 'UA', 'AE', 'GB', 'UM', 'UY', 'UZ', 'VU', 'VE', 'VN', 'VG', 'VI', 'WF', 'EH', 'YE', 'ZM', 'ZW'
</ParamField>

<ParamField body="address" type="object">
  Address of the customer
</ParamField>

<ParamField body="amountAvailable" type="string" default="US">
  it will not calculate the order amount form backend if it is true Posibles valores: 'AF', 'AX', 'AL', 'DZ', 'AS', 'AD', 'AO', 'AI', 'AQ', 'AG', 'AR', 'AM', 'AW', 'AU', 'AT', 'AZ', 'BS', 'BH', 'BD', 'BB', 'BY', 'BE', 'BZ', 'BJ', 'BM', 'BT', 'BO', 'BA', 'BW', 'BV', 'BR', 'IO', 'BN', 'BG', 'BF', 'BI', 'KH', 'CM', 'CA', 'CV', 'KY', 'CF', 'TD', 'CL', 'CN', 'CX', 'CC', 'CO', 'KM', 'CG', 'CD', 'CK', 'CR', 'CI', 'HR', 'CU', 'CY', 'CZ', 'DK', 'DJ', 'DM', 'DO', 'EC', 'EG', 'SV', 'GQ', 'ER', 'EE', 'ET', 'FK', 'FO', 'FJ', 'FI', 'FR', 'GF', 'PF', 'TF', 'GA', 'GM', 'GE', 'DE', 'GH', 'GI', 'GR', 'GL', 'GD', 'GP', 'GU', 'GT', 'GG', 'GN', 'GW', 'GY', 'HT', 'HM', 'VA', 'HN', 'HK', 'HU', 'IS', 'IN', 'ID', 'IR', 'IQ', 'IE', 'IM', 'IL', 'IT', 'JM', 'JP', 'JE', 'JO', 'KZ', 'KE', 'KI', 'KP', 'KR', 'XK', 'KW', 'KG', 'LA', 'LV', 'LB', 'LS', 'LR', 'LY', 'LI', 'LT', 'LU', 'MO', 'MK', 'MG', 'MW', 'MY', 'MV', 'ML', 'MT', 'MH', 'MQ', 'MR', 'MU', 'YT', 'MX', 'FM', 'MD', 'MC', 'MN', 'ME', 'MS', 'MA', 'MZ', 'MM', 'NA', 'NR', 'NP', 'NL', 'AN', 'NC', 'NZ', 'NI', 'NE', 'NG', 'NU', 'NF', 'MP', 'NO', 'OM', 'PK', 'PW', 'PS', 'PA', 'PG', 'PY', 'PE', 'PH', 'PN', 'PL', 'PT', 'PR', 'QA', 'RE', 'RO', 'RU', 'RW', 'SH', 'KN', 'LC', 'MF', 'PM', 'VC', 'WS', 'SM', 'ST', 'SA', 'SN', 'RS', 'SC', 'SL', 'SG', 'SX', 'SK', 'SI', 'SB', 'SO', 'ZA', 'GS', 'ES', 'LK', 'SD', 'SR', 'SJ', 'SZ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'TZ', 'TH', 'TL', 'TG', 'TK', 'TO', 'TT', 'TN', 'TR', 'TM', 'TC', 'TV', 'UG', 'GB', 'UA', 'AE', 'US', 'UM', 'UY', 'UZ', 'VU', 'VE', 'VN', 'VG', 'VI', 'WF', 'EH', 'YE', 'ZM', 'ZW'
</ParamField>

<ParamField body="totalOrderAmount" type="number" required default="99.99">
  The amount of the price. ( min: 0.01 )
</ParamField>

<ParamField body="weightAvailable" type="boolean" default="True">
  Flag to pass when the weight is already calculated and should not calculate again
</ParamField>

<ParamField body="totalOrderWeight" type="number" required default="10">
  Estimated weight of the order calculated from the order creation side in kg(s)
</ParamField>

<ParamField body="source" type="object" required>
  Source of the order
</ParamField>

<ParamField body="products" type="object[]" required>
  An array of price IDs and quantity

  <Expandable title="cada item">
    <ParamField body="id" type="string" required>
      id of product
    </ParamField>

    <ParamField body="qty" type="number" required>
      No of quantities
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="couponCode" type="string" default="TEST">
  Coupon code
</ParamField>

## Respuestas

<Accordion title="201 - Successful response">
  <ResponseField name="status" type="boolean" required default="True">
    Status of api action
  </ResponseField>

  <ResponseField name="message" type="string" default="Successfully created">
    Success message
  </ResponseField>

  <ResponseField name="data" type="object[]" required>
    Shipping rate data

    <Expandable title="cada item">
      <ResponseField name="name" type="string" required default="North zone">
        Name of the shipping zone
      </ResponseField>

      <ResponseField name="description" type="string" default="Ships next day">
        Delivery description
      </ResponseField>

      <ResponseField name="currency" type="string" required default="USD">
        The currency of the amount of the rate / handling fee
      </ResponseField>

      <ResponseField name="amount" type="number" required default="99.99">
        The amount of the shipping rate if it is normal rate (0 means free ). Fixed Handling fee if it is a carrier rate (it will add to the carrier rate).
      </ResponseField>

      <ResponseField name="isCarrierRate" type="boolean" default="True">
        is this a carrier rate
      </ResponseField>

      <ResponseField name="shippingCarrierId" type="string" required default="655b33a82209e60b6adb87a5">
        Shipping carrier id
      </ResponseField>

      <ResponseField name="percentageOfRateFee" type="number" default="10.99">
        Percentage of rate fee if it is a carrier rate.
      </ResponseField>

      <ResponseField name="shippingCarrierServices" type="object[]">
        An array of items

        <Expandable title="cada item">
          <ResponseField name="name" type="string" required default="Priority Mail Express International">
            Name of the shipping carrier service
          </ResponseField>

          <ResponseField name="value" type="string" required default="PriorityMailExpressInternational">
            Value of the shipping carrier service
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="_id" type="string" required default="655b33a82209e60b6adb87a5">
        The unique identifier for the product.
      </ResponseField>

      <ResponseField name="shippingZoneId" type="string" required default="655b33a82209e60b6adb87a5">
        The unique identifier for the shipping zone.
      </ResponseField>
    </Expandable>
  </ResponseField>

  ```json theme={null}
  {
    "status": true,
    "message": "Successfully created",
    "data": [
      {
        "name": "North zone",
        "description": "Ships next day",
        "currency": "USD",
        "amount": 99.99,
        "isCarrierRate": true,
        "shippingCarrierId": "655b33a82209e60b6adb87a5",
        "percentageOfRateFee": 10.99,
        "shippingCarrierServices": [
          {}
        ],
        "_id": "655b33a82209e60b6adb87a5",
        "shippingZoneId": "655b33a82209e60b6adb87a5"
      }
    ]
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/store/shipping-zone/shipping-rates' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "country": "US",
    "amountAvailable": "US",
    "totalOrderAmount": 99.99,
    "weightAvailable": true,
    "totalOrderWeight": 10,
    "source": {
      "type": "order",
      "subType": "store"
    },
    "products": [
      {
        "id": "string",
        "qty": 0
      }
    ],
    "couponCode": "TEST"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/store/shipping-zone/shipping-rates', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "country": "US", "amountAvailable": "US", "totalOrderAmount": 99.99, "weightAvailable": true, "totalOrderWeight": 10, "source": {"type": "order", "subType": "store"}, "products": [{"id": "string", "qty": 0}], "couponCode": "TEST"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/store/shipping-zone/shipping-rates',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "country": "US", "amountAvailable": "US", "totalOrderAmount": 99.99, "weightAvailable": true, "totalOrderWeight": 10, "source": {"type": "order", "subType": "store"}, "products": [{"id": "string", "qty": 0}], "couponCode": "TEST"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/store/shipping-zone/shipping-rates');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', 'country': 'US', 'amountAvailable': 'US', 'totalOrderAmount': 99.99, 'weightAvailable': true, 'totalOrderWeight': 10, 'source': {'type': 'order', 'subType': 'store'}, 'products': [{'id': 'string', 'qty': 0}], 'couponCode': 'TEST'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
