Schedules

Schedules

These events are emitted by the Inventory API (btrz-api-inventory) when schedules are created, updated, or deleted. Adding or removing a child schedule also emits schedule.updated.

Events

Action Event name Endpoint
Create a new schedule schedule.created POST /schedules
Update an existing schedule schedule.updated PUT /schedules/:scheduleId
Add a child schedule schedule.updated (schedule update)
Remove the child schedule schedule.updated (schedule update)
Delete an existing schedule schedule.deleted DELETE /schedules/:scheduleId

The data object for schedule.created and schedule.updated may include a vehicle property: when the schedule has a vehicle type (vehicleTypeId), it is the resolved vehicle type { "_id": "", "name": "" } (e.g. Bus, Shuttle, Van, Train, Ferry, Tram); otherwise null.

Where vehicle type is used: The schedule’s vehicle type is also exposed in the Manifest API (manifest payloads include vehicle), in manifest webhooks (manifests.created, manifests.updated, manifests.edited, etc.), and in trip search results (each segment has a vehicle object when the schedule or manifest has a vehicle type).

Payload example created

{
  "attemptId": "df4777a0-0687-4c13-9d87-598f38d920e2",
  "created": 1746783524,
  "data": {
    "serviceNumberId": null,
    "accountId": "6410ad00d02bf9068d7345e5",
    "id": "069a8903-8932-445f-9034-40346806bc30",
    "scheduleIdForRms": "",
    "createdBy": "65c2a697b4f88e05ba262661",
    "amenityGroupNames": [
      "INTERMEDIO"
    ],
    "timeZone": "America/Mexico_City",
    "travelRouteId": "65c2a697b4f88e05ba26266a",
    "travelRouteName": "Highway",
    "legs": [
      {
        "arrival": "09:12",
        "departure": "09:10",
        "distance": 1,
        "duration": 2,
        "from": "ESTACION MANUEL",
        "fromId": "641b57b43d50af0656495c1b",
        "hideWhenPrintingManifest": false,
        "legord": 0,
        "requiresCheckIn": false,
        "to": "Y DE EBANO",
        "toId": "641b57b43d50af0656495dc5"
      },
      {
        "arrival": "09:22",
        "departure": "09:12",
        "distance": 10,
        "duration": 10,
        "from": "Y DE EBANO",
        "fromId": "641b57b43d50af0656495dc5",
        "hideWhenPrintingManifest": true,
        "legord": 1,
        "requiresCheckIn": false,
        "to": "GASERA",
        "toId": "641b57b43d50af0656495e0e",
        "waitTime": 0
      },
      {
        "arrival": "09:23",
        "departure": "09:22",
        "distance": 1,
        "duration": 1,
        "from": "GASERA",
        "fromId": "641b57b43d50af0656495e0e",
        "hideWhenPrintingManifest": true,
        "legord": 2,
        "requiresCheckIn": false,
        "to": "EJ GONZALEZ",
        "toId": "641b57b43d50af0656495c79",
        "waitTime": 0
      },
      {
        "arrival": "09:25",
        "departure": "09:23",
        "distance": 1,
        "duration": 2,
        "from": "EJ GONZALEZ",
        "fromId": "641b57b43d50af0656495c79",
        "hideWhenPrintingManifest": true,
        "legord": 3,
        "requiresCheckIn": false,
        "to": "CBTIS DE GONZALEZ",
        "toId": "641b57b43d50af0656495dc2",
        "waitTime": 0
      },
      {
        "arrival": "09:30",
        "departure": "09:25",
        "distance": 3,
        "duration": 5,
        "from": "CBTIS DE GONZALEZ",
        "fromId": "641b57b43d50af0656495dc2",
        "hideWhenPrintingManifest": false,
        "legord": 4,
        "requiresCheckIn": false,
        "to": "VILLA GONZALEZ",
        "toId": "641b57b43d50af0656495c1a",
        "waitTime": 0
      }
    ],
    "duration": 20,
    "fromDate": "06/13/2024",
    "routeId": "65f4bc9226563b05bfc0d39f",
    "toId": "641b57b43d50af0656495c1a",
    "dow": {
      "friday": "Y",
      "holidaysIncluded": "N",
      "holidaysOnly": "N",
      "monday": "Y",
      "saturday": "Y",
      "sunday": "Y",
      "thursday": "Y",
      "tuesday": "Y",
      "wednesday": "Y"
    },
    "inventoryId": "",
    "isExtraRun": false,
    "amenityGroupIds": [
      "648178563fb715051f420dcb"
    ],
    "to": "VILLA GONZALEZ",
    "routeName": "ESTACION MANUEL - GONZALEZ (INT)",
    "operatingCompanyInfoOnPrintedTicket": "TUN930101L63",
    "operatingCompanyId": "641ba31a117fe50679c87b8d",
    "taxExempt": false,
    "updatedAt": {
      "offset": 0,
      "value": "2025-05-09T09:38:26.665Z"
    },
    "operatingCompanyName": "ACME UNICO S.A. DE C.V.",
    "updatedBy": "65c2a697b4f88e05ba262661",
    "serviceNumberName": null,
    "toDateYYYYMMDD": "2030-12-31",
    "taxExemptionLog": null,
    "fromDateYYYYMMDD": "2024-06-13",
    "scheduleGroupName": "",
    "from": "ESTACION MANUEL",
    "distance": 16,
    "toDate": "12/31/2030",
    "createdAt": {
      "offset": 0,
      "value": "2025-03-03T23:01:50.030Z"
    },
    "amenityGroupName": "INTERMEDIO",
    "brandName": "ACME ECO",
    "defaultManifestStatus": "published",
    "requiresCheckIn": false,
    "scheduleGroupId": "",
    "capacity": 14,
    "autoBouncing": null,
    "controlPoints": [],
    "amenityGroupId": "648178563fb715051f420dcb",
    "useTimeZoneOfFirstStation": false,
    "standingPassengerCapacity": 0,
    "vehicle": null,
    "displayName": "ESTACION MANUEL - GONZALEZ (INT) - COPY BZ",
    "passengerLimits": [],
    "time": "09:10",
    "externalId": "",
    "seatMapId": "65fe04d3bf6fae0521b595ff",
    "name": "069a8903-8932-445f-9034-40346806bc30",
    "brandId": "648176c33fb715051f420dc7",
    "fromId": "641b57b43d50af0656495c1b",
    "labels": [],
    "copyFromScheduleId": "8346a662-5583-4502-8c88-b6e2fef6ff22", // if created based on another schedule
    "copyFromManifestDate": "2026-02-05" // if created based on a manifest
  },
  "event": "schedule.updated",
  "id": "f66be186-1b4f-420b-ab50-149a1081efa3",
    "livemode": false
}

