Schedule exceptions

These events are emitted by the Inventory API (btrz-api-inventory) for schedule exceptions.

Events

Action Event name
creating a schedule exception schedule.exception.created
updating a schedule exception schedule.exception.updated
deleting a schedule exception schedule.exception.deleted
bulk processing finished after POST /schedules/schedule-exceptions/bulk on the Inventory API (async) schedule.exception.bulkProcessed

Payload example schedule exception created

{
  "attemptId": "fb1b760a-9f67-4950-acde-2775fc04af49",
  "created": 1761072539,
  "data": {
    "routeId": "661725b87a0f0505c507a654",
    "scheduleExceptions": [
      {
        "externalId": "schedule-exception-id", // if provided
        "_id": "68f7d59a51b418077f42b2cd",
        "createdAt": {
          "offset": 0,
          "value": "2025-10-21T18:48:58.769Z"
        },
        "createdBy": "68277de6b1cf7e05336f0045",
        "brandId": "68277de6b1cf7e05336f0045", //if provided
        "brandName": "ACME", //if brandId was provided
        "amenityGroupId": "68277de6b1cf7e05336f0045", //if provided
        "amenityGroupName": "First class", //If amenity group id was provided,
        "time": "08:00", //if provided
        "dow": {
          "friday": "Y",
          "holiday": "Y",
          "holidaysIncluded": "Y",
          "holidaysOnly": "N",
          "monday": "Y",
          "saturday": "Y",
          "sunday": "Y",
          "thursday": "Y",
          "tuesday": "Y",
          "wednesday": "Y"
        },
        "fromDate": "10/27/2025",
        "fromDateYYYYMMDD": "2025-10-27",
        "legs": [
          {
            "arrival": "00:30",
            "departure": "19:30",
            "distance": 0,
            "duration": 0,
            "from": "ACAPULCO COSTERA",
            "fromId": "661017a80294430529380813",
            "hideWhenPrintingManifest": false,
            "legord": 0,
            "to": "MEXICO TAXQUENA EDO",
            "toId": "661026f9029443052938083f",
            "travelRouteId": "5a721438608b5db92bed2684",
            "travelRouteName": "Route 66"
          }
        ],
        "toDate": "10/27/2025",
        "toDateYYYYMMDD": "2025-10-27",
        "updatedAt": {
          "offset": 0,
          "value": "2025-10-21T18:48:58.769Z"
        },
        "updatedBy": "68277de6b1cf7e05336f0045"
      }
    ],
    "scheduleId": "883e0b69-bc52-4f8e-b242-ddeb30842853"
  },
  "event": "schedule.exception.created",
  "id": "16f096fa-0dd7-42b1-b7b8-7c8cffa2155d",
  "livemode": false
}

Payload example schedule exception updated

{
  "attemptId": "ec156231-92b6-4d8d-afa2-94c89380c065",
  "created": 1761072652,
  "data": {
    "routeId": "661725b87a0f0505c507a654",
    "scheduleExceptions": [
      {
        "externalId": "schedule-exception-id", // if provided
        "_id": "68f7d59a51b418077f42b2cd",
        "createdAt": {
          "offset": 0,
          "value": "2025-10-21T18:48:58.769Z"
        },
        "createdBy": "68277de6b1cf7e05336f0045",
        "brandId": "68277de6b1cf7e05336f0045", //if provided
        "brandName": "ACME", //if brandId was provided
        "amenityGroupId": "68277de6b1cf7e05336f0045", //if provided
        "amenityGroupName": "First class", //If amenity group id was provided,
        "time": "08:00", //if provided
        "dow": {
          "friday": "Y",
          "holiday": "Y",
          "holidaysIncluded": "Y",
          "holidaysOnly": "N",
          "monday": "Y",
          "saturday": "Y",
          "sunday": "Y",
          "thursday": "Y",
          "tuesday": "Y",
          "wednesday": "Y"
        },
        "fromDate": "10/28/2025",
        "fromDateYYYYMMDD": "2025-10-28",
        "legs": [
          {
            "arrival": "00:30",
            "departure": "19:30",
            "distance": 0,
            "duration": 0,
            "from": "ACAPULCO COSTERA",
            "fromId": "661017a80294430529380813",
            "hideWhenPrintingManifest": false,
            "legord": 0,
            "to": "MEXICO TAXQUENA EDO",
            "toId": "661026f9029443052938083f",
            "travelRouteId": "5a721438608b5db92bed2684",
            "travelRouteName": "Route 66"
          }
        ],
        "toDate": "10/28/2025",
        "toDateYYYYMMDD": "2025-10-28",
        "updatedAt": {
          "offset": 0,
          "value": "2025-10-21T18:49:40.831Z"
        },
        "updatedBy": "68277de6b1cf7e05336f0045"
      }
    ],
    "scheduleId": "883e0b69-bc52-4f8e-b242-ddeb30842853"
  },
  "event": "schedule.exception.updated",
  "id": "80c1a680-f877-4b5d-872f-12249399f132",
  "livemode": false
}

