SegmentKey specification
Stay organized with collections
Save and categorize content based on your preferences.
A SegmentKey
identifies a portion of the user's journey that happens on a
single vehicle.
Proto Definition
message SegmentKey {
// The following are identifiers from the GTFS ticketing spec that specify the
// ticketing option for a given segment.
// If using the stop-only integration, see
// https://developers.google.com/travel/transport/guides/partner-integration/stop-only-integration#ticketing_deep_links
// Only populated if using GTFS-based integration.
string ticketing_trip_id = 1;
string from_ticketing_stop_time_id = 2;
string to_ticketing_stop_time_id = 3;
// Date of the service day as defined at
// https://gtfs.org/schedule/reference/#term-definitions
// Note that boarding_time and service_date may have different day values.
.google.type.Date service_date = 4;
// Hour of day must be from 0-23 and leap seconds are not supported.
// The time_offset will be a utc_offset of 0:00, i.e. times are specified in
// UTC.
.google.type.DateTime boarding_time = 5;
// Hour of day must be from 0-23 and leap seconds are not supported.
// The time_offset will be a utc_offset of 0:00, i.e. times are specified in
// UTC.
.google.type.DateTime arrival_time = 6;
}
JSON Sample
{
"ticketing_trip_id": "123456",
"from_ticketing_stop_time_id": "ZRH-1234",
"to_ticketing_stop_time_id": "LUZ-1235",
"service_date": {
"year": 2022,
"month": 4,
"day": 6
},
"boarding_time": {
"year": 2022,
"month": 4,
"day": 6,
"hours": 14,
"minutes": 25,
"seconds": 0,
"nanos": 0,
"utc_offset": "0s"
},
"arrival_time": {
"year": 2022,
"month": 4,
"day": 6,
"hours": 16,
"minutes": 25,
"seconds": 0,
"nanos": 0,
"utc_offset": "0s"
}
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-22 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-22 UTC."],[[["\u003cp\u003eA SegmentKey pinpoints a part of a user's journey that occurs on a single vehicle.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSegmentKey\u003c/code\u003e definition includes identifiers like \u003ccode\u003eticketing_trip_id\u003c/code\u003e, \u003ccode\u003efrom_ticketing_stop_time_id\u003c/code\u003e, and \u003ccode\u003eto_ticketing_stop_time_id\u003c/code\u003e from the GTFS ticketing specification.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eservice_date\u003c/code\u003e, \u003ccode\u003eboarding_time\u003c/code\u003e, and \u003ccode\u003earrival_time\u003c/code\u003e are utilized within \u003ccode\u003eSegmentKey\u003c/code\u003e to represent the date and time elements of a segment, all in UTC time.\u003c/p\u003e\n"],["\u003cp\u003eThe JSON sample displays the structure and examples of how the data is formatted, including \u003ccode\u003eticketing_trip_id\u003c/code\u003e, \u003ccode\u003eservice_date\u003c/code\u003e, and the time components of boarding and arrival.\u003c/p\u003e\n"]]],[],null,["# SegmentKey specification\n\nA `SegmentKey` identifies a portion of the user's journey that happens on a\nsingle vehicle. \n\n### Proto Definition\n\n```protobuf\nmessage SegmentKey {\n // The following are identifiers from the GTFS ticketing spec that specify the\n // ticketing option for a given segment.\n // If using the stop-only integration, see\n // https://developers.google.com/travel/transport/guides/partner-integration/stop-only-integration#ticketing_deep_links\n\n // Only populated if using GTFS-based integration.\n string ticketing_trip_id = 1;\n string from_ticketing_stop_time_id = 2;\n string to_ticketing_stop_time_id = 3;\n\n // Date of the service day as defined at\n // https://gtfs.org/schedule/reference/#term-definitions\n // Note that boarding_time and service_date may have different day values.\n .google.type.Date service_date = 4;\n\n // Hour of day must be from 0-23 and leap seconds are not supported.\n // The time_offset will be a utc_offset of 0:00, i.e. times are specified in\n // UTC.\n .google.type.DateTime boarding_time = 5;\n\n // Hour of day must be from 0-23 and leap seconds are not supported.\n // The time_offset will be a utc_offset of 0:00, i.e. times are specified in\n // UTC.\n .google.type.DateTime arrival_time = 6;\n\n}\n```\n\n### JSON Sample\n\n```json\n{\n \"ticketing_trip_id\": \"123456\",\n \"from_ticketing_stop_time_id\": \"ZRH-1234\",\n \"to_ticketing_stop_time_id\": \"LUZ-1235\",\n \"service_date\": {\n \"year\": 2022,\n \"month\": 4,\n \"day\": 6\n },\n \"boarding_time\": {\n \"year\": 2022,\n \"month\": 4,\n \"day\": 6,\n \"hours\": 14,\n \"minutes\": 25,\n \"seconds\": 0,\n \"nanos\": 0,\n \"utc_offset\": \"0s\"\n },\n \"arrival_time\": {\n \"year\": 2022,\n \"month\": 4,\n \"day\": 6,\n \"hours\": 16,\n \"minutes\": 25,\n \"seconds\": 0,\n \"nanos\": 0,\n \"utc_offset\": \"0s\"\n }\n}\n```"]]