Field descriptions — payload (schedule events)

Field Type Description
attemptId string UUID of the attempt that triggered the event.
created number Unix timestamp when the event was created.
event string Event name (e.g. schedule.created, schedule.updated, schedule.deleted).
id string UUID of the webhook event.
livemode boolean Whether the event occurred in live mode.
data.id string Schedule id (UUID).
data.accountId string Account (provider) id.
data.routeId string Route id (24 hex).
data.routeName string Route display name.
data.name string Schedule name (often UUID).
data.displayName string Display name for the schedule.
data.time string Departure time (e.g. "09:10").
data.fromDate / data.toDate string Valid date range for the schedule.
data.fromDateYYYYMMDD / data.toDateYYYYMMDD string Date range in YYYY-MM-DD.
data.legs array Legs (from/to stations, arrival, departure, duration, distance).
data.dow object Days of week (monday–sunday, holidaysIncluded, holidaysOnly).
data.capacity number Passenger capacity.
data.vehicle object or null Resolved vehicle type { _id, name } when schedule has vehicleTypeId; otherwise null.
data.controlPoints array Control point definitions (stationId, expectedOffset).
data.createdAt object BzDate: creation date.
data.updatedAt object BzDate: last update date.
data.createdBy string User id that created the schedule (24 hex).
data.updatedBy string User id that last updated (24 hex).
data.copyFromScheduleId string Optional; present when schedule was created from another schedule.
data.copyFromManifestDate string Optional; present when schedule was created from a manifest.

Payload example updated