Payload example schedule exception deleted

{
  "attemptId": "134f8bcc-82f7-47bd-9ac7-781df223aa36",
  "created": 1761072651,
  "data": { // The original query for the delete. Exactly one of [`_id`, `externalId`] will be present.
    "_id": "68f7d59a51b418077f42b2cd",
    "externalId": "schedule-exception-id"
  },
  "event": "schedule.exception.deleted",
  "id": "f4cd024c-d016-447f-8b81-c2a1703e6e47",
  "livemode": false
}

schedule.exception.bulkProcessed

Emitted when the deferred run for POST /schedules/schedule-exceptions/bulk has finished processing every row in the accepted batch (after the API has already returned 202 with the same processId). This bulk flow does not emit schedule.exception.created or schedule.updated per row; use this event for the full outcome.

The webhook uses the same outer envelope as other events (id, attemptId, created, event, livemode, data, …). What follows is the business JSON your integration should surface after it has unpacked data (wire details are handled by the webhook client / platform, not repeated here).

Payload — success (full outcome)

Field Type Description
processId string (UUID) Same processId returned in the 202 response for this bulk request.
itemCount number Number of rows in the original scheduleExceptions array (not errors.length or schedules.length).
errors array Only failed rows. Each element has index (0-based position in the request body), scheduleId, and error: { code, message } (same error style as single-row schedule exception creates).
schedules array One object per distinct scheduleId that had at least one successful create in this run: scheduleId, routeId, exceptions (full exceptions list for that schedule after processing, same shape as schedule APIs).

Payload — outcome too large to deliver on the webhook

If the bulk outcome cannot be sent in full on the webhook channel (internal size limit), the same schedule.exception.bulkProcessed event still fires, but the JSON body is reduced: you always get processId and itemCount, plus webhookPayloadError, and you do not get errors or schedules.

Field Type Description
processId string (UUID) Same correlation id as the 202 response.
itemCount number Same meaning as in the success payload.
webhookPayloadError object Describes the delivery limit issue. code is always WEBHOOK_GZIP_EXCEEDS_MAX_BYTES. Other properties (e.g. message, attemptedGzipSizeBytes, maxGzipBytes, errorItemCount, scheduleRowCount) may be present for diagnostics.

Treat this as: correlate with processId, shrink the batch or fetch schedule state elsewhere; per-row failures were not included in this webhook.

Example — success payload

{
  "processId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "itemCount": 2,
  "errors": [
    {
      "index": 1,
      "scheduleId": "00000000-0000-4000-8000-000000000000",
      "error": {
        "code": "SCHEDULE_NOT_FOUND",
        "message": "We could not found a schedule with the given ID"
      }
    }
  ],
  "schedules": [
    {
      "scheduleId": "883e0b69-bc52-4f8e-b242-ddeb30842853",
      "routeId": "661725b87a0f0505c507a654",
      "exceptions": []
    }
  ]
}

The exceptions array contains the full set of schedule exceptions for that schedule after the bulk run (same fields as in schedule.exception.created / schedule APIs). The example uses [] for brevity.

Example — payload when delivery is too large

{
  "processId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "itemCount": 500,
  "webhookPayloadError": {
    "code": "WEBHOOK_GZIP_EXCEEDS_MAX_BYTES",
    "message": "Bulk webhook payload exceeded the maximum allowed size. Full errors and schedules were omitted.",
    "attemptedGzipSizeBytes": 1200000,
    "maxGzipBytes": 1048576,
    "errorItemCount": 12,
    "scheduleRowCount": 400
  }
}