{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usps/json-schema/usps-base-rates-query-schema.json",
  "title": "International Base Rates Query",
  "description": "Search parameters for base rates.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usps-international-prices-openapi.yml#/components/schemas/BaseRatesQuery",
  "required": [
    "destinationCountryCode",
    "destinationEntryFacilityType",
    "height",
    "length",
    "mailClass",
    "originZIPCode",
    "priceType",
    "processingCategory",
    "rateIndicator",
    "weight",
    "width"
  ],
  "type": "object",
  "properties": {
    "originZIPCode": {
      "$ref": "#/$defs/originZIPCode"
    },
    "weight": {
      "$ref": "#/$defs/WeightPounds"
    },
    "length": {
      "$ref": "#/$defs/Length"
    },
    "width": {
      "$ref": "#/$defs/Width"
    },
    "height": {
      "$ref": "#/$defs/Height"
    },
    "mailClass": {
      "type": "string",
      "description": "The mail service requested.\n * 'FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE'\n * 'PRIORITY_MAIL_INTERNATIONAL'\n * 'PRIORITY_MAIL_EXPRESS_INTERNATIONAL'\n * 'GLOBAL_EXPRESS_GUARANTEED' - Global Express Guaranteed Service is suspended as of September 29, 2024.",
      "enum": [
        "FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE",
        "PRIORITY_MAIL_INTERNATIONAL",
        "PRIORITY_MAIL_EXPRESS_INTERNATIONAL",
        "GLOBAL_EXPRESS_GUARANTEED"
      ]
    },
    "processingCategory": {
      "type": "string",
      "description": "Value designates if shipment is `MACHINABLE`, `NONSTANDARD, or `FLATS`.\n\nNote:\n* `NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of 01/19/2025.",
      "enum": [
        "FLATS",
        "MACHINABLE",
        "NON_MACHINABLE",
        "NONSTANDARD"
      ]
    },
    "rateIndicator": {
      "type": "string",
      "description": "Use to specify USPS&#174; containers/packaging or container attributes that may affect postage.\n * E4 - Priority Mail Express Flat Rate Envelope - Post Office To Addressee\n * E6 - Priority Mail Express Legal Flat Rate Envelope\n * FA - Legal Flat Rate Envelope\n * FB - Medium Flat Rate Box/Large Flat Rate Bag\n * FE - Flat Rate Envelope\n * FP - Padded Flat Rate Envelope\n * FS - Small Flat Rate Box\n * PA - Priority Mail Express International Single Piece\n * PL - Large Flat Rate Box\n * SP - Single Piece\n * EP - ECOMPRO Single Piece\n * HA - ECOMPRO Legal Flat Rate Envelope\n * HB - ECOMPRO Medium Flat Rate Box\n * HE - ECOMPRO Flat Rate Envelope\n * HL - ECOMPRO Large Flat Rate Box\n * HP - ECOMPRO Padded Flat Rate Envelope\n * HS - ECOMPRO Small Flat Rate Box\n * LE - Single-piece parcel",
      "enum": [
        "E4",
        "E6",
        "E7",
        "FA",
        "FB",
        "FE",
        "FP",
        "FS",
        "PA",
        "PL",
        "SP",
        "EP",
        "HA",
        "HB",
        "HE",
        "HL",
        "HP",
        "HS",
        "LE"
      ]
    },
    "destinationEntryFacilityType": {
      "type": "string",
      "description": "Types of Facilities \n  * NONE - Translate to Destination Rate Indicator N\n  * INTERNATIONAL_SERVICE_CENTER - Translate to Destination Rate Indicator I",
      "enum": [
        "NONE",
        "INTERNATIONAL_SERVICE_CENTER"
      ]
    },
    "priceType": {
      "$ref": "#/$defs/InternationalPriceType"
    },
    "mailingDate": {
      "$ref": "#/$defs/MailingDate"
    },
    "foreignPostalCode": {
      "$ref": "#/$defs/ForeignPostalCode"
    },
    "destinationCountryCode": {
      "$ref": "#/$defs/DestinationCountryCode"
    },
    "accountType": {
      "type": "string",
      "description": "The type of payment account linked to a contract rate.\n\nNote:\n- `METER` pricing is only available to PC Postage providers.\n",
      "enum": [
        "EPS",
        "PERMIT",
        "METER"
      ]
    },
    "accountNumber": {
      "pattern": "^\\d+$",
      "type": "string",
      "description": "The Enterprise Payment Account, Permit number or PC Postage meter number associated with a contract."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "DestinationCountryCode": {
      "title": "Destination Country Code",
      "pattern": "^[A-Z]{2}$",
      "type": "string",
      "description": "The ISO 3166-1 alpha-2 code representing the shipping destination."
    },
    "ForeignPostalCode": {
      "type": "string",
      "description": "The foreign postal code for the package.\n\nNote:\n- Different shipping destinations may require a postal code for shipping.  For more details, review the [Individual Country Listing](https://pe.usps.com/text/imm/immctry.htm) for your shipping destination\n"
    },
    "Height": {
      "type": "number",
      "description": "The package height in inches.",
      "format": "double"
    },
    "InternationalPriceType": {
      "type": "string",
      "description": "The type of price applied.\n\nNotes:\n * If an `accountNumber` is provided, it overrides the requested `priceType` and the response will return `CONTRACT` rates (if they exist for that account).\n * When priceType is `CONTRACT`, `accountType` and `accountNumber` are required to return the correct pricing.  If `accountType` and `accountNumber` are not provided, published `COMMERCIAL` rates may be returned instead.\n",
      "enum": [
        "RETAIL",
        "COMMERCIAL",
        "COMMERCIAL_BASE",
        "COMMERCIAL_PLUS",
        "CONTRACT"
      ]
    },
    "Length": {
      "type": "number",
      "description": "The package length in inches.  The maximum dimension is always length.",
      "format": "double"
    },
    "MailingDate": {
      "type": "string",
      "description": "The date the package or letter/flat will be mailed. The mailing date may be today plus 0 to 7 days in advance.        ",
      "format": "date"
    },
    "WeightPounds": {
      "type": "number",
      "description": "The calculated weight for the package based on user input.  The greater of dimWeight and weight will be used to calculated the rate. Weight unit of measurement is in pounds.",
      "format": "double"
    },
    "Width": {
      "type": "number",
      "description": "The package width in inches.  The second longest dimension is always width.",
      "format": "double"
    },
    "originZIPCode": {
      "pattern": "^\\d{5}(?:[-\\s]\\d{4})?$",
      "type": "string",
      "description": "The originating ZIP Code for the package."
    }
  }
}