» Shipping Rate POST API Documentation

Creating a New Shipping Rate

Endpoint: POST /api/v4/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

The request body must include the shipping rate's details such as name, policy type, cost values, and one or more conditions. Each condition defines how the shipping rule applies based on amount, weight, and other parameters.

{
  "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.

{
    "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"
      }
    ]
  }