{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/geoapify/json-schema/geoapify-routing-json-response-schema.json",
  "title": "RoutingJsonResponse",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/geoapify-routing-api-openapi.yml#/components/schemas/RoutingJsonResponse",
  "type": "object",
  "required": [
    "results",
    "properties"
  ],
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RoutingJsonResult"
      }
    },
    "properties": {
      "$ref": "#/$defs/RoutingResponseOptions"
    },
    "bbox": {
      "type": "array",
      "minItems": 4,
      "maxItems": 6,
      "items": {
        "type": "number"
      }
    }
  },
  "$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"
                }
              }
            }
          ]
        }
      }
    },
    "InputRouteWaypoint": {
      "type": "object",
      "required": [
        "lat",
        "lon"
      ],
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        "address": {
          "type": "string"
        }
      }
    },
    "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
    },
    "RouteAdminArea": {
      "type": "object",
      "required": [
        "country_code"
      ],
      "properties": {
        "country_code": {
          "type": "string"
        },
        "country_text": {
          "type": "string"
        },
        "state_code": {
          "type": "string"
        },
        "state_text": {
          "type": "string"
        }
      }
    },
    "RouteAdminAreaCrossing": {
      "type": "object",
      "required": [
        "from_admin_index",
        "to_admin_index",
        "begin_shape_index",
        "end_shape_index"
      ],
      "properties": {
        "from_admin_index": {
          "type": "integer"
        },
        "to_admin_index": {
          "type": "integer"
        },
        "begin_shape_index": {
          "type": "integer"
        },
        "end_shape_index": {
          "type": "integer"
        }
      }
    },
    "RouteInstruction": {
      "type": "object",
      "required": [
        "text"
      ],
      "properties": {
        "text": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "transition_instruction": {
          "type": "string"
        },
        "pre_transition_instruction": {
          "type": "string"
        },
        "post_transition_instruction": {
          "type": "string"
        },
        "contains_next_instruction": {
          "type": "boolean"
        },
        "streets": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exit_number": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exit_road_name": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exit_towards": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "roundabout_exit": {
          "type": "number"
        }
      }
    },
    "RouteLeg": {
      "type": "object",
      "required": [
        "time",
        "distance",
        "steps"
      ],
      "properties": {
        "time": {
          "type": "number"
        },
        "distance": {
          "type": "number"
        },
        "polyline5": {
          "type": "string",
          "description": "Precision-5 encoded geometry for the leg. Present when `details=polyline5` is requested."
        },
        "polyline6": {
          "type": "string",
          "description": "Precision-6 encoded geometry for the leg. Present when `details=polyline6` is requested."
        },
        "steps": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteStep"
          }
        },
        "country_code": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "elevation": {
          "type": "array",
          "items": {
            "type": "number"
          }
        },
        "elevation_range": {
          "type": "array",
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "prefixItems": [
              {
                "type": "number"
              },
              {
                "type": "number"
              }
            ],
            "items": false
          }
        },
        "agency_name": {
          "type": "string"
        },
        "agency_id": {
          "type": "string"
        },
        "agency_url": {
          "type": "string"
        },
        "route_id": {
          "type": "string"
        },
        "route_short_name": {
          "type": "string"
        },
        "route_long_name": {
          "type": "string"
        },
        "trip_id": {
          "type": "string"
        }
      }
    },
    "RouteStep": {
      "type": "object",
      "required": [
        "from_index",
        "to_index",
        "time",
        "distance"
      ],
      "properties": {
        "from_index": {
          "type": "integer"
        },
        "to_index": {
          "type": "integer"
        },
        "time": {
          "type": "number"
        },
        "distance": {
          "type": "number"
        },
        "instruction": {
          "$ref": "#/$defs/RouteInstruction"
        },
        "toll": {
          "type": "boolean"
        },
        "ferry": {
          "type": "boolean"
        },
        "bridge": {
          "type": "boolean"
        },
        "tunnel": {
          "type": "boolean"
        },
        "elevation": {
          "type": "number"
        },
        "elevation_gain": {
          "type": "number"
        },
        "max_elevation": {
          "type": "number"
        },
        "min_elevation": {
          "type": "number"
        },
        "admin_area": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "speed": {
          "type": "number"
        },
        "speed_limit": {
          "type": "number"
        },
        "truck_limit": {
          "type": "number"
        },
        "surface": {
          "type": "string"
        },
        "lane_count": {
          "type": "number"
        },
        "road_class": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "roundabout": {
          "type": "boolean"
        },
        "rightside": {
          "type": "boolean"
        },
        "traversability": {
          "type": "string"
        },
        "from_stop_id": {
          "type": "string"
        },
        "from_stop_name": {
          "type": "string"
        },
        "to_stop_id": {
          "type": "string"
        },
        "to_stop_name": {
          "type": "string"
        }
      }
    },
    "RouteWaypoint": {
      "oneOf": [
        {
          "$ref": "#/$defs/SnappedRouteWaypoint"
        },
        {
          "$ref": "#/$defs/InputRouteWaypoint"
        }
      ]
    },
    "RoutingJsonPoint": {
      "type": "object",
      "required": [
        "lon",
        "lat"
      ],
      "properties": {
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        }
      }
    },
    "RoutingJsonResult": {
      "type": "object",
      "required": [
        "mode",
        "units",
        "waypoints",
        "distance",
        "time",
        "legs",
        "geometry"
      ],
      "properties": {
        "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"
          ]
        },
        "units": {
          "type": "string",
          "enum": [
            "metric",
            "imperial"
          ]
        },
        "waypoints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteWaypoint"
          }
        },
        "avoid": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Avoid"
          }
        },
        "details": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "instruction_details",
              "route_details",
              "elevation",
              "admin_areas",
              "polyline5",
              "polyline6"
            ]
          }
        },
        "traffic": {
          "type": "string",
          "enum": [
            "free_flow",
            "approximated"
          ]
        },
        "intermediate_waypoint_mode": {
          "type": "string",
          "enum": [
            "stopover",
            "through_stop",
            "pass_through"
          ]
        },
        "distance": {
          "type": "number"
        },
        "time": {
          "type": "number"
        },
        "distance_units": {
          "type": "string",
          "enum": [
            "meters",
            "miles"
          ]
        },
        "max_speed": {
          "type": "number"
        },
        "polyline5": {
          "type": "string",
          "description": "Precision-5 encoded geometry for the complete route. Present when `details=polyline5` is requested."
        },
        "polyline6": {
          "type": "string",
          "description": "Precision-6 encoded geometry for the complete route. Present when `details=polyline6` is requested."
        },
        "legs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteLeg"
          }
        },
        "country_code": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "admin_areas": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteAdminArea"
          }
        },
        "admin_area_crossings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteAdminAreaCrossing"
          }
        },
        "toll": {
          "type": "boolean"
        },
        "ferry": {
          "type": "boolean"
        },
        "geometry": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/$defs/RoutingJsonPoint"
            }
          }
        }
      }
    },
    "RoutingResponseOptions": {
      "type": "object",
      "required": [
        "mode",
        "units",
        "waypoints"
      ],
      "properties": {
        "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"
          ]
        },
        "units": {
          "type": "string",
          "enum": [
            "metric",
            "imperial"
          ]
        },
        "waypoints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteWaypoint"
          }
        },
        "avoid": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Avoid"
          }
        },
        "details": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "instruction_details",
              "route_details",
              "elevation",
              "admin_areas",
              "polyline5",
              "polyline6"
            ]
          }
        },
        "traffic": {
          "type": "string",
          "enum": [
            "free_flow",
            "approximated"
          ]
        },
        "intermediate_waypoint_mode": {
          "type": "string",
          "enum": [
            "stopover",
            "through_stop",
            "pass_through"
          ]
        }
      }
    },
    "SnappedRouteWaypoint": {
      "type": "object",
      "required": [
        "location"
      ],
      "properties": {
        "original_index": {
          "type": "integer"
        },
        "location": {
          "$ref": "#/$defs/LongitudeLatitude"
        }
      }
    }
  }
}