{
  "openapi": "3.0.3",
  "info": {
    "title": "PTV Flows Realtime Traffic API",
    "description": "The PTV Flows Realtime Traffic API provides the realtime traffic data of your product instance.",
    "version": "1.0.0-SNAPSHOT"
  },
  "tags": [
    {
      "name": "Traffic"
    }
  ],
  "paths": {
    "/realtime/traffic": {
      "get": {
        "tags": [
          "Traffic"
        ],
        "summary": "Realtime traffic data",
        "description": "get realtime traffic data of the product instance in protobuf format, gzipped.",
        "operationId": "getTrafficData",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ForecastDataMessageProto"
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "Not modified. There are no updated data.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient access rights. Traffic data API must be purchased.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Traffic data are not available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "ETag": {
        "description": "An Etag is an identifier for a specific version of data. You should retain the latest ETag value you receive. The next time you call the same API to get data, you should use the If-None-Match request header along with the retained ETag value, so that the API will send back a full response if and only if the data changes.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "ErrorResponse": {
        "required": [
          "description",
          "errorCode",
          "traceId"
        ],
        "type": "object",
        "properties": {
          "description": {
            "description": "A human readable message that describes the error.",
            "type": "string"
          },
          "errorCode": {
            "description": "A constant string that can be used to identify this error class programmatically.\n\nIf additional information is available for an errorCode, it will be provided as key-value pairs with the parameter **details**. The keys available for a specific errorCode are documented directly with the errorCode. Unless stated otherwise, the values are of type string.\n\nAs an example, the following errorCode provides one key-value pair in the **details**. The key is called **message**.\n* `GENERAL_UNAUTHENTICATED` - Invalid or missing authentication credentials.\n  * `message` - An additional error message.\n\nNote that additional errorCodes as well as the **details** of existing errorCodes may be added at any time. Furthermore, the **description** may change at any time. Furthermore, the **description** may change at any time.  \n\n**HTTP status code: 400**  \n* `GENERAL_VALIDATION_ERROR` - The validation of the request failed. Details can be found in **causes**.\n* `GENERAL_PARSING_ERROR` - The JSON syntax is invalid.\n* `ROUTING_ERROR` - The calculation failed. Details can be found in **causes**.\n\n**HTTP status code: 401**  \n* `GENERAL_UNAUTHENTICATED` - Invalid or missing authentication credentials.\n  * `message` - An additional error message.\n\n**HTTP status code: 403**  \n* `GENERAL_FORBIDDEN` - Insufficient access rights.\n* `GENERAL_QUOTA_EXCEEDED` - The transaction limit is exceeded.\n  * `message` - An additional error message.\n\n**HTTP status code: 404**  \n* `GENERAL_RESOURCE_NOT_FOUND` - A requested resource does not exist.\n  * `message` - An additional error message.\n\n**HTTP status code: 429**  \n* `GENERAL_RATE_LIMIT_EXCEEDED` - The rate limit is exceeded.\n\n**HTTP status code: 500**  \n* `GENERAL_INTERNAL_SERVER_ERROR` - The request could not be processed due to an internal error.\n  * `message` - An additional error message.\n  * `hint` - A hint how to solve the problem.\n\n**HTTP status code: 503**  \n* `GENERAL_SERVICE_UNAVAILABLE` - The service is temporarily unavailable.\n\n**HTTP status code: 4xx-5xx**  \n* `GENERAL_INTERNAL_GATEWAY_ERROR` - The request could not be processed due to an unexpected internal gateway error.\n  * `hint` - A hint how to solve the problem.",
            "type": "string"
          },
          "traceId": {
            "description": "A unique identifier of the corresponding trace forest. It can be used to trace errors by the support.",
            "type": "string"
          },
          "errorId": {
            "description": "A unique identifier specific to this error instance. It can be used to trace errors by the support.",
            "type": "string"
          },
          "causes": {
            "description": "A list of affected parameters and/or properties that caused this error.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CausingError"
            }
          },
          "details": {
            "description": "Additional properties specific to this error class.",
            "type": "object",
            "additionalProperties": true
          }
        },
        "example": {
          "traceId": "dc5b4c9a240458dd57128194dfbef0c8",
          "errorCode": "GENERAL_UNAUTHENTICATED",
          "description": "Invalid or missing authentication credentials.",
          "details": {
            "message": "Invalid API Key."
          }
        }
      },
      "CausingError": {
        "required": [
          "description",
          "errorCode"
        ],
        "type": "object",
        "properties": {
          "description": {
            "description": "A human readable message that describes the error.",
            "type": "string"
          },
          "errorCode": {
            "description": "A constant string that can be used to identify this error class programmatically.\n\nIf additional information is available for an errorCode, it will be provided as key-value pairs with the parameter **details**. The keys available for a specific errorCode are documented directly with the errorCode. Unless stated otherwise, the values are of type string.\n\nAs an example, the following errorCode provides one key-value pair in the **details**. The key is called **value**.\n* `GENERAL_INVALID_VALUE` - A parameter is set to an invalid value.\n  * `value` - The invalid value.\n\nNote that additional errorCodes as well as the **details** of existing errorCodes may be added at any time. Furthermore, the **description** may change at any time. Furthermore, the **description** may change at any time.  \n\n**Error codes for** `GENERAL_VALIDATION_ERROR`\n* `GENERAL_INVALID_VALUE` - A parameter is set to an invalid value.\n  * `value` - The invalid value.\n* `GENERAL_UNRECOGNIZED_PARAMETER` - A parameter is unknown.\n* `GENERAL_INVALID_INTERVAL` - A time interval is invalid, i.e. start is greater than end.\n* `GENERAL_MINIMUM_LENGTH_VIOLATED` - The minimum length of a string is violated.\n  * `minimumLength` - The minimum length (integer).\n* `GENERAL_MINIMUM_VALUE_VIOLATED` - The minimum value of a parameter is violated.\n  * `minimumValue` - The minimum value (integer or double).\n* `GENERAL_MAXIMUM_VALUE_VIOLATED` - The maximum value of a parameter is violated.\n  * `maximumValue` - The maximum value (integer or double).\n* `GENERAL_DUPLICATE_PARAMETER` - A parameter is duplicated.\n* `GENERAL_INVALID_LIST` - A list has an invalid format such as duplicate commas.\n  * `value` - The invalid list.\n* `ROUTING_INVALID_WAYPOINT_ATTRIBUTE` - A waypoint attribute is set to an invalid value.\n  * `attribute` - The invalid waypoint attribute.\n* `ROUTING_UNRECOGNIZED_WAYPOINT_ATTRIBUTE` - A waypoint attribute is unknown.\n  * `attribute` - The invalid waypoint key.\n* `ROUTING_DUPLICATE_WAYPOINT_ATTRIBUTE` - A waypoint attribute is duplicated.\n  * `attribute` - The duplicated waypoint key.\n* `ROUTING_WAYPOINT_ATTRIBUTE_CONFLICT` - Two waypoint attributes are in conflict with each other.\n  * `attribute` - The first conflicting attribute.\n  * `conflictingAttribute` - The second conflicting attribute.\n* `ROUTING_TOO_MANY_WAYPOINTS` - The request contains too many waypoints.\n  * `limit`- The maximum allowed number of waypoints for a single request.\n* `ROUTING_INVALID_MANIPULATION_WAYPOINT_ORDER` - The manipulation waypoint is not valid for start or destination.\n* `ROUTING_INVALID_WAYPOINT_LIST_FOR_ALTERNATIVE_ROUTES` - Alternative routes are supported only for two on-road or off-road waypoints.\n* `ROUTING_MUST_HAVE_WAYPOINTS_OR_ROUTE_ID` - The request must have either at least two waypoints or a routeId.\n* `ROUTING_EMISSIONS_MUTUALLY_EXCLUSIVE` - EMISSIONS_EN16258_2012 and EMISSIONS_EN16258_2012_HBEFA are mutually exclusive.\n* `ROUTING_MISSING_EMISSION_PARAMETER` - A parameter is missing for emission calculation.\n* `ROUTING_START_AND_ARRIVAL_TIME_MUTUALLY_EXCLUSIVE` - startTime and arrivalTime are mutually exclusive. - _The **parameter** remains empty._\n* `ROUTING_DISTANCE_TOO_LONG` - The distance of the waypoints for non-motorized vehicles is too long. - _The **parameter** remains empty._\n  * `limit` - The maximum allowable distance.\n* `ROUTING_PARAMETER_CONFLICT` - Two parameters are in conflict with each other.\n  * `conflictingParameter` - The conflicting parameter.\n  * `message` - The error message.\n* `ROUTING_NO_VALID_COUNTRY_ALLOWED` - The list of allowed countries does not contain any of the available countries so that the effective list of countries allowed for routing is empty.\n  * `allowedCountries` - The list of allowed countries.\n* `ROUTING_ALL_VALID_COUNTRIES_PROHIBITED` - The list of prohibited countries contains all available countries so that the effective list of countries allowed for routing is empty.\n  * `prohibitedCountries` - The list of prohibited countries.\n* `ROUTING_ALLOWED_AND_PROHIBITED_COUNTRIES_CONFLICT` - The lists of allowed and prohibited countries contain the same countries so that the effective list of countries allowed for routing is empty. - _The **parameter** remains empty._\n  * `allowedCountries` - The list of allowed countries.\n  * `prohibitedCountries` - The list of prohibited countries.\n* `ROUTING_MAXIMUM_HORIZON_VALUE_VIOLATED` - The maximum value of horizon is violated.\n  * `limit` - The maximum allowable horizon.\n* `ROUTING_MUST_HAVE_ONE_WAYPOINT_OR_ROUTE_ID` - The request must have either a waypoint or a routeId.\n* `ROUTING_HORIZONS_EQUAL_OR_NOT_ASCENDING` - The horizons have equal values or are not ascending.\n  * `value` - The invalid horizon.\n* `ROUTING_ROUTE_TOO_LONG` - The maximum route length is violated.\n  * `limit` - The maximum allowable route length.\n* `ROUTING_UTCOFFSET_CANNOT_DETERMINED` - The UTC offset of the start waypoint cannot be determined.\n\n**Error codes for** `ROUTING_ERROR`\n\n* `ROUTING_WAYPOINT_CANNOT_BE_MATCHED` - The waypoint cannot be matched to the nearest possible road.\n* `ROUTING_ROUTE_NOT_FOUND` - A route between at least two waypoints could not be found for the current configuration and profile. - _The **parameter** remains empty._\n* `ROUTING_ROUTE_ID_NOT_FOUND` - The routeId cannot be found.\n  * `hint` - A hint how to solve the problem.\n\ntype: string",
            "type": "string"
          },
          "parameter": {
            "description": "The name of the affected query or path parameter or a JSONPath to the affected property of the request.",
            "type": "string"
          },
          "details": {
            "description": "Additional properties specific to this error class.",
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ForecastDataMessageProto": {
        "description": "```\nsyntax = \"proto3\";\n\nimport \"google/protobuf/timestamp.proto\";\n\npackage com.ptvgroup.archimedes.dataprv.protobuf.traffic.realtime.output.v1;<br>\n\noption java_package = \"com.ptvgroup.archimedes.dataprv.protobuf.traffic.realtime.output.v1\";\noption java_outer_classname = \"DataprvTrafficRealtimeData\";\noption java_multiple_files = false;\n\noption csharp_namespace = \"PTVGroup.Flows.Protos.DataPrv.Traffic.Realtime.Output.V1\";\n\nmessage DataprvTrafficRealtimeDataProto {\n  string timezone = 1;\n  google.protobuf.Timestamp snapshot_date_time = 2;\n  repeated StreetTraffic street_traffic = 3;\n\n  message StreetTraffic {\n    reserved 4;\n\n    int32 id = 1;\n    int32 from_node_id = 2;\n    double speed_kmh = 3;\n    int32 probe_count = 5;  // reserved for internal purposes and not reliable.\n    string olr_code = 6;\n  }\n}\n",
        "type": "string"
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "apiKey"
      }
    }
  },
  "security": [
    {
      "apiKeyAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.ptvgroup.tech/flows/realtime-traffic/v1"
    }
  ]
}