{
  "$id": "compare_bulk_rates_request_body",
  "title": "compare_bulk_rates_request_body",
  "type": "object",
  "required": [
    "rate_options"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "title": "rate_request_rate_options",
      "type": "object",
      "properties": {
        "rate_options": {
          "allOf": [
            {
              "title": "rate_request_body",
              "type": "object",
              "required": [
                "carrier_ids"
              ],
              "additionalProperties": false,
              "properties": {
                "carrier_ids": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "allOf": [
                      {
                        "title": "se_id",
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 25,
                        "pattern": "^se(-[a-z0-9]+)+$"
                      }
                    ]
                  }
                },
                "package_types": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "service_codes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "calculate_tax_amount": {
                  "type": "boolean"
                },
                "preferred_currency": {
                  "allOf": [
                    {
                      "title": "currency",
                      "type": "string",
                      "enum": [
                        "usd",
                        "cad",
                        "aud",
                        "gbp",
                        "eur",
                        "nzd"
                      ]
                    }
                  ]
                },
                "is_return": {
                  "type": "boolean"
                }
              }
            }
          ]
        }
      }
    }
  ],
  "oneOf": [
    {
      "title": "rate_request_by_shipment_ids",
      "type": "object",
      "required": [
        "shipment_ids"
      ],
      "properties": {
        "shipment_ids": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "title": "se_id",
                "type": "string",
                "minLength": 1,
                "maxLength": 25,
                "pattern": "^se(-[a-z0-9]+)+$"
              }
            ]
          }
        }
      }
    },
    {
      "title": "rate_request_by_shipments",
      "type": "object",
      "required": [
        "shipments"
      ],
      "properties": {
        "shipments": {
          "type": "array",
          "minItems": 1,
          "items": {
            "allOf": [
              {
                "title": "address_validating_shipment",
                "type": "object",
                "required": [
                  "carrier_id",
                  "service_code",
                  "ship_to",
                  "ship_from"
                ],
                "additionalProperties": false,
                "allOf": [
                  {
                    "title": "validate_shipment_fields",
                    "type": "object",
                    "properties": {
                      "validate_address": {
                        "default": "no_validation",
                        "allOf": [
                          {
                            "title": "validate_address",
                            "type": "string",
                            "enum": [
                              "no_validation",
                              "validate_only",
                              "validate_and_clean"
                            ]
                          }
                        ]
                      }
                    }
                  },
                  {
                    "title": "partial_shipment",
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "carrier_id": {
                        "allOf": [
                          {
                            "title": "se_id",
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 25,
                            "pattern": "^se(-[a-z0-9]+)+$"
                          }
                        ]
                      },
                      "service_code": {
                        "allOf": [
                          {
                            "title": "service_code",
                            "type": "string",
                            "pattern": "^[a-z0-9]+(_[a-z0-9-]+)* ?$"
                          }
                        ]
                      },
                      "external_order_id": {
                        "type": "string"
                      },
                      "items": {
                        "type": "array",
                        "default": [],
                        "items": {
                          "allOf": [
                            {
                              "title": "shipment_item",
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 0
                                },
                                "sales_order_id": {
                                  "type": "string"
                                },
                                "sales_order_item_id": {
                                  "type": "string"
                                },
                                "quantity": {
                                  "type": "integer",
                                  "format": "int32",
                                  "minimum": 0
                                },
                                "sku": {
                                  "type": "string"
                                },
                                "external_order_id": {
                                  "type": "string"
                                },
                                "external_order_item_id": {
                                  "type": "string"
                                },
                                "asin": {
                                  "type": "string",
                                  "minLength": 10,
                                  "maxLength": 10
                                },
                                "order_source_code": {
                                  "allOf": [
                                    {
                                      "title": "order_source_name",
                                      "type": "string",
                                      "enum": [
                                        "amazon_ca",
                                        "amazon_us",
                                        "brightpearl",
                                        "channel_advisor",
                                        "cratejoy",
                                        "ebay",
                                        "etsy",
                                        "jane",
                                        "groupon_goods",
                                        "magento",
                                        "paypal",
                                        "seller_active",
                                        "shopify",
                                        "stitch_labs",
                                        "squarespace",
                                        "three_dcart",
                                        "tophatter",
                                        "walmart",
                                        "woo_commerce",
                                        "volusion"
                                      ]
                                    }
                                  ]
                                }
                              }
                            }
                          ]
                        }
                      },
                      "tax_identifiers": {
                        "type": "array",
                        "items": {
                          "allOf": [
                            {
                              "title": "tax_identifier",
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "taxable_entity_type",
                                "identifier_type",
                                "issuing_authority",
                                "value"
                              ],
                              "properties": {
                                "taxable_entity_type": {
                                  "allOf": [
                                    {
                                      "title": "taxable_entity_type",
                                      "type": "string",
                                      "enum": [
                                        "shipper",
                                        "recipient"
                                      ]
                                    }
                                  ]
                                },
                                "identifier_type": {
                                  "allOf": [
                                    {
                                      "title": "identifier_type",
                                      "type": "string",
                                      "enum": [
                                        "vat",
                                        "eori",
                                        "ssn",
                                        "ein",
                                        "tin",
                                        "ioss",
                                        "pan",
                                        "voec"
                                      ]
                                    }
                                  ]
                                },
                                "issuing_authority": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              }
                            }
                          ]
                        }
                      },
                      "external_shipment_id": {
                        "type": "string",
                        "maxLength": 50
                      },
                      "ship_date": {
                        "allOf": [
                          {
                            "title": "date",
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[-+]\\d{2}:\\d{2}))?$"
                          }
                        ]
                      },
                      "ship_to": {
                        "allOf": [
                          {
                            "title": "address",
                            "type": "object",
                            "required": [
                              "name",
                              "phone",
                              "address_line1",
                              "city_locality",
                              "state_province",
                              "postal_code",
                              "country_code",
                              "address_residential_indicator"
                            ],
                            "additionalProperties": false,
                            "allOf": [
                              {
                                "title": "partial_address",
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "phone": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "company_name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line1": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line2": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line3": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "city_locality": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "state_province": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "postal_code": {
                                    "allOf": [
                                      {
                                        "title": "postal_code",
                                        "minLength": 1,
                                        "type": "string"
                                      }
                                    ]
                                  },
                                  "country_code": {
                                    "allOf": [
                                      {
                                        "title": "country_code",
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 2
                                      }
                                    ]
                                  },
                                  "address_residential_indicator": {
                                    "default": "unknown",
                                    "allOf": [
                                      {
                                        "title": "address_residential_indicator",
                                        "type": "string",
                                        "enum": [
                                          "unknown",
                                          "yes",
                                          "no"
                                        ]
                                      }
                                    ]
                                  }
                                }
                              }
                            ]
                          }
                        ]
                      },
                      "ship_from": {
                        "allOf": [
                          {
                            "title": "address",
                            "type": "object",
                            "required": [
                              "name",
                              "phone",
                              "address_line1",
                              "city_locality",
                              "state_province",
                              "postal_code",
                              "country_code",
                              "address_residential_indicator"
                            ],
                            "additionalProperties": false,
                            "allOf": [
                              {
                                "title": "partial_address",
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "phone": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "company_name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line1": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line2": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line3": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "city_locality": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "state_province": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "postal_code": {
                                    "allOf": [
                                      {
                                        "title": "postal_code",
                                        "minLength": 1,
                                        "type": "string"
                                      }
                                    ]
                                  },
                                  "country_code": {
                                    "allOf": [
                                      {
                                        "title": "country_code",
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 2
                                      }
                                    ]
                                  },
                                  "address_residential_indicator": {
                                    "default": "unknown",
                                    "allOf": [
                                      {
                                        "title": "address_residential_indicator",
                                        "type": "string",
                                        "enum": [
                                          "unknown",
                                          "yes",
                                          "no"
                                        ]
                                      }
                                    ]
                                  }
                                }
                              }
                            ]
                          }
                        ]
                      },
                      "warehouse_id": {
                        "default": null,
                        "allOf": [
                          {
                            "title": "se_id",
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 25,
                            "pattern": "^se(-[a-z0-9]+)+$"
                          }
                        ]
                      },
                      "return_to": {
                        "allOf": [
                          {
                            "title": "address",
                            "type": "object",
                            "required": [
                              "name",
                              "phone",
                              "address_line1",
                              "city_locality",
                              "state_province",
                              "postal_code",
                              "country_code",
                              "address_residential_indicator"
                            ],
                            "additionalProperties": false,
                            "allOf": [
                              {
                                "title": "partial_address",
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "phone": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "company_name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line1": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line2": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "address_line3": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "city_locality": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "state_province": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "postal_code": {
                                    "allOf": [
                                      {
                                        "title": "postal_code",
                                        "minLength": 1,
                                        "type": "string"
                                      }
                                    ]
                                  },
                                  "country_code": {
                                    "allOf": [
                                      {
                                        "title": "country_code",
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 2
                                      }
                                    ]
                                  },
                                  "address_residential_indicator": {
                                    "default": "unknown",
                                    "allOf": [
                                      {
                                        "title": "address_residential_indicator",
                                        "type": "string",
                                        "enum": [
                                          "unknown",
                                          "yes",
                                          "no"
                                        ]
                                      }
                                    ]
                                  }
                                }
                              }
                            ]
                          }
                        ]
                      },
                      "confirmation": {
                        "default": "none",
                        "allOf": [
                          {
                            "title": "delivery_confirmation",
                            "type": "string",
                            "enum": [
                              "none",
                              "delivery",
                              "signature",
                              "adult_signature",
                              "direct_signature",
                              "delivery_mailed",
                              "verbal_confirmation"
                            ]
                          }
                        ]
                      },
                      "customs": {
                        "default": null,
                        "allOf": [
                          {
                            "title": "international_shipment_options",
                            "type": "object",
                            "required": [
                              "contents",
                              "non_delivery"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "contents": {
                                "default": "merchandise",
                                "allOf": [
                                  {
                                    "title": "package_contents",
                                    "type": "string",
                                    "enum": [
                                      "merchandise",
                                      "documents",
                                      "gift",
                                      "returned_goods",
                                      "sample"
                                    ]
                                  }
                                ]
                              },
                              "non_delivery": {
                                "default": "return_to_sender",
                                "allOf": [
                                  {
                                    "title": "non_delivery",
                                    "type": "string",
                                    "enum": [
                                      "return_to_sender",
                                      "treat_as_abandoned"
                                    ]
                                  }
                                ]
                              },
                              "customs_items": {
                                "type": "array",
                                "default": [],
                                "minItems": 0,
                                "items": {
                                  "title": "customs_item",
                                  "type": "object",
                                  "required": [],
                                  "additionalProperties": false,
                                  "properties": {
                                    "quantity": {
                                      "type": "integer",
                                      "format": "int32",
                                      "minimum": 0,
                                      "default": 0
                                    },
                                    "value": {
                                      "allOf": [
                                        {
                                          "title": "monetary_value",
                                          "type": "object",
                                          "required": [
                                            "currency",
                                            "amount"
                                          ],
                                          "additionalProperties": false,
                                          "properties": {
                                            "currency": {
                                              "allOf": [
                                                {
                                                  "title": "currency",
                                                  "type": "string",
                                                  "enum": [
                                                    "usd",
                                                    "cad",
                                                    "aud",
                                                    "gbp",
                                                    "eur",
                                                    "nzd"
                                                  ]
                                                }
                                              ]
                                            },
                                            "amount": {
                                              "type": "number",
                                              "format": "double",
                                              "minimum": 0
                                            }
                                          }
                                        }
                                      ]
                                    },
                                    "harmonized_tariff_code": {
                                      "type": "string",
                                      "default": null
                                    },
                                    "country_of_origin": {
                                      "default": null,
                                      "allOf": [
                                        {
                                          "title": "country_code",
                                          "type": "string",
                                          "minLength": 2,
                                          "maxLength": 2
                                        }
                                      ]
                                    },
                                    "unit_of_measure": {
                                      "type": "string"
                                    },
                                    "sku": {
                                      "type": "string"
                                    },
                                    "sku_description": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        ]
                      },
                      "advanced_options": {
                        "allOf": [
                          {
                            "title": "advanced_shipment_options",
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "bill_to_account": {
                                "type": "string",
                                "default": null
                              },
                              "bill_to_country_code": {
                                "default": null,
                                "allOf": [
                                  {
                                    "title": "country_code",
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 2
                                  }
                                ]
                              },
                              "bill_to_party": {
                                "default": null,
                                "allOf": [
                                  {
                                    "title": "bill_to_party",
                                    "type": "string",
                                    "enum": [
                                      "recipient",
                                      "third_party"
                                    ]
                                  }
                                ]
                              },
                              "bill_to_postal_code": {
                                "type": "string",
                                "default": null
                              },
                              "contains_alcohol": {
                                "type": "boolean",
                                "default": false
                              },
                              "delivered_duty_paid": {
                                "type": "boolean",
                                "default": false
                              },
                              "dry_ice": {
                                "type": "boolean",
                                "default": false
                              },
                              "dry_ice_weight": {
                                "allOf": [
                                  {
                                    "title": "weight",
                                    "type": "object",
                                    "required": [
                                      "value",
                                      "unit"
                                    ],
                                    "additionalProperties": false,
                                    "properties": {
                                      "value": {
                                        "type": "number",
                                        "format": "double",
                                        "exclusiveMinimum": 0
                                      },
                                      "unit": {
                                        "allOf": [
                                          {
                                            "title": "weight_unit",
                                            "type": "string",
                                            "enum": [
                                              "pound",
                                              "ounce",
                                              "gram",
                                              "kilogram"
                                            ]
                                          }
                                        ]
                                      }
                                    }
                                  }
                                ]
                              },
                              "non_machinable": {
                                "type": "boolean",
                                "default": false
                              },
                              "saturday_delivery": {
                                "type": "boolean",
                                "default": false
                              },
                              "fedex_freight": {
                                "type": "object",
                                "properties": {
                                  "shipper_load_and_count": {
                                    "type": "string"
                                  },
                                  "booking_confirmation": {
                                    "type": "string"
                                  }
                                }
                              },
                              "use_ups_ground_freight_pricing": {
                                "type": "boolean",
                                "default": null
                              },
                              "freight_class": {
                                "type": "string",
                                "default": null
                              },
                              "custom_field1": {
                                "type": "string",
                                "default": null,
                                "maxLength": 100
                              },
                              "custom_field2": {
                                "type": "string",
                                "default": null,
                                "maxLength": 100
                              },
                              "custom_field3": {
                                "type": "string",
                                "default": null,
                                "maxLength": 100
                              },
                              "origin_type": {
                                "default": null,
                                "allOf": [
                                  {
                                    "title": "origin_type",
                                    "type": "string",
                                    "enum": [
                                      "pickup",
                                      "drop_off"
                                    ]
                                  }
                                ]
                              },
                              "shipper_release": {
                                "type": "boolean",
                                "default": null
                              },
                              "collect_on_delivery": {
                                "title": "collect_on_delivery",
                                "type": "object",
                                "properties": {
                                  "payment_type": {
                                    "allOf": [
                                      {
                                        "title": "collect_on_delivery_payment_type",
                                        "type": "string",
                                        "enum": [
                                          "any",
                                          "cash",
                                          "cash_equivalent",
                                          "none"
                                        ]
                                      }
                                    ]
                                  },
                                  "payment_amount": {
                                    "title": "payment_amount",
                                    "type": "object",
                                    "properties": {
                                      "currency": {
                                        "allOf": [
                                          {
                                            "title": "currency",
                                            "type": "string",
                                            "enum": [
                                              "usd",
                                              "cad",
                                              "aud",
                                              "gbp",
                                              "eur",
                                              "nzd"
                                            ]
                                          }
                                        ]
                                      },
                                      "amount": {
                                        "minimum": 0,
                                        "format": "double",
                                        "type": "number"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        ]
                      },
                      "origin_type": {
                        "allOf": [
                          {
                            "title": "origin_type",
                            "type": "string",
                            "enum": [
                              "pickup",
                              "drop_off"
                            ]
                          }
                        ]
                      },
                      "insurance_provider": {
                        "default": "none",
                        "allOf": [
                          {
                            "title": "insurance_provider",
                            "type": "string",
                            "enum": [
                              "none",
                              "shipsurance",
                              "carrier",
                              "third_party"
                            ]
                          }
                        ]
                      },
                      "order_source_code": {
                        "allOf": [
                          {
                            "title": "order_source_name",
                            "type": "string",
                            "enum": [
                              "amazon_ca",
                              "amazon_us",
                              "brightpearl",
                              "channel_advisor",
                              "cratejoy",
                              "ebay",
                              "etsy",
                              "jane",
                              "groupon_goods",
                              "magento",
                              "paypal",
                              "seller_active",
                              "shopify",
                              "stitch_labs",
                              "squarespace",
                              "three_dcart",
                              "tophatter",
                              "walmart",
                              "woo_commerce",
                              "volusion"
                            ]
                          }
                        ]
                      },
                      "packages": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                          "allOf": [
                            {
                              "title": "package",
                              "type": "object",
                              "required": [
                                "weight"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "package_code": {
                                  "allOf": [
                                    {
                                      "title": "package_code",
                                      "type": "string",
                                      "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
                                    }
                                  ]
                                },
                                "weight": {
                                  "allOf": [
                                    {
                                      "title": "weight",
                                      "type": "object",
                                      "required": [
                                        "value",
                                        "unit"
                                      ],
                                      "additionalProperties": false,
                                      "properties": {
                                        "value": {
                                          "type": "number",
                                          "format": "double",
                                          "exclusiveMinimum": 0
                                        },
                                        "unit": {
                                          "allOf": [
                                            {
                                              "title": "weight_unit",
                                              "type": "string",
                                              "enum": [
                                                "pound",
                                                "ounce",
                                                "gram",
                                                "kilogram"
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  ]
                                },
                                "dimensions": {
                                  "allOf": [
                                    {
                                      "title": "dimensions",
                                      "type": "object",
                                      "required": [
                                        "unit",
                                        "length",
                                        "width",
                                        "height"
                                      ],
                                      "additionalProperties": false,
                                      "properties": {
                                        "unit": {
                                          "default": "inch",
                                          "allOf": [
                                            {
                                              "title": "dimension_unit",
                                              "type": "string",
                                              "enum": [
                                                "inch",
                                                "centimeter"
                                              ]
                                            }
                                          ]
                                        },
                                        "length": {
                                          "type": "number",
                                          "format": "double",
                                          "minimum": 0,
                                          "default": 0
                                        },
                                        "width": {
                                          "type": "number",
                                          "format": "double",
                                          "minimum": 0,
                                          "default": 0
                                        },
                                        "height": {
                                          "type": "number",
                                          "format": "double",
                                          "minimum": 0,
                                          "default": 0
                                        }
                                      }
                                    }
                                  ]
                                },
                                "insured_value": {
                                  "allOf": [
                                    {
                                      "title": "monetary_value",
                                      "type": "object",
                                      "required": [
                                        "currency",
                                        "amount"
                                      ],
                                      "additionalProperties": false,
                                      "properties": {
                                        "currency": {
                                          "allOf": [
                                            {
                                              "title": "currency",
                                              "type": "string",
                                              "enum": [
                                                "usd",
                                                "cad",
                                                "aud",
                                                "gbp",
                                                "eur",
                                                "nzd"
                                              ]
                                            }
                                          ]
                                        },
                                        "amount": {
                                          "type": "number",
                                          "format": "double",
                                          "minimum": 0
                                        }
                                      }
                                    }
                                  ],
                                  "default": [
                                    {
                                      "currency": "usd",
                                      "amount": 0
                                    }
                                  ]
                                },
                                "label_messages": {
                                  "allOf": [
                                    {
                                      "title": "label_messages",
                                      "type": "object",
                                      "required": [
                                        "reference1",
                                        "reference2",
                                        "reference3"
                                      ],
                                      "additionalProperties": false,
                                      "properties": {
                                        "reference1": {
                                          "type": "string",
                                          "default": null
                                        },
                                        "reference2": {
                                          "type": "string",
                                          "default": null
                                        },
                                        "reference3": {
                                          "type": "string",
                                          "default": null
                                        }
                                      }
                                    }
                                  ]
                                },
                                "external_package_id": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  }
                ]
              }
            ]
          }
        }
      }
    }
  ]
}