openapi: 3.2.0 info: title: Open Mobility Foundation Trips 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 Trips 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: Trips paths: /trips: post: operationId: post-trips description: Send an update about one or more trips to the agency. summary: /trips requestBody: required: true content: application/json: schema: type: array minItems: 1 items: $ref: '#/components/schemas/trip' responses: '201': description: Trip(s) 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/trip' 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/trip' '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: - Trips parameters: - name: end_time schema: $ref: '#/components/schemas/data-types_iso-dayhour' in: query required: true description: The UTC hour during which requested trips ended. get: operationId: get-trips-end_time description: Get all trips with an end time occurring within the hour. summary: /trips responses: '200': description: Hour has been processed. content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/response_version' - type: object required: - trips properties: trips: type: array items: $ref: '#/components/schemas/trip' '202': description: Data is not yet available for this hour. '400': description: Request did not contain an `end_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: - Trips components: schemas: modes_car-share_accessibility-attributes: title: modes/car-share/accessibility-attributes description: Accessibility options definition for the `car-share` mode. type: array x-stoplight: id: e9mpudr8layzh uniqueItems: true items: type: string enum: - wheelchair_accessible data-types_string: title: data-types/string description: A length-limited string type. examples: - ABC123 maxLength: 255 pattern: ^(.*)$ type: string x-stoplight: id: 2vqv7166161kh modes_delivery-robots_accessibility-attributes: title: modes/delivery-robots/accessibility-attributes description: Accessibility options definition for the `delivery-robots` mode. type: object x-stoplight: id: zsnl5o3q9d0a0 additionalProperties: false properties: audio_cue: type: boolean description: Is the device equipped with audio cues upon delivery. visual_cue: type: boolean description: Is the device equipped with visual cues upon delivery. remote_open: type: boolean description: Can the device door be remotely opened to retrieve cargo upon delivery. modes_car-share_trip: title: modes/care-share/trip description: Trip definition for the `car-share` mode. type: object x-stoplight: id: lhj9vmnhh6uk8 required: - trip_type properties: journey_id: $ref: '#/components/schemas/data-types_uuid' description: 'A unique journey ID for associating collections of trips. The journey_id field shall have a consistent value in overlapping trips for a single reservation period, e.g. trips taken by a customer between ignition states over the duration of their reservation. A reservation is the duration the customer has continuous exclusive access to the vehicle whether parked or in motion. Journeys may be point-to-point or multi-segment.' journey_attributes: type: object additionalProperties: false properties: reservation_id: $ref: '#/components/schemas/data-types_uuid' description: A unique identifier for an entire car share reservation, tied across multiple journeys and therefore trips. trip_type: enum: - private - reservation - empty trip_attributes: required: - reservation_type - passenger_count - requested_time - quoted_trip_start_time properties: reservation_type: enum: - phone_dispatch - phone - text - app app_name: $ref: '#/components/schemas/data-types_string' description: Name of the app used to reserve the trip which could be provider's app or 3rd party app. permit_license_number: $ref: '#/components/schemas/data-types_string' description: The permit license number of the organization that dispatched the vehicle. driver_id: $ref: '#/components/schemas/data-types_string' description: Universal identifier of a specific driver, static across operators, like a driver's license number, for company employees in `reservation` or `empty` trip types, not `private` trips. Could also be used as a lookup in an agency's internal driver system. fare_attributes: required: - payment_type - fare_type properties: payment_type: type: string enum: - account_number - cash - credit_card - mobile_app - no_payment - phone - voucher - test fare_type: description: Indicator of which rate was charged. type: string enum: - meter_fare - upfront_pricing - flat_rate tolls: $ref: '#/components/schemas/data-types_currency-cost' description: Sum of any and all tolls charged for the trip, such as bridge tolls. base_rate: $ref: '#/components/schemas/data-types_currency-cost' description: Minimum fare to be charged as soon as the trip starts. exit_fee: $ref: '#/components/schemas/data-types_currency-cost' description: Fee to exit location, like an airport. other_fees: $ref: '#/components/schemas/data-types_currency-cost' description: Amount of any fees charged to the customer. Includes baggage fees, cleaning fee. Excludes other fees returned. tip: $ref: '#/components/schemas/data-types_currency-cost' description: Amount of tip paid by customer. extra_amount: $ref: '#/components/schemas/data-types_currency-cost' description: Miscellaneous extra amounts charged to customer not covered by other fields. taxes: $ref: '#/components/schemas/data-types_currency-cost' description: Amount of taxes paid for the ride. surcharge: $ref: '#/components/schemas/data-types_currency-cost' description: Any surcharge pricing. accessibility_attributes: $ref: '#/components/schemas/modes_car-share_accessibility-attributes' description: The accessibility options utilized for a given trip. Required if available. 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_currency: title: data-types/currency default: USD description: An [ISO 4217 Alphabetic Currency Code](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) representing currency of the payee. If null, USD cents is implied. examples: - USD - EUR - GBP pattern: ^[A-Z]{3}$ type: - string - 'null' x-stoplight: id: 85j2txhx6x32o modes_micromobility_accessibility-attributes: title: modes/micromobility/accessibility-attributes description: Accessibility options definition for the `micromobility` mode. type: array x-stoplight: id: 15do56zc6v30i uniqueItems: true items: type: string enum: - adaptive 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 modes_micromobility_trip: title: modes/micromobility/trip description: Trip definition for the `micromobility` mode. type: object x-stoplight: id: mtd16mz6d70ve properties: trip_type: enum: - rider - rebalance - maintenance accessibility_attributes: $ref: '#/components/schemas/modes_micromobility_accessibility-attributes' description: The accessibility options utilized for a given trip. Required if available. 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 modes_passenger-services_accessibility-attributes: title: modes/passenger-services/accessibility-attributes description: Accessibility options definition for the `passenger-services` mode. type: array x-stoplight: id: 62ab40s0bfzrw uniqueItems: true items: type: string enum: - wheelchair_accessible trip: title: models/trip description: A trip represents a journey taken by a _mobility as a service_ customer with a geo-tagged start and stop point. type: object x-stoplight: id: 6s0dm1r2gk9x0 required: - provider_id - device_id - trip_id - start_time - end_time - start_location - end_location - duration - distance allOf: - properties: 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. device_id: $ref: '#/components/schemas/data-types_uuid' description: A unique device ID in UUID format. trip_id: $ref: '#/components/schemas/data-types_uuid' description: A unique ID for each trip trip_type: type: string trip_attributes: type: object fare_attributes: type: object start_time: $ref: '#/components/schemas/data-types_timestamp' description: Start of the passenger/driver trip. end_time: $ref: '#/components/schemas/data-types_timestamp' description: End of the passenger/driver trip. start_location: $ref: '#/components/schemas/data-types_gps' description: Location of the start of the trip. end_location: $ref: '#/components/schemas/data-types_gps' description: Location of the end of the trip. duration: $ref: '#/components/schemas/data-types_integer-positive' description: Trip duration, in seconds. examples: - 600 distance: $ref: '#/components/schemas/data-types_integer-positive' description: Trip distance, in meters. examples: - 1000 publication_time: $ref: '#/components/schemas/data-types_timestamp' description: Date/time that trip became available through the trips endpoint. accessibility_attributes: type: - array - object parking_verification_url: type: - string - 'null' format: uri description: A URL to a photo (or other evidence) of proper vehicle parking at the end of a trip, provided by customer or operator. examples: - https://data.provider.co/parking_verify/1234.jpg parking_category: type: string description: 'The type of parking location detected or provided and the end of a trip. Note that `other_valid` covers any other allowed parking location beyond what is enumerated, and `invalid` is any improper parking based on agency parking rules.' enum: - corral - curb - rack - other_valid - invalid standard_cost: $ref: '#/components/schemas/data-types_currency-cost' description: The cost, in the currency defined in `currency`, that it would cost to perform that trip in the standard operation of the System. examples: - 500 actual_cost: $ref: '#/components/schemas/data-types_currency-cost' description: The actual cost, in the currency defined in `currency`, paid by the customer of the _mobility as a service_ provider. examples: - 520 currency: $ref: '#/components/schemas/data-types_currency' - oneOf: - $ref: '#/components/schemas/modes_car-share_trip' - $ref: '#/components/schemas/modes_delivery-robots_trip' - $ref: '#/components/schemas/modes_micromobility_trip' - $ref: '#/components/schemas/modes_passenger-services_trip' modes_delivery-robots_trip: title: modes/delivery-robots/trip description: Trip definition for the `delivery-robots` mode. type: object x-stoplight: id: 0gzaszwxukf5a required: - trip_type properties: journey_id: $ref: '#/components/schemas/data-types_uuid' description: 'The `journey_id` field shall have a consistent value in overlapping trips. Journeys may be point-to-point, multi-segment, or multi-segment overlapping.' trip_type: enum: - delivery - return - advertising - mapping - roaming trip_attributes: required: - driver_type properties: driver_type: enum: - human - semi_autonomous - autonomous driver_id: $ref: '#/components/schemas/data-types_uuid' description: Consistent unique identifier of the primary driver. Could be based on software version or an internal human driver id. app_name: $ref: '#/components/schemas/data-types_string' description: Name of the app used to reserve the trip which could be provider's app or 3rd party app. requested_time: $ref: '#/components/schemas/data-types_timestamp' description: When the customer requested the trip. has_payload: type: boolean description: is there any payload for any delivery included in the device at trip start. fare_attributes: properties: payment_type: type: string enum: - account_number - cash - credit_card - mobile_app - no_payment - phone - test - voucher price: $ref: '#/components/schemas/data-types_currency-cost' accessibility_attributes: $ref: '#/components/schemas/modes_delivery-robots_accessibility-attributes' description: The accessibility options available on a given delivery robot device. Required if available. 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 modes_passenger-services_trip: title: modes/passenger-services/trip description: Trip definition for the `passenger-services` mode. type: object x-stoplight: id: 8nlne62fv8f5k required: - trip_type properties: journey_id: $ref: '#/components/schemas/data-types_uuid' description: 'A unique journey ID for associating collections of trips. The `journey_id` field shall have a consistent value in overlapping trips, e.g. "pooled" or "shared" rides with different start and/or end locations. Journeys may be point-to-point, multi-segment, or multi-segment overlapping.' journey_attributes: type: object additionalProperties: false properties: shift_id: $ref: '#/components/schemas/data-types_uuid' description: A unique identifier for an entire driver's work shift, tied across multiple journeys and therefore trips. trip_type: enum: - private - shared - reservation - empty trip_attributes: required: - hail_type - passenger_count - requested_time - quoted_trip_start_time properties: hail_type: enum: - street_hail - phone_dispatch - phone - text - app app_name: $ref: '#/components/schemas/data-types_string' description: Name of the app used to reserve the trip which could be provider's app or 3rd party app. passenger_count: $ref: '#/components/schemas/data-types_integer-positive' description: Unique count of passengers transported during trip duration. requested_time: $ref: '#/components/schemas/data-types_timestamp' description: When the customer requested the trip. requested_trip_start_location: $ref: '#/components/schemas/data-types_gps' description: Location where the customer requested the trip to start (required if this is within jurisdictional boundaries). quoted_trip_start_time: $ref: '#/components/schemas/data-types_timestamp' description: Time the trip was estimated or scheduled to start, that was provided to the passenger. dispatch_time: $ref: '#/components/schemas/data-types_timestamp' description: Time the vehicle was dispatched to the customer (required if trip was dispatched). trip_wait_time: $ref: '#/components/schemas/data-types_integer-positive' description: (milliseconds) Part of the passenger trip where the vehicle was moving slow or stopped (e.g. <12mph), which is a different fare rate in some jurisdictions. trip_fare_time: $ref: '#/components/schemas/data-types_integer-positive' description: (milliseconds) part of the passenger trip where the vehicle was moving more quickly (e.g. >12mph), which is a different fare rate in some jurisdictions. pickup_address: $ref: '#/components/schemas/data-types_string' description: Street address where the trip originated from. dropoff_address: $ref: '#/components/schemas/data-types_string' description: Street address where the trip ended. permit_license_number: $ref: '#/components/schemas/data-types_string' description: The permit license number of the organization that dispatched the vehicle. driver_id: $ref: '#/components/schemas/data-types_string' description: Universal identifier of a specific driver, static across operators, like a driver's license number. Could also be used as a lookup in an agency's internal driver system. wheelchair_transported: type: boolean description: is there any payload for any delivery included in the device at trip start. cancellation_reason: $ref: '#/components/schemas/data-types_string' description: The reason why a _driver_ cancelled a reservation. (required if a driver cancelled a trip, and a `driver_cancellation` event_type was part of the trip) fare_attributes: required: - payment_type - fare_type properties: payment_type: type: string enum: - account_number - cash - credit_card - mobile_app - no_payment - paratransit - phone - test - voucher fare_type: description: Indicator of which rate was charged. type: string enum: - meter_fare - upfront_pricing - flat_rate meter_fare_amount: $ref: '#/components/schemas/data-types_currency-cost' description: If `upfront_pricing` is used as a `fare_type` include what the metered fare would have been if `meter_fare` would have been used. Allows cost comparison in evaluation of programs and pilots. tolls: $ref: '#/components/schemas/data-types_currency-cost' description: Sum of any and all tolls charged for the trip, such as bridge tolls. base_rate: $ref: '#/components/schemas/data-types_currency-cost' description: Minimum fare to be charged as soon as the trip starts. exit_fee: $ref: '#/components/schemas/data-types_currency-cost' description: Fee to exit location, like an airport. other_fees: $ref: '#/components/schemas/data-types_currency-cost' description: Amount of any fees charged to the customer. Includes baggage fees, cleaning fee. Excludes other fees returned. tip: $ref: '#/components/schemas/data-types_currency-cost' description: Amount of tip paid by customer. extra_amount: $ref: '#/components/schemas/data-types_currency-cost' description: Miscellaneous extra amounts charged to customer not covered by other fields. taxes: $ref: '#/components/schemas/data-types_currency-cost' description: Amount of taxes paid for the ride. surcharge: $ref: '#/components/schemas/data-types_currency-cost' description: Any surcharge pricing. commission: $ref: '#/components/schemas/data-types_currency-cost' description: Any extra commission for the ride. driver_trip_pay: $ref: '#/components/schemas/data-types_currency-cost' description: The payment the driver received for the trip. rate_code_id: type: string enum: - meter_fare - shared - out_of_town - disabled - upfront_pricing - promo_rate accessibility_attributes: $ref: '#/components/schemas/modes_passenger-services_accessibility-attributes' description: The accessibility options utilized for a given trip. Required if available. 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 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_currency-cost: title: data-types/currency-cost description: Represents an optional cost defined in a [`currency`](./currency.yaml). x-stoplight: id: 1l6vqu5tyd5at type: - integer - 'null' minimum: 0 examples: - 500 - 520 - 1000 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' 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