{
  "attemptId": "2a5841f0-c23f-4e8a-88f4-2fe7a60416d0",
  "created": 1734384934,
  "data": {
    "serviceNumberId": null,
    "accountId": "6410ad00d02bf9068d7345e5",
    "id": "069a8903-8932-445f-9034-40346806bc30",
    "scheduleIdForRms": "",
    "createdBy": "65c2a697b4f88e05ba262661",
    "amenityGroupNames": [
      "INTERMEDIO"
    ],
    "timeZone": "America/Mexico_City",
    "travelRouteId": "65c2a697b4f88e05ba26266a",
    "travelRouteName": "Highway",
    "legs": [
      {
        "arrival": "12:00",
        "collapsed": true,
        "departure": "11:00",
        "distance": 15,
        "duration": 15,
        "from": "As",
        "fromId": "52a378c1430c7d4e2200020c",
        "fromLetter": "A",
        "hideWhenPrintingManifest": false,
        "legord": 0,
        "requiresCheckIn": true,
        "to": "B (testB)",
        "toId": "52a378c8430c7d4e2200020e",
        "toLetter": "B"
      },
      {
        "arrival": "12:30",
        "collapsed": true,
        "departure": "12:00",
        "distance": 13,
        "duration": 12,
        "from": "B (testB)",
        "fromId": "52a378c8430c7d4e2200020e",
        "fromLetter": "B",
        "hideWhenPrintingManifest": false,
        "legord": 1,
        "requiresCheckIn": true,
        "to": "C",
        "toId": "52a378dc430c7d4e22000211",
        "toLetter": "C",
        "waitTime": 0
      },
      {
        "arrival": "13:00",
        "collapsed": true,
        "departure": "12:30",
        "distance": 30,
        "duration": 20,
        "from": "C",
        "fromId": "52a378dc430c7d4e22000211",
        "fromLetter": "C",
        "hideWhenPrintingManifest": false,
        "legord": 2,
        "requiresCheckIn": true,
        "to": "D",
        "toId": "52a3793d430c7d4e22000213",
        "toLetter": "D",
        "waitTime": 0
      }
    ],
    "duration": 120,
    "fromDate": "10/01/2015",
    "routeId": "52c9feb265371a6d0e0001a3",
    "toId": "52a3793d430c7d4e22000213",
    "dow": {
      "friday": "Y",
      "holiday": "N",
      "holidaysIncluded": "Y",
      "holidaysOnly": "N",
      "monday": "Y",
      "saturday": "Y",
      "sunday": "Y",
      "thursday": "Y",
      "tuesday": "Y",
      "wednesday": "Y"
    },
    "inventoryId": "",
    "isExtraRun": false,
    "amenityGroupIds": [
      "6050ff7e96f4cea484566622"
    ],
    "to": "D",
    "routeName": "FareEx",
    "operatingCompanyInfoOnPrintedTicket": "This information should\nbe printed in the ticket",
    "operatingCompanyId": "611bbe812fccef3a94f9b00b",
    "taxExempt": false,
    "updatedAt": {
      "offset": 0,
      "value": "2024-12-16T21:35:23.001Z"
    },
    "operatingCompanyName": "HOPITAL MAISONNEUVE ROSEMONT",
    "updatedBy": "62179884ebb34d07f9a14cdc",
    "serviceNumberName": null,
    "toDateYYYYMMDD": "2040-01-01",
    "taxExemptionLog": [
      {
        "createdAt": {
          "offset": 0,
          "value": "2024-10-21T17:00:46.926Z"
        },
        "type": "Removal",
        "useId": "55fc2f318791db6e1a0000b6"
      }
    ],
    "fromDateYYYYMMDD": "2015-10-01",
    "scheduleGroupName": "",
    "from": "As",
    "distance": 58,
    "toDate": "01/01/2040",
    "brandName": "Another brand",
    "defaultManifestStatus": "published",
    "requiresCheckIn": true,
    "scheduleGroupId": "",
    "capacity": 500,
    "controlPoints": [
      {
        "expectedOffset": 0,
        "stationId": "52a378c1430c7d4e2200020c"
      },
      {
        "expectedOffset": 0,
        "stationId": "66686eba68b1920502c4a9b9"
      }
    ],
    "amenityGroupId": "6050ff7e96f4cea484566622",
    "amenityGroupName": "INTERMEDIO",
    "standingPassengerCapacity": 0,
    "vehicle": { "_id": "000000000000000000000001", "name": "Bus" },
    "displayName": "11:00",
    "passengerLimits": [],
    "time": "11:00",
    "externalId": "12345",
    "seatMapId": "",
    "name": "41ff89bb-95f5-4680-986a-a386ad22d431",
    "brandId": "62d9913cbab856fbb57716e0",
    "fromId": "52a378c1430c7d4e2200020c",
    "labels": [],
    "copyFromScheduleId": "8346a662-5583-4502-8c88-b6e2fef6ff22", // if created based on another schedule
    "copyFromManifestDate": "2026-02-05" // if created based on a manifest
  },
  "event": "schedule.updated",
  "id": "1277c936-83d4-4d9e-ab9f-99b70601dea4",
  "livemode": true
}

Deleted payload example

{
    "attemptId": "3f962294-3382-4e4f-a078-15b83714033e",
    "created": 1725459554,
    "data": {
      "id": "d125b58d-2b6d-4dd2-af3b-f9913ac493ac",
      "controlPoints": [
        {
          "expectedOffset": 0,
          "stationId": "52a378c1430c7d4e2200020c"
        },
        {
          "expectedOffset": 0,
          "stationId": "66686eba68b1920502c4a9b9"
        }
      ]
    },
    "event": "schedule.deleted",
    "id": "002c5f7f-04c5-4a80-8688-78c1f9d4d979",
    "livemode": false
}