openapi: 3.2.0 info: title: Open Mobility Foundation Events API version: '2.0' contact: url: https://github.com/openmobilityfoundation/mobility-data-specification name: Open Mobility Foundation email: info@openmobilityfoundation.org license: name: Creative Commons Attribution 4.0 International Public License url: https://github.com/openmobilityfoundation/mobility-data-specification/blob/main/LICENSE description: 'Operations tagged Events across 2 of this provider''s published API definitions: open-mobility-foundation-mds-agency-openapi.yml, open-mobility-foundation-mds-provider-openapi.yml. Each path carries the servers of the definition it was published in.' tags: - name: Events paths: /events: post: operationId: post-events description: Send vehicle state change events for multiple vehicles. summary: /events requestBody: required: true content: application/json: schema: type: array minItems: 1 items: $ref: '#/components/schemas/event' responses: '201': description: Events processed. content: application/json: schema: $ref: '#/components/schemas/response_bulk' '400': description: Bad request. content: application/json: schema: allOf: - $ref: '#/components/schemas/response_bulk' - required: - failures properties: failures: minItems: 1 items: properties: item: $ref: '#/components/schemas/event' oneOf: - $ref: '#/components/schemas/response_error_bad_param' - $ref: '#/components/schemas/response_error_missing_param' '404': description: The `device_id` is unregistered. content: application/json: schema: allOf: - $ref: '#/components/schemas/response_bulk' - required: - failures properties: failures: minItems: 1 items: allOf: - $ref: '#/components/schemas/response_error_unregistered' - properties: item: $ref: '#/components/schemas/event' '401': description: 'Unauthorized: Invalid, expired, or insufficient scope of token.' '406': description: MDS version in Accept header is unsupported or invalid. '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/response_error' tags: - Events /events/historical: parameters: - name: event_time schema: $ref: '#/components/schemas/data-types_iso-dayhour' in: query required: true description: The UTC hour during which events occurred. get: operationId: get-events-historical-event_time description: Get all status changes with an event time occurring within the hour. summary: /events/historical responses: '200': description: Hour has been processed. content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/response_version' - type: object description: Events data payload required: - events properties: events: type: array items: $ref: '#/components/schemas/event' '202': description: Data is not yet available for this hour. '400': description: Request did not contain an `event_time`. '401': description: 'Unauthorized: Invalid, expired, or insufficient scope of token.' '404': description: Hour is not in the past, or no operations during this hour. '406': description: MDS version in Accept header is unsupported or invalid. '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/response_error' tags: - Events /events/recent: parameters: - name: start_time schema: $ref: '#/components/schemas/data-types_timestamp' in: query required: true description: status changes where start_time <= event.timestamp - name: end_time schema: $ref: '#/components/schemas/data-types_timestamp' in: query required: true description: status changes where event.timestamp < end_time get: operationId: get-events-recent-start_time-end_time description: Get all status changes at most two weeks old. summary: /events/recent responses: '200': description: Range was valid and within the prior two weeks. content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/response_version' - $ref: '#/components/schemas/response_paging' - type: object description: Events data payload required: - events properties: events: type: array items: $ref: '#/components/schemas/event' '400': description: Request did not contain a `start_time`, `end_time`, or the range was more than 2 weeks in the past. '401': description: 'Unauthorized: Invalid, expired, or insufficient scope of token.' '406': description: MDS version in Accept header is unsupported or invalid. '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/response_error' tags: - Events components: schemas: modes_delivery-robots_event: title: modes/delivery-robots/event description: Event definition for the `delivery-robots` mode. type: object x-stoplight: id: sksecq6lesbxa oneOf: - title: vehicle_state - removed properties: vehicle_state: const: removed event_types: items: enum: - comms_restored - decommissioned - located - maintenance_pick_up - title: vehicle_state - available properties: vehicle_state: const: available event_types: items: enum: - comms_restored - customer_cancellation - driver_cancellation - located - provider_cancellation - service_start - trip_end - trip_enter_jurisdiction - title: vehicle_state - non_operational properties: vehicle_state: const: non_operational event_types: items: enum: - comms_restored - located - maintenance - maintenance_end - recommissioned - service_end - trip_enter_jurisdiction - title: vehicle_state - reserved properties: vehicle_state: const: reserved event_types: items: enum: - comms_restored - located - reservation_start - trip_enter_jurisdiction - title: vehicle_state - on_trip properties: vehicle_state: const: on_trip event_types: items: enum: - comms_restored - located - trip_enter_jurisdiction - trip_resume - trip_start - title: vehicle_state - stopped properties: vehicle_state: const: stopped event_types: items: enum: - comms_restored - located - order_drop_off - order_pick_up - reservation_stop - trip_pause - title: vehicle_state - non_contactable properties: vehicle_state: const: non_contactable event_types: items: enum: - comms_lost - title: vehicle_state - missing properties: vehicle_state: const: missing event_types: items: enum: - not_located - title: vehicle_state - elsewhere properties: vehicle_state: const: elsewhere event_types: items: enum: - comms_restored - located - trip_leave_jurisdiction if: properties: event_types: contains: - customer_cancellation - driver_cancellation - provider_cancellation - reservation_start - reservation_stop - trip_end - trip_enter_jurisdiction - trip_leave_jurisdiction - trip_pause - trip_resume - trip_start then: properties: trip_ids: minItems: 1 data-types_string: title: data-types/string description: A length-limited string type. examples: - ABC123 maxLength: 255 pattern: ^(.*)$ type: string x-stoplight: id: 2vqv7166161kh data-types_event-type: title: data-types/event-type description: Events are possible transitions between vehicle states. enum: - agency_drop_off - agency_pick_up - battery_charged - battery_low - changed_geographies - charging_end - charging_start - comms_lost - comms_restored - compliance_pick_up - customer_cancellation - decommissioned - driver_cancellation - fueling_end - fueling_start - located - maintenance - maintenance_end - maintenance_pick_up - not_located - off_hours - on_hours - order_drop_off - order_pick_up - passenger_cancellation - provider_cancellation - provider_drop_off - rebalance_pick_up - recommission - remote_end - remote_start - reservation_cancel - reservation_start - reservation_stop - service_end - service_start - system_resume - system_suspend - trip_cancel - trip_end - trip_enter_jurisdiction - trip_leave_jurisdiction - trip_pause - trip_resume - trip_start - trip_stop - unspecified type: string x-stoplight: id: lsm5td7gknbxz modes_passenger-services_event: title: modes/passenger-services/event description: Event definition for the `passenger-services` mode. type: object x-stoplight: id: diqnymt2vyq3m oneOf: - title: vehicle_state - removed properties: vehicle_state: const: removed event_types: items: enum: - comms_restored - decommissioned - maintenance_pick_up - title: vehicle_state - available properties: vehicle_state: const: available event_types: items: enum: - comms_restored - driver_cancellation - passenger_cancellation - provider_cancellation - service_start - trip_end - trip_enter_jurisdiction - title: vehicle_state - non_operational properties: vehicle_state: const: non_operational event_types: items: enum: - comms_restored - maintenance - maintenance_end - recommissioned - service_end - trip_enter_jurisdiction - title: vehicle_state - reserved properties: vehicle_state: const: reserved event_types: items: enum: - comms_restored - reservation_start - trip_enter_jurisdiction - title: vehicle_state - on_trip properties: vehicle_state: const: on_trip event_types: items: enum: - comms_restored - trip_enter_jurisdiction - trip_resume - trip_start - title: vehicle_state - non_contactable properties: vehicle_state: const: non_contactable event_types: items: enum: - comms_lost - title: vehicle_state - stopped properties: vehicle_state: const: stopped event_types: items: enum: - comms_restored - reservation_stop - trip_stop - title: vehicle_state - elsewhere properties: vehicle_state: const: elsewhere event_types: items: enum: - comms_restored - trip_leave_jurisdiction if: properties: event_types: contains: - driver_cancellation - passenger_cancellation - provider_cancellation - reservation_start - reservation_stop - trip_end - trip_enter_jurisdiction - trip_leave_jurisdiction - trip_resume - trip_start - trip_stop then: properties: trip_ids: minItems: 1 event: title: models/event description: Events represent changes in [Vehicle Status](./vehicle-status.yaml). type: object x-stoplight: id: 34niv0zuhmwmg required: - device_id - provider_id - event_id - vehicle_state - event_types - timestamp allOf: - properties: device_id: $ref: '#/components/schemas/data-types_uuid' description: A unique device ID in UUID format. provider_id: $ref: '#/components/schemas/data-types_uuid' description: A UUID for the Provider, unique within MDS. See MDS [provider list](https://github.com/openmobilityfoundation/mobility-data-specification/blob/main/providers.csv). data_provider_id: $ref: '#/components/schemas/data-types_uuid' description: If different than `provider_id`, a UUID for the data solution provider managing the data feed in this endpoint. event_id: $ref: '#/components/schemas/data-types_uuid' description: A unique event ID in UUID format. vehicle_state: $ref: '#/components/schemas/data-types_vehicle-state' description: The state of the vehicle as of this event. event_types: $ref: '#/components/schemas/data-types_event-type-array' description: Vehicle event types for state change. timestamp: $ref: '#/components/schemas/data-types_timestamp' description: Date/time that event occurred. publication_time: $ref: '#/components/schemas/data-types_timestamp' description: Date/time event became available through the status changes endpoint. location: $ref: '#/components/schemas/data-types_gps' description: Location of the event. event_geographies: $ref: '#/components/schemas/data-types_uuid-array' description: Array of Geography UUIDs consisting of every Geography that contains the location of the status change. See Geography Driven Events. Required if location is not present. battery_percent: $ref: '#/components/schemas/data-types_integer-positive' description: Percent battery charge of vehicle, expressed between 0 and 100. maximum: 100 fuel_percent: $ref: '#/components/schemas/data-types_integer-positive' description: Percent fuel in vehicle, expressed between 0 and 100. maximum: 100 trip_ids: $ref: '#/components/schemas/data-types_uuid-array' description: Trip UUIDs (foreign key to /trips endpoint), conditionally required for different modes. associated_ticket: $ref: '#/components/schemas/data-types_string' description: Identifier for an associated ticket inside an Agency-maintained 311 or CRM system. - oneOf: - title: modes/car-share $ref: '#/components/schemas/modes_car-share_event' - title: modes/delivery-robots $ref: '#/components/schemas/modes_delivery-robots_event' - title: modes/micromobility $ref: '#/components/schemas/modes_micromobility_event' - title: modes/passenger-services $ref: '#/components/schemas/modes_passenger-services_event' - anyOf: - title: Location-based event required: - location - title: Geography-driven event required: - event_geographies properties: event_geographies: minItems: 1 data-types_uuid: title: data-types/uuid description: A UUID used to uniquely identity an object. type: string x-stoplight: id: np9kodwmy2kqa format: uuid pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ examples: - 3c9604d6-b5ee-11e8-96f8-529269fb1459 data-types_event-type-array: title: data-types/event-type-array description: Array of events indicating a change to a vehicle's state. items: $ref: '#/components/schemas/data-types_event-type' minItems: 1 type: array uniqueItems: true x-stoplight: id: 1dq8fejw6intb modes_car-share_event: title: modes/car-share/event description: Event definition for the `car-share` mode. type: object x-stoplight: id: 0jy8uoz32ksy8 oneOf: - title: vehicle_state - removed properties: vehicle_state: const: removed event_types: items: enum: - comms_restored - decommissioned - maintenance - maintenance_pick_up - title: vehicle_state - available properties: vehicle_state: const: available event_types: items: enum: - comms_restored - driver_cancellation - customer_cancellation - provider_cancellation - service_start - trip_end - trip_enter_jurisdiction - title: vehicle_state - non_operational properties: vehicle_state: const: non_operational event_types: items: enum: - comms_restored - maintenance_end - recommissioned - service_end - trip_enter_jurisdiction - title: vehicle_state - reserved properties: vehicle_state: const: reserved event_types: items: enum: - comms_restored - reservation_start - trip_enter_jurisdiction - title: vehicle_state - on_trip properties: vehicle_state: const: on_trip event_types: items: enum: - comms_restored - trip_enter_jurisdiction - trip_resume - trip_start - title: vehicle_state - non_contactable properties: vehicle_state: const: non_contactable event_types: items: enum: - comms_lost - title: vehicle_state - stopped properties: vehicle_state: const: stopped event_types: items: enum: - charging_end - charging_start - comms_restored - fueling_end - fueling_start - remote_end - remote_start - reservation_stop - trip_stop - title: vehicle_state - elsewhere properties: vehicle_state: const: elsewhere event_types: items: enum: - comms_restored - trip_leave_jurisdiction if: properties: event_types: contains: - customer_cancellation - driver_cancellation - provider_cancellation - reservation_start - reservation_stop - trip_end - trip_enter_jurisdiction - trip_leave_jurisdiction - trip_resume - trip_start - trip_stop then: properties: trip_ids: minItems: 1 modes_micromobility_event: title: modes/micromobility/event description: Event definition for the `micromobility` mode. type: object x-stoplight: id: ii72nhqky41mp oneOf: - title: vehicle_state - removed properties: vehicle_state: const: removed event_types: items: enum: - agency_pick_up - comms_restored - compliance_pick_up - decommissioned - located - maintenance_pick_up - rebalance_pick_up - unspecified - title: vehicle_state - available properties: vehicle_state: const: available event_types: items: enum: - agency_drop_off - battery_charged - comms_restored - located - maintenance - on_hours - provider_drop_off - reservation_cancel - system_resume - trip_cancel - trip_end - unspecified - title: vehicle_state - non_operational properties: vehicle_state: const: non_operational event_types: items: enum: - battery_low - comms_restored - located - maintenance - off_hours - system_suspend - unspecified - title: vehicle_state - reserved properties: vehicle_state: const: reserved event_types: items: enum: - comms_restored - located - reservation_start - unspecified - title: vehicle_state - on_trip properties: vehicle_state: const: on_trip event_types: items: enum: - changed_geographies - comms_restored - located - trip_enter_jurisdiction - trip_start - unspecified - title: vehicle_state - non_contactable properties: vehicle_state: const: non_contactable event_types: items: enum: - comms_lost - unspecified - title: vehicle_state - missing properties: vehicle_state: const: missing event_types: items: enum: - not_located - unspecified - title: vehicle_state - elsewhere properties: vehicle_state: const: elsewhere event_types: items: enum: - comms_restored - located - trip_leave_jurisdiction - unspecified if: properties: event_types: contains: - trip_cancel - trip_end - trip_enter_jurisdiction - trip_leave_jurisdiction - trip_start then: properties: trip_ids: minItems: 1 response_error: title: response/error description: An error message for troubleshooting. type: object x-stoplight: id: 90yc58ni8u0ch required: - error - error_description - error_details properties: error: type: string description: Error message string. error_description: type: string description: Human readable error description (can be localized). error_details: type: array description: Human readable error description (can be localized). minItems: 1 items: type: string data-types_gps: title: data-types/gps properties: altitude: description: Altitude above mean sea level in meters. type: number heading: description: Degrees - clockwise starting at 0 degrees at true North. type: number horizontal_accuracy: description: Horizontal accuracy in meters. type: number lat: description: Latitude coordinate. maximum: 90 minimum: -90 type: number lng: description: Longitude coordinate. maximum: 180 minimum: -180 type: number satellites: $ref: '#/components/schemas/data-types_integer-positive' description: Number of GPS or GNSS satellites. speed: description: Estimated speed in meters / sec as reported by the GPS chipset. type: number vertical_accuracy: description: Vertical accuracy in meters. type: number required: - lat - lng type: object x-stoplight: id: 8aooo5ag7x7vh response_error_unregistered: title: response/error_unregistered description: An item with that identifier is not registered. type: object x-stoplight: id: cw4q7ycy1a17h required: - item - error - error_description properties: error: const: unregistered error_description: type: string examples: - This device_id is not registered. - This stop_id is unregistered error_details: type: array items: type: string data-types_uuid-array: title: data-types/uuid-array description: Array of UUID. type: array x-stoplight: id: v932clitbqv31 uniqueItems: true items: $ref: '#/components/schemas/data-types_uuid' data-types_integer-positive: title: data-types/integer-positive description: An integer greater than or equal to 0. minimum: 0 type: integer x-stoplight: id: nfkphjmpm8yay response_error_bad_param: title: response/error_bad_param description: A validation error occurred. type: object x-stoplight: id: vekidez6dfa4u required: - item - error - error_description - error_details properties: error: const: bad_param error_description: type: string examples: - A validation error occurred error_details: type: array description: Array of parameters with errors. minItems: 1 items: type: string response_bulk: title: response/bulk type: object description: For multi-record POST and PUT calls, e.g. sending Events using the Agency API, the bulk-response structure describes a list of results. x-stoplight: id: sdj75536ytrso required: - success - total properties: success: $ref: '#/components/schemas/data-types_integer-positive' description: Number of successfully written records. total: $ref: '#/components/schemas/data-types_integer-positive' description: Total number of provided records. failures: type: array data-types_vehicle-state: title: data-types/vehicle-state description: The state of a vehicle. type: string x-stoplight: id: 3j1h7u4vvc7kr enum: - removed - available - non_operational - reserved - on_trip - stopped - non_contactable - missing - elsewhere response_error_missing_param: title: response/error_missing_param description: A required parameter is missing. type: object x-stoplight: id: huc7x2g2wfq5a required: - item - error - error_description - error_details properties: error: const: missing_param error_description: type: string examples: - A required parameter is missing. error_details: type: array description: Array of missing parameters. minItems: 1 items: type: string data-types_timestamp: title: data-types/timestamp description: Integer milliseconds since Unix epoch. examples: - 1514764800000 - 1681855703000 minimum: 1514764800000 multipleOf: 1 type: number x-stoplight: id: vliol1hqlxw6y data-types_iso-dayhour: title: data-types/iso-dayhour description: An ISO 8601 extended datetime representing an UTC hour between 00 and 23 `YYYY-MM-DDTHH`; valid for dates in 1970 and later. examples: - 2023-12-31T23 - 2024-01-01T01 pattern: (19[789]\d|[2-9]\d{3})-(0[1-9]|1[02])-([12]\d|0[1-9]|3[01])T([0-2][0-3]|[01]\d) type: string x-stoplight: id: rc4v7nsrgdqpm response_version: title: response/version description: Response bodies must be a UTF-8 encoded JSON object and must minimally include the MDS `version`. type: object x-stoplight: id: ivd8jadc3rqf7 required: - version properties: version: $ref: '#/components/schemas/data-types_version' response_paging: title: response/paging type: object x-stoplight: id: y6kgbr644ng4u properties: links: description: If pagination is used for endpoints that support it, the pagination must comply with the [JSON API](http://jsonapi.org/format/#fetching-pagination) specification. type: object required: - next additionalProperties: false properties: first: type: - 'null' - string title: The URL to the first page of data. examples: - https://data.provider.co/trips/first format: uri last: type: - 'null' - string title: The URL to the last page of data. examples: - https://data.provider.co/trips/last format: uri prev: type: - 'null' - string title: The URL to the previous page of data. examples: - https://data.provider.co/trips/prev format: uri next: type: - 'null' - string title: The URL to the next page of data. examples: - https://data.provider.co/trips/next format: uri data-types_version: title: data-type/version description: The version of MDS this data represents. type: string x-stoplight: id: bt49ntcbcuxbh pattern: ^2\.(\d|[1-9]\d+)\.(\d|[1-9]\d+)$ examples: - 2.0.0 securitySchemes: bearer: type: http scheme: bearer bearerFormat: JWT description: 'All MDS Agency endpoints require authentication. JSON Web Token ([JWT](https://jwt.io/introduction/)) is RECOMMENDED as the token format. When making requests, the endpoints expect `provider_id` to be part of the claims the JWT. The token issuance, expiration and revocation policies are at the discretion of the agency.' x-refined-from: - open-mobility-foundation-mds-agency-openapi.yml - open-mobility-foundation-mds-provider-openapi.yml x-stoplight: id: f3thjnkfyv60k x-bundled-from: https://github.com/openmobilityfoundation/mds-openapi/blob/v2.0/reference/agency.yaml (commit 0c07bc3d294237dd41c6273f059efb11b8149c66); external $refs into ../models/ inlined under components.schemas, no other changes