{
  "openapi": "3.0.2",
  "info": {
    "title": "Realtime Tracker",
    "description": "Endpoints for monitoring and analysis of realtime tracker data\n\nFor any use-case other than monitoring or static analysis you should use the\nWebsocket API.\n\nIn the following `train` refers to a group of vehicles servicing the same set\nof journeys for any MOT (not only `rail`).\n",
    "version": "1.0.1"
  },
  "paths": {
    "/trajectories/{feed_name}/": {
      "get": {
        "tags": ["HTTP API"],
        "summary": "Trajectories",
        "description": "Get all current trajectories between two stops for the given feed\n\nThis is roughly equivalent to calling\n\n    BBOX <x_min> <y_min> <x_max> <y_max> <zoom> [tenant=<feed_name>] [gen_level=<gen_level>] [mots=<mots>]\n\non the websocket but does not support all Websocket API parameters and\n`feed_name` is not optional for the HTTP-API.",
        "operationId": "trajectories_trajectories__feed_name___get",
        "parameters": [
          {
            "required": true,
            "schema": { "title": "Feed Name", "type": "string" },
            "name": "feed_name",
            "in": "path"
          },
          {
            "required": false,
            "schema": {
              "title": "Bbox",
              "pattern": "^(-?[0-9]{1,8},){3}-?[0-9]{1,8}$",
              "type": "string"
            },
            "name": "bbox",
            "in": "query"
          },
          {
            "required": false,
            "schema": { "title": "Gen Level", "type": "integer" },
            "name": "gen_level",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Validate Output",
              "type": "boolean",
              "default": false
            },
            "name": "validate_output",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrajectoryCollection"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/journeys/{train_id}/": {
      "get": {
        "tags": ["HTTP API"],
        "summary": "Full Trajectory",
        "description": "Get geometries for the current journeys of the given train\n\nThe `FeatureCollection` includes `Feature`s with `GeometryCollections` for\neach journey where the `MultiPoint` geometry represents the stop points and\nthe `LineString` the full trajectory.\n\nThis is equivalent to calling\n\n    GET full_trajectory_<train_id>\n\non the websocket.",
        "operationId": "full_trajectory_journeys__train_id___get",
        "parameters": [
          {
            "required": true,
            "schema": { "title": "Train Id", "type": "string" },
            "name": "train_id",
            "in": "path"
          },
          {
            "required": false,
            "schema": { "title": "Gen Level", "type": "integer" },
            "name": "gen_level",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FullTrajectoryCollection"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/calls/{train_id}/": {
      "get": {
        "tags": ["HTTP API"],
        "summary": "Calls",
        "description": "Get the stop sequences for the current journeys of the given train\n\nThis is equivalent to calling\n\n    GET stopsequence_<train_id>\n\non the websocket.",
        "operationId": "calls_calls__train_id___get",
        "parameters": [
          {
            "required": true,
            "schema": { "title": "Train Id", "type": "string" },
            "name": "train_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Calls Calls  Train Id   Get",
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/StopSequence" }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/feeds/": {
      "get": {
        "tags": ["HTTP API"],
        "summary": "Feeds",
        "description": "Get a list of all active feeds\n\nThis is the only endpoint without Websocket API equivalent, where this info\nis not needed normally (the `BBOX` command picks all the relevant data for\nyou).",
        "operationId": "feeds_feeds__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FeedCollection" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Feed": {
        "title": "Feed",
        "required": [
          "short_name",
          "license",
          "trajectory_count",
          "has_realtime_feed",
          "color"
        ],
        "type": "object",
        "properties": {
          "short_name": { "title": "Short Name", "type": "string" },
          "name": { "title": "Name", "type": "string" },
          "url": { "title": "Url", "type": "string" },
          "valid_from": {
            "title": "Valid From",
            "type": "string",
            "format": "date-time"
          },
          "valid_to": {
            "title": "Valid To",
            "type": "string",
            "format": "date-time"
          },
          "version": { "title": "Version", "type": "string" },
          "license": { "$ref": "#/components/schemas/License" },
          "trajectory_count": {
            "title": "Trajectory Count",
            "type": "integer"
          },
          "has_realtime_feed": {
            "title": "Has Realtime Feed",
            "type": "boolean"
          },
          "x": { "title": "X", "type": "integer" },
          "y": { "title": "Y", "type": "integer" },
          "bbox": {
            "title": "Bbox",
            "maxItems": 4,
            "minItems": 4,
            "type": "array",
            "items": { "type": "integer" }
          },
          "color": {
            "title": "Color",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          }
        }
      },
      "FeedCollection": {
        "title": "FeedCollection",
        "required": ["trajectory_count", "feed_count", "feeds"],
        "type": "object",
        "properties": {
          "trajectory_count": {
            "title": "Trajectory Count",
            "type": "integer"
          },
          "feed_count": { "title": "Feed Count", "type": "integer" },
          "feeds": {
            "title": "Feeds",
            "type": "object",
            "additionalProperties": { "$ref": "#/components/schemas/Feed" }
          }
        }
      },
      "FullTrajectory": {
        "title": "FullTrajectory",
        "required": ["type", "geometry", "properties"],
        "type": "object",
        "properties": {
          "type": { "title": "Type", "enum": ["Feature"], "type": "string" },
          "geometry": {
            "title": "Geometry",
            "anyOf": [
              { "$ref": "#/components/schemas/GeometryCollectionGeometry" },
              { "$ref": "#/components/schemas/LineStringGeometry" }
            ]
          },
          "properties": {
            "$ref": "#/components/schemas/FullTrajectoryProperties"
          }
        }
      },
      "FullTrajectoryCollection": {
        "title": "FullTrajectoryCollection",
        "required": ["type", "properties", "features"],
        "type": "object",
        "properties": {
          "type": {
            "title": "Type",
            "enum": ["FeatureCollection"],
            "type": "string"
          },
          "properties": {
            "$ref": "#/components/schemas/FullTrajectoryCollectionProperties"
          },
          "features": {
            "title": "Features",
            "type": "array",
            "items": { "$ref": "#/components/schemas/FullTrajectory" }
          }
        }
      },
      "FullTrajectoryCollectionProperties": {
        "title": "FullTrajectoryCollectionProperties",
        "required": ["train_id", "gen_range"],
        "type": "object",
        "properties": {
          "tenant": { "title": "Tenant", "type": "string" },
          "publisher": { "title": "Publisher", "type": "string" },
          "publisherUrl": { "title": "Publisherurl", "type": "string" },
          "operator": { "title": "Operator", "type": "string" },
          "operatorUrl": { "title": "Operatorurl", "type": "string" },
          "license": { "title": "License", "type": "string" },
          "licenseUrl": { "title": "Licenseurl", "type": "string" },
          "licenseNote": { "title": "Licensenote", "type": "string" },
          "gen_level": {
            "title": "Gen Level",
            "maximum": 32767.0,
            "minimum": -32767.0,
            "type": "integer"
          },
          "train_id": { "title": "Train Id", "type": "string" },
          "gen_range": {
            "title": "Gen Range",
            "maxItems": 2,
            "minItems": 2,
            "uniqueItems": true,
            "type": "array",
            "items": {
              "maximum": 32767.0,
              "minimum": -32767.0,
              "type": "integer"
            }
          }
        }
      },
      "FullTrajectoryProperties": {
        "title": "FullTrajectoryProperties",
        "required": ["train_id", "journey_id", "line_id", "gen_range"],
        "type": "object",
        "properties": {
          "stroke": {
            "title": "Stroke",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          },
          "line_name": { "title": "Line Name", "type": "string" },
          "type": {
            "title": "Type",
            "enum": [
              "tram",
              "subway",
              "rail",
              "bus",
              "ferry",
              "cablecar",
              "gondola",
              "funicular",
              "coach"
            ],
            "type": "string"
          },
          "event_timestamp": {
            "title": "Event Timestamp",
            "type": "string",
            "format": "date-time"
          },
          "train_id": { "title": "Train Id", "type": "string" },
          "journey_id": { "title": "Journey Id", "type": "integer" },
          "line_id": { "title": "Line Id", "type": "integer" },
          "gen_level": {
            "title": "Gen Level",
            "maximum": 32767.0,
            "minimum": -32767.0,
            "type": "integer"
          },
          "gen_range": {
            "title": "Gen Range",
            "maxItems": 2,
            "minItems": 2,
            "uniqueItems": true,
            "type": "array",
            "items": {
              "maximum": 32767.0,
              "minimum": -32767.0,
              "type": "integer"
            }
          }
        }
      },
      "GeometryCollectionGeometry": {
        "title": "GeometryCollectionGeometry",
        "required": ["type", "geometries"],
        "type": "object",
        "properties": {
          "type": {
            "title": "Type",
            "enum": ["GeometryCollection"],
            "type": "string"
          },
          "geometries": {
            "title": "Geometries",
            "type": "array",
            "items": {
              "anyOf": [
                { "$ref": "#/components/schemas/LineStringGeometry" },
                { "$ref": "#/components/schemas/MutiPointGeometry" },
                { "$ref": "#/components/schemas/MutiLineStringGeometry" }
              ]
            }
          }
        }
      },
      "HTTPValidationError": {
        "title": "HTTPValidationError",
        "type": "object",
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "array",
            "items": { "$ref": "#/components/schemas/ValidationError" }
          }
        }
      },
      "License": {
        "title": "License",
        "type": "object",
        "properties": {
          "name": { "title": "Name", "type": "string" },
          "url": { "title": "Url", "type": "string" },
          "note": { "title": "Note", "type": "string" }
        }
      },
      "Line": {
        "title": "Line",
        "type": "object",
        "properties": {
          "id": { "title": "Id", "type": "integer" },
          "name": { "title": "Name", "type": "string" },
          "color": {
            "title": "Color",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          },
          "text_color": {
            "title": "Text Color",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          },
          "stroke": {
            "title": "Stroke",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          }
        }
      },
      "LineStringGeometry": {
        "title": "LineStringGeometry",
        "required": ["type", "coordinates"],
        "type": "object",
        "properties": {
          "type": { "title": "Type", "enum": ["LineString"], "type": "string" },
          "coordinates": {
            "title": "Coordinates",
            "type": "array",
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "type": "array",
              "items": { "type": "number" }
            }
          }
        }
      },
      "MutiLineStringGeometry": {
        "title": "MutiLineStringGeometry",
        "required": ["type", "coordinates"],
        "type": "object",
        "properties": {
          "type": {
            "title": "Type",
            "enum": ["MutiLineString"],
            "type": "string"
          },
          "coordinates": {
            "title": "Coordinates",
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "maxItems": 2,
                "minItems": 2,
                "type": "array",
                "items": { "type": "number" }
              }
            }
          }
        }
      },
      "MutiPointGeometry": {
        "title": "MutiPointGeometry",
        "required": ["type", "coordinates"],
        "type": "object",
        "properties": {
          "type": { "title": "Type", "enum": ["MultiPoint"], "type": "string" },
          "coordinates": {
            "title": "Coordinates",
            "type": "array",
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "type": "array",
              "items": { "type": "number" }
            }
          }
        }
      },
      "SerializedCancellationChange": {
        "title": "SerializedCancellationChange",
        "type": "object",
        "properties": {
          "old_to": { "title": "Old To", "type": "string" },
          "state": {
            "title": "State",
            "enum": [
              "LEAVING",
              "BOARDING",
              "STOP_CANCELLED",
              "JOURNEY_CANCELLED"
            ],
            "type": "string"
          },
          "new_to": { "title": "New To", "type": "string" },
          "no_stop_till": { "title": "No Stop Till", "type": "string" },
          "no_stop_between": {
            "title": "No Stop Between",
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "StopSequence": {
        "title": "StopSequence",
        "required": [
          "id",
          "color",
          "stroke",
          "text_color",
          "destination",
          "new_destination",
          "longName",
          "routeIdentifier",
          "shortName",
          "type",
          "stations"
        ],
        "type": "object",
        "properties": {
          "tenant": { "title": "Tenant", "type": "string" },
          "publisher": { "title": "Publisher", "type": "string" },
          "publisherUrl": { "title": "Publisherurl", "type": "string" },
          "operator": { "title": "Operator", "type": "string" },
          "operatorUrl": { "title": "Operatorurl", "type": "string" },
          "license": { "title": "License", "type": "string" },
          "licenseUrl": { "title": "Licenseurl", "type": "string" },
          "licenseNote": { "title": "Licensenote", "type": "string" },
          "id": { "title": "Id", "type": "string" },
          "color": {
            "title": "Color",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          },
          "stroke": {
            "title": "Stroke",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          },
          "text_color": {
            "title": "Text Color",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "type": "string"
          },
          "destination": { "title": "Destination", "type": "string" },
          "new_destination": { "title": "New Destination", "type": "string" },
          "longName": { "title": "Longname", "type": "string" },
          "routeIdentifier": { "title": "Routeidentifier", "type": "string" },
          "shortName": { "title": "Shortname", "type": "string" },
          "type": {
            "title": "Type",
            "enum": [
              "tram",
              "subway",
              "rail",
              "bus",
              "ferry",
              "cablecar",
              "gondola",
              "funicular",
              "coach"
            ],
            "type": "string"
          },
          "stations": {
            "title": "Stations",
            "type": "array",
            "items": { "$ref": "#/components/schemas/StopSequenceCall" }
          }
        }
      },
      "StopSequenceCall": {
        "title": "StopSequenceCall",
        "required": [
          "arrivalDelay",
          "arrivalTime",
          "aimedArrivalTime",
          "cancelled",
          "departureDelay",
          "departureTime",
          "aimedDepartureTime",
          "noDropOff",
          "noPickUp",
          "stationId",
          "stationName",
          "coordinate"
        ],
        "type": "object",
        "properties": {
          "state": {
            "title": "State",
            "enum": [
              "LEAVING",
              "BOARDING",
              "STOP_CANCELLED",
              "JOURNEY_CANCELLED"
            ],
            "type": "string"
          },
          "changes": {
            "title": "Changes",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SerializedCancellationChange"
            }
          },
          "arrivalDelay": {
            "title": "Arrivaldelay",
            "type": "number",
            "format": "time-delta"
          },
          "arrivalTime": {
            "title": "Arrivaltime",
            "type": "string",
            "format": "date-time"
          },
          "aimedArrivalTime": {
            "title": "Aimedarrivaltime",
            "type": "string",
            "format": "date-time"
          },
          "cancelled": { "title": "Cancelled", "type": "boolean" },
          "departureDelay": {
            "title": "Departuredelay",
            "type": "number",
            "format": "time-delta"
          },
          "departureTime": {
            "title": "Departuretime",
            "type": "string",
            "format": "date-time"
          },
          "aimedDepartureTime": {
            "title": "Aimeddeparturetime",
            "type": "string",
            "format": "date-time"
          },
          "noDropOff": { "title": "Nodropoff", "type": "boolean" },
          "noPickUp": { "title": "Nopickup", "type": "boolean" },
          "stationId": { "title": "Stationid", "type": "integer" },
          "stationName": { "title": "Stationname", "type": "string" },
          "coordinate": {
            "title": "Coordinate",
            "maxItems": 2,
            "minItems": 2,
            "type": "array",
            "items": { "type": "number" }
          }
        }
      },
      "TrackerTrajectory": {
        "title": "TrackerTrajectory",
        "required": ["type", "geometry", "properties"],
        "type": "object",
        "properties": {
          "type": { "title": "Type", "enum": ["Feature"], "type": "string" },
          "geometry": { "$ref": "#/components/schemas/LineStringGeometry" },
          "properties": {
            "$ref": "#/components/schemas/TrackerTrajectoryProperties"
          }
        },
        "description": "Current section of the route the given vehicle is on\n\nThe `geometry` contains the LineString between two stops.\n\nThe `time_intervals` property contains a list of `[timestamp, fraction,\ndirection]` tupels.\n\nEach `time_intervals` item contains the fraction of the geometry where\nthe vehicle is at the given timestamp. If present the direction is the\ncurrent rotation of the vehicle relative to the horizontal axis as\nradian.\n\nThe current location of the vehicle can be calculated by\nlinear interpolation from the fraction of the first item where the\ntimestamp is smaller then the current time to the fraction of the next\nitem."
      },
      "TrackerTrajectoryProperties": {
        "title": "TrackerTrajectoryProperties",
        "required": [
          "bounds",
          "gen_range",
          "tenant",
          "time_intervals",
          "train_id",
          "timestamp",
          "has_realtime",
          "has_realtime_journey",
          "operator_provides_realtime_journey",
          "has_journey"
        ],
        "type": "object",
        "properties": {
          "bounds": {
            "title": "Bounds",
            "maxItems": 4,
            "minItems": 4,
            "type": "array",
            "items": { "type": "integer" }
          },
          "gen_range": {
            "title": "Gen Range",
            "maxItems": 2,
            "minItems": 2,
            "uniqueItems": true,
            "type": "array",
            "items": {
              "maximum": 32767.0,
              "minimum": -32767.0,
              "type": "integer"
            }
          },
          "tenant": { "title": "Tenant", "type": "string" },
          "time_intervals": {
            "title": "Time Intervals",
            "minItems": 2,
            "type": "array",
            "items": {
              "maxItems": 3,
              "minItems": 3,
              "type": "array",
              "items": { "type": "number" }
            }
          },
          "train_id": { "title": "Train Id", "type": "string" },
          "timestamp": {
            "title": "Timestamp",
            "type": "string",
            "format": "date-time"
          },
          "has_realtime": { "title": "Has Realtime", "type": "boolean" },
          "has_realtime_journey": {
            "title": "Has Realtime Journey",
            "type": "boolean"
          },
          "operator_provides_realtime_journey": {
            "title": "Operator Provides Realtime Journey",
            "enum": ["yes", "no", "maybe", "unknown"],
            "type": "string"
          },
          "has_journey": { "title": "Has Journey", "type": "boolean" },
          "type": {
            "title": "Type",
            "enum": [
              "tram",
              "subway",
              "rail",
              "bus",
              "ferry",
              "cablecar",
              "gondola",
              "funicular",
              "coach"
            ],
            "type": "string"
          },
          "event_timestamp": {
            "title": "Event Timestamp",
            "type": "string",
            "format": "date-time"
          },
          "line": { "$ref": "#/components/schemas/Line" },
          "gen_level": {
            "title": "Gen Level",
            "maximum": 32767.0,
            "minimum": -32767.0,
            "type": "integer"
          },
          "state": {
            "title": "State",
            "enum": ["DRIVING", "BOARDING", "JOURNEY_CANCELLED"],
            "type": "string"
          },
          "time_since_update": {
            "title": "Time Since Update",
            "type": "integer"
          },
          "delay": { "title": "Delay", "type": "integer" },
          "route_identifier": { "title": "Route Identifier", "type": "string" }
        }
      },
      "TrajectoryCollection": {
        "title": "TrajectoryCollection",
        "required": ["features"],
        "type": "object",
        "properties": {
          "type": {
            "title": "Type",
            "enum": ["FeatureCollection"],
            "type": "string",
            "default": "FeatureCollection"
          },
          "features": {
            "title": "Features",
            "type": "array",
            "items": { "$ref": "#/components/schemas/TrackerTrajectory" }
          }
        }
      },
      "ValidationError": {
        "title": "ValidationError",
        "required": ["loc", "msg", "type"],
        "type": "object",
        "properties": {
          "loc": {
            "title": "Location",
            "type": "array",
            "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] }
          },
          "msg": { "title": "Message", "type": "string" },
          "type": { "title": "Error Type", "type": "string" }
        }
      }
    },
    "securitySchemes": {
      "QueryTokenAuth": { "type": "apiKey", "in": "query", "name": "key" },
      "HeaderTokenAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization"
      }
    }
  },
  "servers": [{ "url": "https://api.geops.io/tracker-http/v1" }],
  "security": [{ "QueryTokenAuth": [] }, { "HeaderTokenAuth": [] }]
}
