» Shipping Rate POST API Documentation

Creating a New Shipping Rate

Endpoint: POST /admin/shipping_rates

Purpose

This API creates a new shipping rate with a defined policy and a set of conditions. This allows admins to configure how shipping costs are calculated based on amount, weight, or other criteria.

Path Parameters

No path parameters for this endpoint.

Query Parameters 

This endpoint does not have any query parameters.

Use Case

This API is used to add a new shipping rate to the system. It helps set up shipping costs, handle charges, and define conditions based on shipping policies.

Request Body

Key Type Description
name String Name of the shipping rate.
policy_type String Policy type that governs the rate.
additional_amount Number Extra amount to add on top of base rate.
additional_cost Number Extra cost (could be based on rules or weight).
is_cumulative Boolean Whether the rate should be cumulative with other rates.
includes_tax Boolean Indicates if tax is included in the shipping rate.
is_additional Boolean Marks if this is an additional shipping rate option.
conditions Array List of rate condition objects defining specific pricing logic.
{
  "shipping_rate": {
    "name": "SHIPPING_RATE_NAME",
    "policy_type": "POLICY_TYPE",
    "additional_amount": ADDITIONAL_AMOUNT,
    "additional_cost": ADDITIONAL_COST,
    "is_cumulative": BOOLEAN,
    "includes_tax": BOOLEAN,
    "is_additional": BOOLEAN,
    "conditions": [
      {
        "from_amount": FROM_AMOUNT,
        "to_amount": TO_AMOUNT,
        "packet_weight": PACKET_WEIGHT,
        "handling_cost": HANDLING_COST,
        "shipping_cost": SHIPPING_COST,
        "shipping_cost_type": "SHIPPING_COST_TYPE",
        "handling_cost_type": "HANDLING_COST_TYPE",
        "api_type": API_TYPE,
        "api_service_type": API_SERVICE_TYPE,
        "extra_cover": EXTRA_COVER,
        "packing_algorithm": PACKING_ALGORITHM,
        "item_attributes": ITEM_ATTRIBUTES
      }
    ]
  }
}

Response

Returns the created shipping rate with its assigned ID, policy settings, and saved conditions. Timestamps for creation and last update are also included.

POST
https://{your_site_domain}/api/v4/admin/shipping_rates
Try It Out
{
    "shipping_rate": [
      {
        "id": SHIPPING_RATE_ID,
        "name": "NAME",
        "policy_type": "POLICY_TYPE",
        "additional_amount": ADDITIONAL_AMOUNT,
        "additional_cost": ADDITIONAL_COST,
        "is_cumulative": BOOLEAN,
        "includes_tax": BOOLEAN,
        "is_additional": BOOLEAN,
        "conditions": [
          {
            "id": CONDITION_ID,
            "from_amount": FROM_AMOUNT,
            "to_amount": TO_AMOUNT,
            "packet_weight": PACKET_WEIGHT,
            "handling_cost": HANDLING_COST,
            "shipping_cost": SHIPPING_COST,
            "shipping_cost_type": "SHIPPING_COST_TYPE",
            "handling_cost_type": "HANDLING_COST_TYPE",
            "api_type": API_TYPE,
            "api_service_type": API_SERVICE_TYPE,
            "extra_cover": EXTRA_COVER,
            "packing_algorithm": PACKING_ALGORITHM,
            "item_attributes": ITEM_ATTRIBUTES,
            "shipping_policy": [
              {
                "id": SHIPPING_RATE_ID
              }
            ]
          }
        ],
        "created_at": "YYYY-MM-DDTHH:MM:SS",
        "updated_at": "YYYY-MM-DDTHH:MM:SS"
      }
    ]
  }