{
  "openapi": "3.1.0",
  "info": {
    "title": "PackZoo Shipping Price API",
    "version": "1.0.0",
    "description": "Compare parcel and letter shipping prices across European carriers. Prices are indicative; affiliate links may apply. Verify final prices on carrier sites."
  },
  "servers": [{ "url": "https://packzoo.com" }],
  "paths": {
    "/api/prices": {
      "get": {
        "operationId": "compareShippingPrices",
        "summary": "Compare shipping prices for a package",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": { "type": "string" },
            "description": "Origin country ISO code. Supported: AT BE BG CY CZ DE DK EE ES FI FR GR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": { "type": "string" },
            "description": "Destination country ISO code (any country)"
          },
          {
            "name": "weight",
            "in": "query",
            "required": true,
            "schema": { "type": "number", "exclusiveMinimum": 0 },
            "description": "Package weight in kg"
          },
          {
            "name": "length",
            "in": "query",
            "required": true,
            "schema": { "type": "number", "exclusiveMinimum": 0 },
            "description": "Longest side in cm"
          },
          {
            "name": "width",
            "in": "query",
            "required": true,
            "schema": { "type": "number", "exclusiveMinimum": 0 },
            "description": "Middle side in cm"
          },
          {
            "name": "height",
            "in": "query",
            "required": true,
            "schema": { "type": "number", "exclusiveMinimum": 0 },
            "description": "Shortest side in cm"
          }
        ],
        "responses": {
          "200": {
            "description": "Price comparison results sorted cheapest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["from", "to", "dimensions", "results"],
                  "properties": {
                    "from": { "type": "string" },
                    "to": { "type": "string" },
                    "dimensions": {
                      "type": "object",
                      "properties": {
                        "weight": { "type": "number" },
                        "length": { "type": "number" },
                        "width": { "type": "number" },
                        "height": { "type": "number" }
                      }
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["provider", "brandName", "price", "currency"],
                        "properties": {
                          "provider": { "type": "string", "description": "Internal provider ID (e.g. dhl-nl)" },
                          "brandName": { "type": "string", "description": "Display name (e.g. DHL)" },
                          "price": {
                            "type": ["number", "null"],
                            "description": "Price in the carrier's currency. null = package exceeds this carrier's size limits"
                          },
                          "currency": { "type": "string", "description": "ISO 4217 currency code (e.g. EUR)" },
                          "orderUrl": { "type": "string", "format": "uri", "description": "Carrier booking page" },
                          "servicePointsUrl": { "type": "string", "format": "uri", "description": "Drop-off point locator" }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "supportedCountries": {
                      "type": "array",
                      "items": { "type": "string" },
                      "description": "Present only when the error is an unsupported origin country"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
