{
  "openapi": "3.1.0",
  "x-stoplight": {
    "id": "uik1k23c3xcjz"
  },
  "info": {
    "version": "1.0",
    "title": "Transit Time",
    "description": "Transit time calculator"
  },
  "servers": [
    {
      "url": "https://api.qubictron.com/transit-time/v1"
    }
  ],
  "paths": {
    "/search": {
      "get": {
        "summary": "Transit time calculator.",
        "description": "Get the best route and estimated time delivery.",
        "operationId": "transit-time-v1",
        "tags": [
          "Transit Time"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/from"
          },
          {
            "$ref": "#/components/parameters/to"
          },
          {
            "$ref": "#/components/parameters/transport_modes"
          },
          {
            "$ref": "#/components/parameters/alternative_routes"
          },
          {
            "$ref": "#/components/parameters/routing_mode"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TheRouteHasBeenFound"
                },
                "examples": {
                  "success - OK": {
                    "description": "The request has been successfully completed. The route has been found.",
                    "value": {
                      "success": true,
                      "status_code": "OK",
                      "metadata": {
                        "request_parameters": {
                          "from": "Madrid, Spain",
                          "to": "Ibiza, Spain",
                          "transport_modes": "ROAD",
                          "alternative_routes": false,
                          "routing_mode": "short"
                        }
                      },
                      "data": {
                        "route": {
                          "summary": {
                            "duration": 47730,
                            "distance": 530342,
                            "speed": 40
                          },
                          "from": {
                            "description": "Madrid, Comunidad de Madrid, Spain",
                            "name": "Madrid",
                            "state": "Comunidad de Madrid",
                            "country": "Spain",
                            "country_code": "ES",
                            "locode": "ESMAD",
                            "lat": 40.4165,
                            "lng": -3.70256
                          },
                          "to": {
                            "description": "Santa Eularia des Riu, Comunitat Autonoma de les Illes Balears, Spain",
                            "name": "Santa Eularia des Riu",
                            "state": "Comunitat Autonoma de les Illes Balears",
                            "country": "Spain",
                            "country_code": "ES",
                            "locode": "ESSTE",
                            "lat": 38.98457,
                            "lng": 1.53409
                          },
                          "sections": [
                            {
                              "summary": {
                                "duration": 47730,
                                "distance": 530342,
                                "speed": 40
                              },
                              "from": {
                                "description": "Madrid, Comunidad de Madrid, Spain",
                                "name": "Madrid",
                                "state": "Comunidad de Madrid",
                                "country": "Spain",
                                "country_code": "ES",
                                "locode": "ESMAD",
                                "lat": 40.4165,
                                "lng": -3.70256
                              },
                              "to": {
                                "description": "Santa Eularia des Riu, Comunitat Autonoma de les Illes Balears, Spain",
                                "name": "Santa Eularia des Riu",
                                "state": "Comunitat Autonoma de les Illes Balears",
                                "country": "Spain",
                                "country_code": "ES",
                                "locode": "ESSTE",
                                "lat": 38.98457,
                                "lng": 1.53409
                              },
                              "transport_mode": "ROAD",
                              "path": [
                                [
                                  40.41674,
                                  -3.70233
                                ],
                                [
                                  39.7883199999995,
                                  -2.42739000000004
                                ],
                                [
                                  39.70590999999947,
                                  -2.389710000000039
                                ],
                                [
                                  39.63814999999948,
                                  -2.329050000000039
                                ],
                                [
                                  39.565569999999475,
                                  -2.275720000000041
                                ],
                                [
                                  39.50520999999937,
                                  -2.2087400000000463
                                ],
                                [
                                  39.452099999999305,
                                  -0.5494100000000518
                                ],
                                [
                                  39.390839999999294,
                                  -0.4822100000000522
                                ],
                                [
                                  39.32844999999926,
                                  -0.41705000000005255
                                ],
                                [
                                  39.23836999999929,
                                  -0.4117400000000524
                                ],
                                [
                                  39.16478999999931,
                                  -0.35941000000005224
                                ],
                                [
                                  39.117579999999286,
                                  -0.28245000000005227
                                ],
                                [
                                  39.04547999999924,
                                  -0.2285600000000526
                                ],
                                [
                                  38.96028999999921,
                                  -0.1989300000000524
                                ],
                                [
                                  38.90637999999916,
                                  -0.12685000000005262
                                ],
                                [
                                  38.87218999999912,
                                  -0.04347000000005263
                                ],
                                [
                                  38.81785999999918,
                                  0.028399999999947367
                                ],
                                [
                                  38.98453399999991,
                                  1.5340080000000023
                                ]
                              ],
                              "ferry_paths": [
                                [
                                  [
                                    38.84428,
                                    0.11434
                                  ],
                                  [
                                    38.844179999999994,
                                    0.11431999999999999
                                  ],
                                  [
                                    38.84260999999999,
                                    0.11442
                                  ],
                                  [
                                    38.84188999999999,
                                    0.11578999999999999
                                  ],
                                  [
                                    38.84318999999999,
                                    0.11973999999999999
                                  ],
                                  [
                                    38.84456999999999,
                                    0.12213999999999998
                                  ],
                                  [
                                    38.88312999999999,
                                    0.38972999999999997
                                  ],
                                  [
                                    38.90101999999999,
                                    0.51393
                                  ],
                                  [
                                    38.907009999999985,
                                    0.55898
                                  ],
                                  [
                                    38.91525999999998,
                                    0.62099
                                  ],
                                  [
                                    38.921599999999984,
                                    0.6686500000000001
                                  ],
                                  [
                                    38.927539999999986,
                                    0.7132700000000001
                                  ],
                                  [
                                    38.93598999999999,
                                    0.77539
                                  ],
                                  [
                                    38.95538999999999,
                                    0.9225300000000001
                                  ],
                                  [
                                    38.95688999999999,
                                    0.9339400000000001
                                  ],
                                  [
                                    38.99626999999999,
                                    1.2135600000000002
                                  ],
                                  [
                                    38.978509999999986,
                                    1.2889500000000003
                                  ],
                                  [
                                    38.97520999999998,
                                    1.2966200000000003
                                  ],
                                  [
                                    38.975129999999986,
                                    1.2975100000000004
                                  ],
                                  [
                                    38.975749999999984,
                                    1.2980300000000005
                                  ],
                                  [
                                    38.97582999999998,
                                    1.2980200000000004
                                  ]
                                ]
                              ],
                              "stats": []
                            }
                          ]
                        },
                        "alternative_routes": []
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "servers": [
          {
            "url": "https://api.qubictron.com/transit-time"
          }
        ],
        "x-stoplight": {
          "id": "gu8xn658g45xw"
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API key required for authentication. Pass it as an HTTP header: `x-api-key: YOUR_API_KEY`. If the key is missing or invalid, the API returns HTTP 401 with `{\"success\": false, \"status_code\": \"INVALID_API_KEY\"}`."
      }
    },
    "parameters": {
      "from": {
        "name": "from",
        "in": "query",
        "description": "Route start location data: coordinates in the format `latitude,longitude`, UN/LOCODE, country code (2-letter code), or IATA/ICAO airport code. Also - addresses in any format, company names, city names, country names, landmark names and more. *Please note that we cannot guarantee an accurate location based on the description, and there may be several reasons for this.",
        "required": true,
        "schema": {
          "type": "string",
          "examples": [
            "31.366365,121.61475",
            "CNSHG",
            "CN",
            "LAX",
            "KLAX",
            "DE-10115-Berlin",
            "Shanghai",
            "United Arab Emirates",
            "Eiffel Tower, Paris"
          ]
        },
        "examples": {
          "default": {
            "value": "CNSHG"
          }
        }
      },
      "to": {
        "name": "to",
        "in": "query",
        "description": "Route end location data: coordinates in the format `latitude,longitude`, UN/LOCODE, country code (2-letter code), or IATA/ICAO airport code. Also - addresses in any format, company names, city names, country names, landmark names and more. *Please note that we cannot guarantee an accurate location based on the description, and there may be several reasons for this.",
        "required": true,
        "schema": {
          "type": "string",
          "examples": [
            "33.76696,-118.18923",
            "USLGB",
            "US",
            "LAX",
            "KLAX",
            "DE-10115-Berlin",
            "Shanghai",
            "United Arab Emirates",
            "Eiffel Tower, Paris"
          ]
        },
        "examples": {
          "default": {
            "value": "USLGB"
          }
        }
      },
      "transport_modes": {
        "name": "transport_modes",
        "in": "query",
        "description": "Modes of transportation that are allowed to be used in route finding. Multiple modes of transportation can be specified separated by a comma. \n\n `SEA` - by sea \n\n `ROAD` - by road \n\n `RAIL` - by rail \n\n `AIR` - by air ",
        "required": false,
        "schema": {
          "type": "string",
          "examples": [
            "SEA",
            "AIR,ROAD"
          ]
        },
        "examples": {
          "default": {
            "value": "SEA,ROAD,RAIL,AIR"
          }
        }
      },
      "routing_mode": {
        "name": "routing_mode",
        "in": "query",
        "description": "This parameter specifies which mode should be used when calculating the route. By default it takes the value `short` - the shortest route from the point of departure to the point of arrival; it can also take the value `safe` - a route that is built taking into account the current geopolitical situation in the world.",
        "required": false,

        "schema": {
          "type": "string",
          "enum": [
            "short",
            "safe"
          ]
        },
        "examples": {
          "default": {
            "value": "short"
          }
        }
      },
      "alternative_routes": {
        "name": "alternative_routes",
        "in": "query",
        "description": "Whether alternative routes should also be provided in the response.",
        "required": false,
        "schema": {
          "type": "boolean",
          "examples": [
            true
          ]
        },
        "examples": {
          "default": {
            "value": false
          }
        }
      }
    },
    "schemas": {
      "TheRouteHasBeenFound": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/ResponseStatusProperty"
          },
          "status_code": {
            "type": "string",
            "enum": [
              "OK",
              "WRONG_PARAMETERS",
              "NO_AVAILABLE_ROUTES",
              "API_KEY_WRONG",
              "API_KEY_ACCESS_DENIED",
              "API_KEY_EXPIRED",
              "API_KEY_LIMIT_REACHED",
              "API_KEY_RATE_LIMIT",
              "UNEXPECTED_ERROR"
            ],
            "description": "Response status description."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "data": {
            "type": "object",
            "description": "Data on request",
            "properties": {
              "route": {
                "$ref": "#/components/schemas/RouteItem"
              },
              "alternative_routes": {
                "$ref": "#/components/schemas/AlternativeRoutes"
              }
            }
          }
        },
        "x-stoplight": {
          "id": "1x6pbhttaryo0"
        }
      },
      "ResponseStatusProperty": {
        "type": "boolean",
        "description": "Response Status: \n\n `true` - upon successful completion of the request; \n\n `false` - when an error occurs",
        "x-stoplight": {
          "id": "4cyfztsjptc47"
        }
      },
      "Metadata": {
        "type": "object",
        "description": "Additional data on request.",
        "properties": {
          "request_parameters": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "description": "Route start location data - coordinates in format `latitude,longitude` or UN/LOCODE.",
                "examples": [
                  "CNSHG"
                ]
              },
              "to": {
                "type": "string",
                "description": "Route end location data - coordinates in format `latitude,longitude` or UN/LOCODE.",
                "examples": [
                  "33.76696,-118.18923"
                ]
              },
              "transport_modes": {
                "type": "string",
                "description": "Modes of transportation that are allowed to be used in route finding.",
                "examples": [
                  "SEA,ROAD"
                ]
              },
              "alternative_routes": {
                "type": "boolean",
                "description": "Whether alternative routes should also be provided in the response.",
                "examples": [
                  false
                ]
              }
            }
          }
        },
        "x-stoplight": {
          "id": "eks9kj41u3cuy"
        }
      },
      "Location": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "A description of the location in the following format - Name, State, Country name",
            "examples": [
              "Shanghai, Shanghai Shi, China"
            ]
          },
          "name": {
            "type": "string",
            "description": "The name of the location.",
            "examples": [
              "Shanghai"
            ]
          },
          "state": {
            "type": "string",
            "nullable": true,
            "description": "First level administrative unit (district, state, province, region, county, department, ...)",
            "examples": [
              "Shanghai Shi"
            ]
          },
          "country": {
            "type": "string",
            "nullable": true,
            "description": "Country name",
            "examples": [
              "China"
            ]
          },
          "country_code": {
            "type": "string",
            "nullable": true,
            "description": "Country code (2 characters)",
            "examples": [
              "CN"
            ]
          },
          "locode": {
            "type": "string",
            "nullable": true,
            "description": "UN/LOCODE",
            "examples": [
              "CNSHG"
            ]
          },
          "lat": {
            "type": "number",
            "nullable": true,
            "description": "Latitude",
            "examples": [
              31.1434001923
            ]
          },
          "lng": {
            "type": "number",
            "nullable": true,
            "description": "Longitude",
            "examples": [
              121.8050003052
            ]
          }
        },
        "x-stoplight": {
          "id": "xfxwhj0wo4ckv"
        }
      },
      "RouteItem": {
        "type": "object",
        "properties": {
          "summary": {
            "$ref": "#/components/schemas/Summary"
          },
          "from": {
            "$ref": "#/components/schemas/Location"
          },
          "to": {
            "$ref": "#/components/schemas/Location"
          },
          "sections": {
            "type": "array",
            "description": "Route sections.",
            "items": {
              "$ref": "#/components/schemas/Section"
            }
          }
        },
        "x-stoplight": {
          "id": "cgflp42w919fy"
        }
      },
      "Summary": {
        "type": "object",
        "properties": {
          "duration": {
            "type": "number",
            "description": "Average route duration in seconds.",
            "examples": [
              1543323
            ]
          },
          "distance": {
            "type": "number",
            "description": "Route length in meters.",
            "examples": [
              11115355
            ]
          },
          "speed": {
            "type": "number",
            "description": "Average speed in kilometers per hour.",
            "examples": [
              25.93
            ]
          }
        },
        "x-stoplight": {
          "id": "ixaj05ijl2oms"
        }
      },
      "TransportMode": {
        "type": "string",
        "enum": [
          "SEA",
          "ROAD",
          "RAIL",
          "AIR"
        ],
        "description": "Mode of transportation",
        "examples": [
          "SEA"
        ],
        "x-stoplight": {
          "id": "pb1wmfqtjd27q"
        }
      },
      "SimpleCoordinates": {
        "type": "array",
        "description": "The first element of the array is the latitude and the second is the longitude.",
        "minItems": 2,
        "maxItems": 2,
        "examples": [
          [
            31.1434001923,
            121.8050003052
          ]
        ],
        "items": {
          "type": "number"
        },
        "x-stoplight": {
          "id": "gyztd1cqjmmaf"
        }
      },
      "AlternativeRoutes": {
        "type": "array",
        "description": "An array of alternative routes.",
        "items": {
          "$ref": "#/components/schemas/RouteItem"
        },
        "x-stoplight": {
          "id": "s1f83wnwlorsi"
        }
      },
      "Section": {
        "type": "object",
        "properties": {
          "summary": {
            "$ref": "#/components/schemas/Summary"
          },
          "from": {
            "$ref": "#/components/schemas/Location"
          },
          "to": {
            "$ref": "#/components/schemas/Location"
          },
          "transport_mode": {
            "$ref": "#/components/schemas/TransportMode"
          },
          "path": {
            "type": "array",
            "description": "Array of route coordinates.",
            "items": {
              "$ref": "#/components/schemas/SimpleCoordinates"
            }
          },
          "ferry_paths": {
            "$ref": "#/components/schemas/FerryPaths"
          },
          "stats": {
            "type": "array",
            "description": "Carrier statistics for this section of the route. Statistics for the last year from the current date. For sea transportation only.",
            "items": {
              "$ref": "#/components/schemas/StatItem"
            }
          }
        },
        "x-stoplight": {
          "id": "fxayemfo5f5dh"
        }
      },
      "FerryPaths": {
        "type": "array",
        "description": "Segments of the route where the ferry mode of transportation is used.",
        "items": {
          "$ref": "#/components/schemas/FerryPathItem"
        }
      },
      "FerryPathItem": {
        "type": "array",
        "description": "Route for ferry.",
        "items": {
          "$ref": "#/components/schemas/SimpleCoordinates"
        }
      },
      "StatItem": {
        "type": "object",
        "properties": {
          "carrier_name": {
            "type": "string",
            "description": "Carrier name.",
            "examples": [
              "Maersk"
            ]
          },
          "carrier_code": {
            "type": "string",
            "description": "The Standard Carrier Alpha Code (SCAC).",
            "examples": [
              "maeu"
            ]
          },
          "duration": {
            "type": "number",
            "description": "Average route duration in seconds.",
            "examples": [
              2155495
            ]
          },
          "speed": {
            "type": "number",
            "description": "Average speed in kilometers per hour.",
            "examples": [
              18.56
            ]
          },
          "popularity": {
            "type": "number",
            "description": "Carrier popularity in percent.",
            "examples": [
              7.7
            ]
          }
        },
        "x-stoplight": {
          "id": "83p37b1wj4nci"
        }
      }
    }
  }
}