» Shipping Rule POST API Documentation

Creating a New Shipping Rule

Endpoint: POST /admin/shipping_rules

Purpose

This endpoint allows an admin to create a new shipping rule that binds a shipping policy, shipping class, and applicable zones. Shipping rules define how different policies apply across regions and shipping classes, enabling flexible delivery pricing and logic across the platform.

Path Parameters

No path parameters for this endpoint.

Query Parameters

No query parameters for this endpoint.

Use Case

An admin creates a shipping rule to associate a policy with the shipping class for global zones. This helps define granular control over shipping logic per region, carrier type, or delivery service level.

Request Body

Key Type Description
name String Name of the shipping rule.
profile_id String ID of the associated shipping profile.
shipping_class String ID of the related shipping class.
shipping_policy String ID of the shipping policy applied to this rule.
zones Array of Objects List of zone objects that this rule applies to (each with an id).
description String Description of the shipping rule.
{
  "shipping_rule": {
    "name": "SHIPPING_RULE_NAME",
    "profile_id": "SHIPPING_PROFILE_ID",
    "shipping_class": "SHIPPING_CLASS_ID",
    "shipping_policy": "SHIPPING_POLICY_ID",
    "zones": [
      {
        "id": ZONE_ID_1
      },
      {
        "id": ZONE_ID_2
      }
    ],
    "description": "SHIPPING_RULE_DESCRIPTION"
  }
}

Response

Returns the full shipping rule object including the assigned ID, shipping policy and class info, zone details, description, and timestamps. This confirms the rule was successfully created and provides the data needed to review or display the rule setup.

POST
https://{your_site_domain}/api/v4/admin/shipping_rules
Try It Out
{
  "shipping_rule": {
    "id": SHIPPING_RULE_ID,
    "name": "SHIPPING_RULE_NAME",
    "shipping_policy": {
      "id": SHIPPING_POLICY_ID,
      "name": "SHIPPING_POLICY_NAME"
    },
    "shipping_class": {
      "id": SHIPPING_CLASS_ID,
      "name": "SHIPPING_CLASS_NAME"
    },
    "zones": [
      {
        "id": ZONE_ID_1,
        "name": "ZONE_NAME_1"
      },
      {
        "id": ZONE_ID_2,
        "name": "ZONE_NAME_2"
      }
    ],
    "description": "SHIPPING_RULE_DESCRIPTION",
    "created_at": "YYYY-MM-DDTHH:MM:SS",
    "updated_at": "YYYY-MM-DDTHH:MM:SS"
  }
}