{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/australia-post/main/json-schema/australia-post-country-metadata-request-schema.json",
  "title": "CountryMetadataRequest",
  "description": "Request body for country metadata lookup. Contains one or more filters, each evaluated independently.",
  "x-generated": "2026-10-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/australia-post-international-export-tools-v3-openapi.yml#/components/schemas/CountryMetadataRequest",
  "required": [
    "filters"
  ],
  "properties": {
    "filters": {
      "minItems": 1,
      "description": "List of country metadata filters to evaluate. Must not be empty.",
      "items": {
        "$ref": "#/$defs/CountryMetadataFilter"
      }
    }
  },
  "$defs": {
    "CountryMetadataFilter": {
      "required": [
        "classification",
        "country_code",
        "id",
        "item_value_total"
      ],
      "properties": {
        "id": {
          "description": "Client-supplied correlation identifier. Returned unchanged in the corresponding metadata result. **Must be unique across all filters in the request** — duplicate ids are rejected with HTTP 400 (`INVALID_ARGUMENT`, `source.parameter` = `filters.id`) because the response could not otherwise be correlated unambiguously."
        },
        "country_code": {
          "maxLength": 2,
          "minLength": 2,
          "pattern": "^[A-Za-z]{2}$",
          "description": "Destination country code. **Must be a valid ISO 3166-1 alpha-2 country code** — the two-letter `pattern` enforces shape only; a well-formed but non-existent code (e.g. `AA`) is rejected with HTTP 400 (`INVALID_ARGUMENT`, `source.parameter` = `filters[N].country_code`). Case-insensitive; normalised to upper-case in the response."
        },
        "classification": {
          "description": "Shipment classification type.",
          "enum": [
            "GIFT",
            "DOCUMENT",
            "RETURN",
            "SALE_OF_GOODS",
            "SAMPLE",
            "OTHER"
          ]
        },
        "item_hs_codes": {
          "description": "**Optional.** List of HS tariff codes for the items in the shipment. Each code must be 6–14 alphanumeric characters (e.g. a 6-digit chapter code or a country-specific 8–14 character extension).\n\nWhen omitted or `null`, HS exclusion and inclusion checks are skipped and all available options for the destination are returned — the system cannot determine if goods are restricted without HS codes.\n\nWhen provided and any code matches a destination-specific excluded HS prefix (e.g. `2204` for wine/GB), only `RECEIVER_PAYS` is returned.",
          "items": {
            "pattern": "^[A-Za-z0-9]{6,14}$"
          }
        },
        "item_value_total": {
          "pattern": "^\\d+\\.\\d{2}$",
          "description": "Total value of items as a plain decimal string with exactly 2 decimal places (e.g. \"100.00\")."
        },
        "item_value_currency_code": {
          "description": "Currency code for item_value_total. **Optional — defaults to `AUD` when omitted.**\n\n> ⚠️ **Phase 1 limitation:** only `AUD` is accepted. Supplying any other value (e.g. `USD`, `GBP`) will return HTTP 400. Multi-currency support is planned for a future phase.",
          "default": "AUD",
          "enum": [
            "AUD"
          ]
        }
      },
      "description": "A single filter specifying the destination country, classification, HS codes, and item value for metadata resolution."
    }
  }
}