{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/geoapify/json-schema/geoapify-route-matrix-response-schema.json",
  "title": "RouteMatrixResponse",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/geoapify-route-matrix-api-openapi.yml#/components/schemas/RouteMatrixResponse",
  "type": "object",
  "required": [
    "sources",
    "targets",
    "sources_to_targets",
    "units",
    "distance_units",
    "mode"
  ],
  "properties": {
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RouteMatrixLocation"
      }
    },
    "targets": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RouteMatrixLocation"
      }
    },
    "sources_to_targets": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "$ref": "#/$defs/RouteMatrixCell"
        }
      }
    },
    "units": {
      "type": "string",
      "enum": [
        "metric",
        "imperial"
      ]
    },
    "distance_units": {
      "type": "string",
      "enum": [
        "meters",
        "miles"
      ]
    },
    "mode": {
      "type": "string",
      "enum": [
        "walk",
        "hike",
        "scooter",
        "motorcycle",
        "drive",
        "light_truck",
        "bicycle",
        "mountain_bike",
        "road_bike",
        "bus",
        "medium_truck",
        "truck",
        "truck_dangerous_goods",
        "heavy_truck",
        "long_truck",
        "transit",
        "approximated_transit"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "balanced",
        "short",
        "less_maneuvers"
      ]
    },
    "max_speed": {
      "type": "number"
    },
    "avoid": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Avoid"
      }
    },
    "traffic": {
      "type": "string",
      "enum": [
        "free_flow",
        "approximated"
      ]
    }
  },
  "$defs": {
    "Avoid": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "tolls",
            "ferries",
            "highways",
            "locations",
            "polygons",
            "green_zones",
            "country_codes",
            "transfers"
          ]
        },
        "importance": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "values": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/LocationData"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/LocationData"
                }
              }
            }
          ]
        }
      }
    },
    "LocationData": {
      "type": "object",
      "required": [
        "lat",
        "lon"
      ],
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        "address": {
          "type": "string"
        }
      }
    },
    "LongitudeLatitude": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "prefixItems": [
        {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        }
      ],
      "items": false
    },
    "RouteMatrixCell": {
      "type": "object",
      "required": [
        "distance",
        "time",
        "source_index",
        "target_index"
      ],
      "properties": {
        "distance": {
          "type": [
            "number",
            "null"
          ]
        },
        "time": {
          "type": [
            "number",
            "null"
          ]
        },
        "source_index": {
          "type": "integer"
        },
        "target_index": {
          "type": "integer"
        }
      }
    },
    "RouteMatrixLocation": {
      "type": "object",
      "required": [
        "original_location"
      ],
      "properties": {
        "original_location": {
          "$ref": "#/$defs/LongitudeLatitude"
        },
        "location": {
          "$ref": "#/$defs/LongitudeLatitude"
        }
      }
    }
  }
}