{
  "openapi": "3.1.0",
  "info": {
    "title": "RouteGenie Broker API",
    "version": "2.0 preview",
    "summary": "Trip exchange between a broker's RouteGenie instance and a transportation provider's software.",
    "description": "**Who should use this API:** transportation providers that work with a broker. The broker uses RouteGenie to assign trips to your company. Your software calls the broker's RouteGenie through this API to receive and run those trips.\n\n> **Preview.** This API is in design. Paths, fields and behavior may change before release.\n\nThis page lists every endpoint, field and webhook. To set up an integration, or to follow a task step by step, read the [guide](/broker-api/guide/).\n"
  },
  "servers": [
    {
      "url": "https://{broker}.routegenie.com/api/v2",
      "description": "The broker's RouteGenie address. Replace your-broker above with the broker's instance name to update the code samples.",
      "variables": {
        "broker": {
          "default": "your-broker",
          "description": "The broker's RouteGenie instance name."
        }
      }
    }
  ],
  "security": [
    {
      "integrationOAuth": []
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Your software gets, inspects and revokes access tokens, and rotates its client secret."
    },
    {
      "name": "Trips",
      "description": "Your software reads the trips assigned to your company, accepts or rejects them, reports status and vehicle locations, hands back trips it cannot run, and attests completed trips."
    },
    {
      "name": "Reference data",
      "description": "Lists used by trip fields, such as trip types, trip purposes, cancellation and disposition reasons, and trip statuses."
    },
    {
      "name": "Integration settings",
      "description": "Your integration's settings in the broker's RouteGenie, such as the location batch size and rate limits."
    },
    {
      "name": "Webhook endpoints",
      "description": "Your software registers, changes, removes and tests the endpoints where the broker's RouteGenie sends webhooks."
    },
    {
      "name": "Webhooks",
      "description": "Requests the broker's RouteGenie sends to your webhook endpoint when a trip assigned to your company is assigned, changed, taken back or canceled."
    }
  ],
  "paths": {
    "/trips": {
      "get": {
        "tags": [
          "Trips"
        ],
        "operationId": "listTrips",
        "summary": "List trips",
        "description": "The broker's RouteGenie returns your trips over a bounded date range, cursor-paginated.\n\nThe broker's RouteGenie enforces scoping; your software does not supply it as a filter. Your software's credential is associated with exactly one driver group, and the trips returned are the trips assigned to that group. Your software cannot name a group, widen the scope, or disable it.\n\nA date range is required. There is no unbounded query.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:trip"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "name": "passenger_id",
            "in": "query",
            "description": "Restrict to one passenger, by the broker's RouteGenie passenger `id`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "ride_id",
            "in": "query",
            "description": "The broker's own ride reference. Not used by provider integrations.",
            "schema": {
              "type": "string",
              "maxLength": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Restrict to one or more trip statuses. Values come from `/reference/trip_statuses`.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "updated_since",
            "in": "query",
            "description": "Only trips changed at or after this instant. Use it to resume after an outage.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of trips.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/CursorPage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Trip"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trips/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TripId"
        }
      ],
      "get": {
        "tags": [
          "Trips"
        ],
        "operationId": "getTrip",
        "summary": "Get a trip",
        "description": "The broker's RouteGenie returns the trip, with the passenger embedded as a snapshot.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:trip"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The trip.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trip"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trips/{id}/disposition": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TripId"
        }
      ],
      "post": {
        "tags": [
          "Trips"
        ],
        "operationId": "setTripDisposition",
        "summary": "Accept or reject an assigned trip",
        "description": "Your software's answer to an assignment, referencing the broker's RouteGenie trip `id`. Use this when your software's acknowledgement of the assignment could not carry the disposition inline.\n\nThe broker's RouteGenie sends every trip that can be accepted or rejected with its own terms in `terms`: the instant the answer is due, and what happens if it does not come. Do not compute the deadline yourself. `terms.deadline_basis` says how it was derived and whether it moves when the pick-up time moves.\n\nAn unanswered offer does not stall. At the deadline the broker's RouteGenie either accepts on your company's behalf, leaving the trip with your software, or takes the trip back, which your software receives as `trip.revoked`. `terms.on_expiry` says which, and the broker's RouteGenie sends it with the trip.\n",
        "security": [
          {
            "integrationOAuth": [
              "respond:trip"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripDispositionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Disposition recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TripAssignment"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The offer deadline has passed and the broker's RouteGenie took the trip back, or a disposition is already recorded.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trips/{id}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TripId"
        }
      ],
      "post": {
        "tags": [
          "Trips"
        ],
        "operationId": "reportTripStatus",
        "summary": "Report a trip status change",
        "description": "Report trip progress: en route, arrived, loaded, arrived at drop-off, completed, no-show. Valid status codes come from `GET /reference/trip_statuses`.\n\nCancellation is reported with `POST /trips/{id}/cancel`, not as a status. A no-show is reported as a status with `reason_id`.\n",
        "security": [
          {
            "integrationOAuth": [
              "report:trip_status"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Status recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trip"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The broker's RouteGenie rejects the report because the reported status is not reachable from the trip's current status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trips/locations": {
      "post": {
        "tags": [
          "Trips"
        ],
        "operationId": "reportTripLocations",
        "summary": "Report batched vehicle locations",
        "description": "Your software queues live locations and sends them in batches at the required cadence. Do not post one request per event. Your software reads the cadence and the maximum batch size from `GET /integration/settings`.\n",
        "security": [
          {
            "integrationOAuth": [
              "report:trip_location"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripLocationBatch"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "integer"
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RejectedLocation"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "413": {
            "description": "The batch exceeds the maximum size the broker's RouteGenie is configured to accept.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trips/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TripId"
        }
      ],
      "post": {
        "tags": [
          "Trips"
        ],
        "operationId": "cancelTrip",
        "summary": "Cancel a trip",
        "description": "When your software cancels, your involvement with this trip `id` ends. The trip goes back to the broker, and the request does not cancel the passenger's ride. Your software cancels with this operation, not by reporting a status.\n\nThe broker may also cancel a trip. Your software learns of it through `trip.canceled`. Cancellation is final for a trip `id`. The id is never reused. If the ride is needed again, the broker's RouteGenie sends it as a new trip with a new id.\n",
        "security": [
          {
            "integrationOAuth": [
              "cancel:trip"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canceled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trip"
                }
              }
            }
          },
          "403": {
            "description": "The broker's RouteGenie does not permit your integration to cancel.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The trip is already in a final status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trips/{id}/attest": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TripId"
        }
      ],
      "post": {
        "tags": [
          "Trips"
        ],
        "operationId": "attestTrip",
        "summary": "Attest a trip",
        "description": "\"I am ready to bill for this trip.\" Your company asserts that the work is done and that the record your software has already reported (the status events, their times, the driver and the vehicle) is complete and true. It is a statement about data already sent, not a submission of new data.\n\nAttesting moves a trip from performed to billable. A trip that is never attested does not get paid, so this is the last step of the exchange.\n\n**Preconditions.** The trip must be in a final status: completed or no-show, both of which are billable events. The broker's RouteGenie rejects attesting a trip still in progress, and attesting a trip twice.\n\n**The attestation window.** Brokers open a window rather than accepting attestation at any time. Where a window applies, the broker's RouteGenie returns `409` if your software attests outside it. The window is set by the broker and can differ per integration. The acceptance deadline for a trip is separate and is in its `terms`.\n\n**Attesting is not billing.** It is your assertion. What the broker does next, such as claim generation, submission and payment, is the broker's own process.\n\n**Billing-required fields are checked, not resent.** The body carries only the attestation fields. The broker's RouteGenie checks that your software has already submitted every other field the trip needs for billing, and returns `422` naming what is missing if one is not.\n",
        "security": [
          {
            "integrationOAuth": [
              "attest:trip"
            ]
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripAttestation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attested. The trip is billable as far as your company is concerned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trip"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The trip is not in a final status, has already been attested, or the broker's attestation window is not open. The error code says which.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The broker's RouteGenie refused the attestation. Typically a required value is missing from the reported record, such as an actual pick-up time or the vehicle that ran the trip.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/oauth2/token/": {
      "servers": [
        {
          "url": "https://{broker}.routegenie.com",
          "description": "Host root of the broker's RouteGenie",
          "variables": {
            "broker": {
              "default": "your-broker",
              "description": "The broker's RouteGenie instance name."
            }
          }
        }
      ],
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "issueToken",
        "summary": "Get an access token",
        "description": "Exchange your software's client credentials for a bearer token.\n\n**`client_credentials`**: use this grant for unattended trip exchange. Authenticate with the client id and secret issued for your integration. The broker's RouteGenie issues no refresh token for this grant; when the token expires, request another.\n\nSend credentials in the form body or as HTTP Basic auth, never both.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "The broker's RouteGenie returns this when the grant or the parameters are wrong. OAuth2 errors use their own shape, not this API's error envelope: `error` plus `error_description`, per RFC 6749.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "401": {
            "description": "The broker's RouteGenie does not accept the client id or secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/oauth2/revoke_token/": {
      "servers": [
        {
          "url": "https://{broker}.routegenie.com",
          "variables": {
            "broker": {
              "default": "your-broker",
              "description": "The broker's RouteGenie instance name."
            }
          }
        }
      ],
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "revokeToken",
        "summary": "Revoke a token",
        "description": "Invalidate a token immediately rather than waiting for it to expire. Use it when a credential is rotated, when an integration is decommissioned, or when a token may have been exposed.\n\nThe broker's RouteGenie returns 200 whether or not the token existed, so your software cannot use this endpoint to discover whether a token is valid.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  }
                },
                "required": [
                  "token",
                  "client_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoked, or no such token."
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/oauth2/introspect/": {
      "servers": [
        {
          "url": "https://{broker}.routegenie.com",
          "variables": {
            "broker": {
              "default": "your-broker",
              "description": "The broker's RouteGenie instance name."
            }
          }
        }
      ],
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "introspectToken",
        "summary": "Inspect a token",
        "description": "The broker's RouteGenie reports whether a token is currently valid and what it carries: scopes and expiry. Useful when debugging a 403, because it distinguishes an expired token from a valid token that lacks the scope.\n\nThe broker's RouteGenie does not report the token's binding, such as the instance or driver group. The response contains only standard RFC 7662 fields.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string"
                  }
                },
                "required": [
                  "token"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The token's state. The broker's RouteGenie reports `active` false for an unknown, expired or revoked token rather than returning an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenIntrospection"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/custom_trip_types": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listCustomTripTypes",
        "summary": "List custom trip types",
        "description": "Maintained by the broker, per instance. Backs `trip.custom_trip_type` and `passenger.custom_trip_type`.\n\nThe list differs between instances, so read it rather than hard-coding values.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:custom_trip_type"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of custom trip types.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/CursorPage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CustomTripType"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trip_purposes": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listTripPurposes",
        "summary": "List trip purposes",
        "description": "Maintained by the broker, per instance. Backs `trip.trip_purpose` and `passenger.trip_purpose`.",
        "security": [
          {
            "integrationOAuth": [
              "read:trip_purpose"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of trip purposes.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/CursorPage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/TripPurpose"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/reference/genders": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listGenders",
        "summary": "List genders",
        "description": "Fixed list, identical on every instance. Read-only. Use it to populate option lists for `passenger.gender`, which drives same-gender driver matching.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:reference"
            ]
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LookupList"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/reference/languages": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listLanguages",
        "summary": "List preferred languages",
        "description": "Fixed list, identical on every instance. Read-only.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:reference"
            ]
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LookupList"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/reference/vehicle_model_types": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listVehicleModelTypes",
        "summary": "List vehicle model types",
        "description": "Fixed list, basic types only. Read-only. Backs `passenger.required_vehicle_model_types`.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:reference"
            ]
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LookupList"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/reference/trip_statuses": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listTripStatuses",
        "summary": "List trip statuses",
        "description": "Fixed list, read-only. Use it to map returned status values programmatically.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:reference"
            ]
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LookupList"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/cancel_reasons": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listCancelReasons",
        "summary": "List cancellation and no-show reasons",
        "description": "Maintained by the broker, per instance. Backs `cancellation_reason_id` on `POST /trips/{id}/cancel`.\n\nThe free-text `note` on a cancel request is separate from the coded reason.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:cancel_reason"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of cancellation and no-show reasons.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/CursorPage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CancelReason"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/disposition_reasons": {
      "get": {
        "tags": [
          "Reference data"
        ],
        "operationId": "listDispositionReasons",
        "summary": "List disposition reasons",
        "description": "Maintained by the broker, per instance. Backs the coded reason on `POST /trips/{id}/disposition` and on an inline disposition in a `trip.assigned` acknowledgement.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:disposition_reason"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of disposition reasons.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/CursorPage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/DispositionReason"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/integration/settings": {
      "get": {
        "tags": [
          "Integration settings"
        ],
        "operationId": "getIntegrationSettings",
        "summary": "Get integration settings",
        "description": "What the broker's RouteGenie permits your integration to do, and the operational values your software must respect: the GPS batch cadence and maximum, rate limits and page-size maximums.\n\nRead it to learn which actions and fields your software may set, rather than discovering a restriction by being rejected.\n",
        "security": [
          {
            "integrationOAuth": [
              "read:integration"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Your integration's settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationSettings"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/integration/credentials": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "operationId": "getCredentials",
        "summary": "Inspect integration credentials",
        "description": "The broker's RouteGenie returns metadata about the client secrets in force for your integration: when each was created, when it expires, and when it was last used to get a token. **The secret value itself is never returned.** The broker's RouteGenie shows a secret once, at the moment it issues it.\n\nUse `expires_at` to schedule rotation before expiry rather than after a token request starts failing.\n",
        "security": [
          {
            "integrationOAuth": [
              "manage:credentials"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The credentials in force.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "secrets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CredentialSecret"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/integration/credentials/rotate": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "operationId": "rotateCredential",
        "summary": "Rotate the client secret",
        "description": "The broker's RouteGenie issues a new client secret without an outage and without a RouteGenie administrator.\n\n**The broker's RouteGenie returns the new secret once, in this response, and never again.** If it is lost before being stored, rotate again.\n\nRotation is overlapping, not immediate. The previous secret keeps working until `previous_secret_expires_at`, so you can deploy the new one across your fleet before the old one stops working. The sequence is:\n\n1. Call this endpoint and store `client_secret`.\n2. Deploy it everywhere that requests tokens.\n3. Confirm nothing is still using the old one: `last_used_at` on the superseded secret stops advancing.\n4. Either call `DELETE /integration/credentials/{id}` to retire it immediately, or let the overlap window expire on its own.\n\nRotating does **not** invalidate access tokens already issued. Those live out their normal lifetime. If the old secret was exposed rather than merely old, revoke the tokens explicitly at `POST /oauth2/revoke_token/`.\n\nYour software can rotate only its own integration's credential.\n",
        "security": [
          {
            "integrationOAuth": [
              "manage:credentials"
            ]
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "overlap_hours": {
                    "type": "integer",
                    "description": "How long the superseded secret keeps working. Defaults to the broker's RouteGenie instance setting. Set 0 to cut the old secret off immediately. Use 0 when rotating because of a suspected exposure, not for routine rotation.\n",
                    "minimum": 0,
                    "maximum": 168,
                    "default": 24
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new secret. Store `client_secret` now; it is not retrievable later.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "client_secret": {
                      "type": "string",
                      "description": "The broker's RouteGenie shows it once and never returns it again from any endpoint."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "previous_secret_expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "description": "When the superseded secret stops working. Null if the overlap was 0."
                    }
                  },
                  "required": [
                    "client_id",
                    "client_secret"
                  ]
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "description": "The broker's RouteGenie rate limits rotation.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integration/credentials/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/LookupId"
        }
      ],
      "delete": {
        "tags": [
          "Authentication"
        ],
        "operationId": "revokeCredential",
        "summary": "Retire a superseded secret early",
        "description": "End the overlap window ahead of schedule, once nothing is using the old secret. Use it to close the window after a routine rotation, and immediately after rotating in response to a suspected exposure.\n\nThe secret currently in force cannot be deleted, because that would lock out your integration. Rotate first, then retire the one it replaced.\n",
        "security": [
          {
            "integrationOAuth": [
              "manage:credentials"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Retired."
          },
          "409": {
            "description": "That secret is the one currently in force. Rotate before retiring it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/integration/webhook_endpoints": {
      "get": {
        "tags": [
          "Webhook endpoints"
        ],
        "operationId": "listWebhookEndpoints",
        "summary": "List webhook endpoints",
        "security": [
          {
            "integrationOAuth": [
              "manage:webhook"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The registered endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpoint"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Webhook endpoints"
        ],
        "operationId": "createWebhookEndpoint",
        "summary": "Register a webhook endpoint",
        "description": "Register your webhook endpoint URL and choose which events the broker's RouteGenie sends to it. The payload differs by event type, and the `type` field on the envelope tells your software's handler which one it has.\n\n**Register one endpoint or several.** Most integrations register one and dispatch on `type`. Registering several, each subscribed to a different set of events, is equally valid. Use it to separate concerns, such as status traffic to one service and remittance to another, or to keep a slow handler off the path of a fast one. Registering one URL per event type is not needed; the sets of events are what vary.\n\n**Subscribe to what you use.** The default is every event. Every event your endpoint is subscribed to and ignores is still a delivery, a retry queue and a signature check, so subscribe only to events your software handles.\n",
        "security": [
          {
            "integrationOAuth": [
              "manage:webhook"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointWrite"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered. The broker's RouteGenie returns the signing secret once, on creation, and never again.\n",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/WebhookEndpoint"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "signing_secret": {
                          "type": "string",
                          "description": "The broker's RouteGenie returns it only in this response. Your software uses it to verify the `x-rg-signature`\nheader on every delivery.\n"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/integration/webhook_endpoints/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/LookupId"
        }
      ],
      "patch": {
        "tags": [
          "Webhook endpoints"
        ],
        "operationId": "updateWebhookEndpoint",
        "summary": "Update a webhook endpoint or its subscriptions",
        "security": [
          {
            "integrationOAuth": [
              "manage:webhook"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointWrite"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhook endpoints"
        ],
        "operationId": "deleteWebhookEndpoint",
        "summary": "Remove a webhook endpoint",
        "security": [
          {
            "integrationOAuth": [
              "manage:webhook"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/integration/webhook_endpoints/{id}/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/LookupId"
        }
      ],
      "post": {
        "tags": [
          "Webhook endpoints"
        ],
        "operationId": "testWebhookEndpoint",
        "summary": "Send a test event to a webhook endpoint",
        "description": "The broker's RouteGenie delivers a signed `ping` event to your webhook endpoint so your software can verify reachability and signature validation before relying on the endpoint.\n",
        "security": [
          {
            "integrationOAuth": [
              "manage:webhook"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "delivered": {
                      "type": "boolean"
                    },
                    "response_status": {
                      "type": "integer",
                      "nullable": true
                    },
                    "error": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "webhooks": {
    "trip.assigned": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "onTripAssigned",
        "summary": "Trip assigned",
        "description": "The broker's RouteGenie sends this to your registered webhook endpoint when the broker assigns a trip, so your software receives new work without polling.\n\n`data.object` is the same `Trip` object that `GET /trips/{id}` returns.\n\nWhere your software can accept or reject the trip, `data.object.terms` carries the terms of the offer:\n\n* `deadline`: the instant an answer is due, as ISO 8601 with an offset.\n* `on_expiry`: whether silence past that instant means the broker's RouteGenie accepts on your company's behalf or turns the trip back.\n\nThe broker's RouteGenie resolves both values before it sends the event, so your software does not need the broker's configuration to know how long it has. `terms` is null on a trip that carries no deadline.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventTrip"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Your webhook endpoint returns 2xx to acknowledge. The acknowledgement may carry an accept or reject disposition if your software can decide in one step. Otherwise, your software answers separately with `POST /trips/{id}/disposition`.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookAck"
                }
              }
            }
          }
        }
      }
    },
    "trip.updated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "onTripUpdated",
        "summary": "Trip updated",
        "description": "The broker's RouteGenie sends this event when a trip changes. `data.object` is the full trip, as `GET /trips/{id}` returns it. `data.changed` lists the names of the fields that changed. Covers pick-up and drop-off address, time, date, custom trip type and status.\n\n**Passenger changes arrive here too.** Rider details reach your software inside the trip as the passenger snapshot, so a change to a rider is a change to the trip. `data.changed` names it with the `passenger.` prefix, for example `passenger.contact.phones`. There is no separate passenger event.\n\nThe broker's RouteGenie sends changes to a rider only while your software has an active trip for that rider.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventTrip"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/WebhookAck"
          }
        }
      }
    },
    "trip.revoked": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "onTripRevoked",
        "summary": "Trip revoked",
        "description": "The trip is still active in the broker's RouteGenie but is no longer assigned to your company. The broker may send it to your software again later under the same id. This is not a cancellation.\n\nYour software receives this event when the broker takes the trip back, including when an unanswered offer expires and `terms.on_expiry` is `auto_turn_back`. `data.object` is the full trip. The payload does not give a reason, so treat every `trip.revoked` the same: the work is no longer yours.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventTrip"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/WebhookAck"
          }
        }
      }
    },
    "trip.canceled": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "onTripCanceled",
        "summary": "Trip canceled",
        "description": "Final under this id. If the ride is needed again, the broker's RouteGenie sends it as a new trip with a new id.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventTrip"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/WebhookAck"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "integrationOAuth": {
        "type": "oauth2",
        "description": "Your software authenticates with an integration credential bound to your driver group. Your software may operate on trips in its scope and may not change the broker's configuration. Credentials are long-lived. Plan rotation from each secret's `expires_at`, and rotate with `POST /integration/credentials/rotate`.\n",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://{broker}.routegenie.com/oauth2/token/",
            "scopes": {
              "read:trip": "Read the trips assigned to your company.",
              "cancel:trip": "Hand back a trip you cannot run.",
              "respond:trip": "Accept or reject an assigned trip.",
              "report:trip_status": "Report trip status changes.",
              "attest:trip": "Confirm that a trip is done and ready to bill.",
              "report:trip_location": "Send vehicle locations in batches.",
              "read:trip.assignment": "See the driver and vehicle on a trip, as license number and VIN.",
              "read:trip.payout": "See what the broker pays your company for a trip (`driver_group_price`).",
              "read:custom_trip_type": "Read the broker's trip types.",
              "read:trip_purpose": "Read the broker's trip purposes.",
              "read:cancel_reason": "Read cancellation and no-show reasons.",
              "read:disposition_reason": "Read the reasons your software can give when it accepts or rejects a trip.",
              "read:reference": "Read the fixed lists, such as genders, languages and trip statuses.",
              "read:integration": "Read your integration's settings.",
              "manage:webhook": "Add, change and remove your webhook endpoints and their events.",
              "manage:credentials": "Rotate your own client secret."
            }
          }
        }
      }
    },
    "parameters": {
      "TripId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The broker's RouteGenie trip identifier, carried in the path.\n",
        "schema": {
          "type": "integer",
          "format": "int64"
        }
      },
      "LookupId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "format": "int64"
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "An opaque cursor from a previous response's `next` or `previous`. Never construct one.\n",
        "schema": {
          "type": "string"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Rows per page, at most 100. The maximum in force is published at `GET /integration/settings` as `page_size_limits`; read it there rather than hard-coding one. If your software asks for more, the broker's RouteGenie returns the maximum, not an error.\n",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 100
        }
      },
      "StartDate": {
        "name": "start_date",
        "in": "query",
        "required": true,
        "description": "Inclusive start of the range, ISO 8601 date. Required for `GET /trips`.",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "EndDate": {
        "name": "end_date",
        "in": "query",
        "required": true,
        "description": "Inclusive end of the range, ISO 8601 date. Required for `GET /trips`.",
        "schema": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The broker's RouteGenie rejected the request as malformed or failing validation.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Your software presented no valid credential.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The credential is valid, but the broker's RouteGenie does not allow this operation for it: the credential lacks the permission this operation requires, or the operation is not available to this credential.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "The broker's RouteGenie found no such object within the caller's scope. Deliberately indistinguishable from an object\nthat exists but belongs to another company.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests for this credential. The limit is per credential, so retrying from a different address does not help.\n",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait before retrying. The broker's RouteGenie always sends it on a 429."
          },
          "RateLimit-Limit": {
            "schema": {
              "type": "integer"
            },
            "description": "Requests allowed in the current window."
          },
          "RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            },
            "description": "Requests left in the current window."
          },
          "RateLimit-Reset": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds until the window resets."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "LookupList": {
        "description": "A fixed reference list, returned whole.",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/LookupItem"
              }
            }
          }
        }
      },
      "WebhookAck": {
        "description": "Acknowledged.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WebhookAck"
            }
          }
        }
      }
    },
    "schemas": {
      "CredentialSecret": {
        "type": "object",
        "description": "A client secret's metadata. The broker's RouteGenie never includes the value. It exists in cleartext only in the response that issued it.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "superseded"
            ],
            "description": "Whether this is the secret currently in force or one it replaced."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When this stops being valid."
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Last time this secret was exchanged for a token. Watch it stop advancing to confirm\na rotation has finished rolling out before retiring the old secret.\n"
          }
        },
        "required": [
          "id",
          "status",
          "created_at"
        ]
      },
      "TokenRequest": {
        "type": "object",
        "properties": {
          "grant_type": {
            "description": "Which flow your software is using.",
            "type": "string",
            "enum": [
              "client_credentials"
            ]
          },
          "client_id": {
            "type": "string",
            "description": "The public half of the credential."
          },
          "client_secret": {
            "type": "string",
            "writeOnly": true,
            "description": "The secret half of the credential. Never returned after it is issued."
          },
          "scope": {
            "type": "string",
            "description": "Space-separated scopes. Omit it to receive all the scopes the credential holds.\nAsk for less than the credential is entitled to where your software can - a narrower token limits the\ndamage if it leaks.\n"
          }
        },
        "required": [
          "grant_type"
        ]
      },
      "TokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "description": "The bearer token. Send it on every call."
          },
          "token_type": {
            "type": "string",
            "enum": [
              "Bearer"
            ],
            "description": "Always Bearer."
          },
          "expires_in": {
            "type": "integer",
            "description": "Seconds until expiry. Refresh on this value rather than on a hard-coded interval; it can vary by instance.\n",
            "examples": [
              36000
            ]
          },
          "scope": {
            "type": "string",
            "description": "The scopes the broker's RouteGenie actually granted, which may be narrower than those requested."
          }
        },
        "required": [
          "access_token",
          "token_type",
          "expires_in"
        ]
      },
      "TokenIntrospection": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean",
            "description": "Whether the token is currently valid."
          },
          "scope": {
            "type": "string",
            "nullable": true,
            "description": "Space-separated permissions."
          },
          "client_id": {
            "type": "string",
            "nullable": true,
            "description": "The public half of the credential."
          },
          "username": {
            "type": "string",
            "nullable": true,
            "description": "Not returned for integration tokens."
          },
          "exp": {
            "type": "integer",
            "nullable": true,
            "description": "Expiry as a Unix timestamp."
          }
        },
        "required": [
          "active"
        ]
      },
      "OAuthError": {
        "type": "object",
        "description": "OAuth2 errors follow RFC 6749 rather than this API's own error envelope. Only the token endpoints use this format.\n",
        "properties": {
          "error": {
            "description": "The failure, when this row did not succeed.",
            "type": "string",
            "examples": [
              "invalid_client"
            ]
          },
          "error_description": {
            "description": "Human-readable detail on the OAuth failure.",
            "type": "string",
            "examples": [
              "Client authentication failed."
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Error": {
        "type": "object",
        "description": "The broker's RouteGenie gives every non-2xx response this shape.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "invalid_request",
              "authentication_error",
              "permission_error",
              "not_found",
              "conflict",
              "rate_limit",
              "server_error"
            ],
            "description": "Broad class of failure.\n"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable code. Your software can safely branch on this value."
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation. Not stable; do not parse."
          },
          "param": {
            "type": "string",
            "nullable": true,
            "description": "The field that caused the failure, if any."
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when reporting a problem."
          }
        },
        "required": [
          "type",
          "code",
          "message"
        ]
      },
      "CursorPage": {
        "type": "object",
        "description": "Token pagination: fetch a page, then call again with the returned cursor. Cursors are opaque and single-purpose. There are no absolute page numbers.\n",
        "properties": {
          "data": {
            "type": "array",
            "items": {},
            "description": "The rows returned by this call. Follow `next` for the rest."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether another page follows."
          },
          "next": {
            "type": "string",
            "nullable": true,
            "description": "Cursor for the next page, or null."
          },
          "previous": {
            "type": "string",
            "nullable": true,
            "description": "Cursor for the previous page, or null."
          }
        },
        "required": [
          "data",
          "has_more"
        ]
      },
      "Point": {
        "type": "object",
        "description": "A geocoded location.",
        "properties": {
          "lat": {
            "type": "number",
            "format": "double",
            "description": "Latitude in decimal degrees.",
            "multipleOf": 1e-06
          },
          "lng": {
            "type": "number",
            "format": "double",
            "description": "Longitude in decimal degrees.",
            "multipleOf": 1e-06
          }
        },
        "required": [
          "lat",
          "lng"
        ]
      },
      "Phone": {
        "type": "object",
        "description": "One phone number. The same shape is used wherever a phone appears.\n",
        "properties": {
          "number": {
            "type": "string",
            "description": "E.164 recommended."
          },
          "type": {
            "type": "string",
            "enum": [
              "primary",
              "secondary",
              "whatsapp"
            ],
            "description": "`primary` is the number used for automated calls.\n"
          }
        },
        "required": [
          "number",
          "type"
        ]
      },
      "Contact": {
        "type": "object",
        "description": "Contact information. The number of phone numbers is capped.\n",
        "properties": {
          "phones": {
            "description": "The rider's phone numbers, in priority order.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Phone"
            },
            "maxItems": 3
          },
          "email": {
            "type": "string",
            "format": "email",
            "nullable": true,
            "description": "A single value, not a list."
          }
        }
      },
      "Address": {
        "type": "object",
        "description": "One address. The same object is used for a passenger's home addresses and a trip's pick-up and drop-off, with a different `purpose`.\n\nThe address is a single formatted `line1` plus a map `place_id`. It is not split into city, state, postal code and country.\n\nThere is no `line2`. A unit or suite that is part of the street address stays in `line1`. A trip's own suite, floor, room and bed are separate fields on the trip address.\n",
        "properties": {
          "purpose": {
            "type": "string",
            "description": "Which address this is, on a record that holds more than one — `primary` or\n`secondary` on a passenger, `pickup` or `dropoff` on a trip. Omitted where the\nrecord has a single address, as a facility or a referral source does.\n",
            "enum": [
              "primary",
              "secondary",
              "pickup",
              "dropoff"
            ]
          },
          "line1": {
            "type": "string",
            "description": "The full formatted address, as the broker's RouteGenie stores it, including any unit or suite that is part of it."
          },
          "place_id": {
            "type": "string",
            "nullable": true,
            "description": "A map place identifier."
          },
          "point": {
            "description": "Latitude and longitude, used for routing and geofencing.",
            "$ref": "#/components/schemas/Point"
          },
          "county": {
            "description": "The county that contains the address.",
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "line1"
        ]
      },
      "TripAddress": {
        "description": "A trip's pick-up or drop-off. The shared `Address` object plus the arrival detail a driver needs to find the rider. It has the same shape as the passenger's address for every attribute they share.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/Address"
          },
          {
            "type": "object",
            "properties": {
              "facility": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Facility"
                  }
                ],
                "nullable": true,
                "description": "PHI. A named clinic on a drop-off can imply a diagnosis.\n\nThe broker's RouteGenie sends the facility with its id, name and address, so your software needs no lookup to interpret it.\n"
              },
              "floor": {
                "type": "string",
                "nullable": true,
                "description": "Floor number, so the driver can find the rider inside the building."
              },
              "room": {
                "type": "string",
                "nullable": true,
                "description": "PHI-adjacent in a clinical setting."
              },
              "bed": {
                "type": "string",
                "nullable": true,
                "description": "PHI-adjacent in a clinical setting."
              },
              "suite": {
                "type": "string",
                "nullable": true,
                "description": "Suite or unit number."
              },
              "stairs": {
                "type": "integer",
                "nullable": true,
                "description": "Number of stairs at this address. Affects vehicle and crew selection."
              },
              "entrance": {
                "type": "string",
                "nullable": true,
                "description": "Which entrance to use, where a building has more than one."
              }
            }
          }
        ]
      },
      "Facility": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "name": {
            "type": "string",
            "description": "The facility's name, as it appears to a driver."
          },
          "address": {
            "$ref": "#/components/schemas/Address",
            "description": "The address of this facility."
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "CustomTripType": {
        "type": "object",
        "description": "A level of service. It decides the vehicle class and the crew, so use the whole object rather than a label to act on a trip.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this custom trip type."
          },
          "name": {
            "type": "string",
            "description": "Defined by the broker. Do not branch on it; branch on `base_mode`."
          },
          "id_code": {
            "type": "string",
            "nullable": true,
            "description": "Short code the broker uses for this level, where one is set."
          },
          "base_mode": {
            "type": "string",
            "enum": [
              "ambulatory",
              "wheelchair",
              "stretcher"
            ],
            "description": "The underlying vehicle class. This determines the vehicle, and a trip's base mode is derived from it.\n"
          },
          "need_attendant": {
            "type": "boolean",
            "description": "This custom trip type requires an attendant, independently of the rider's own flag."
          },
          "need_assistant": {
            "type": "boolean",
            "description": "This custom trip type requires the driver to assist the rider."
          },
          "load_time_seconds": {
            "type": "integer",
            "description": "How long loading is expected to take."
          },
          "load_time_other_seconds": {
            "type": "integer",
            "description": "Loading time where the stop is not the rider's own address."
          },
          "allow_zero_capacity": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether this level is still offered."
          }
        },
        "required": [
          "id",
          "name",
          "base_mode"
        ]
      },
      "TripPurpose": {
        "type": "object",
        "description": "Why a rider is traveling. Clinical information. It carries the expected appointment duration.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this trip purpose."
          },
          "name": {
            "type": "string",
            "description": "The purpose as the broker words it, for example Dialysis."
          },
          "duration_minutes": {
            "type": "integer",
            "description": "How long an appointment of this kind is expected to take. Zero means unknown."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether this purpose is still offered."
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "CancelReason": {
        "type": "object",
        "description": "A coded reason for a cancellation or a no-show. Filter by `applies_to` before offering a choice.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this reason."
          },
          "name": {
            "type": "string",
            "description": "The reason as it reads to a person."
          },
          "applies_to": {
            "type": "string",
            "enum": [
              "cancel",
              "no_show",
              "both"
            ],
            "description": "Whether this reason may be used on a cancellation, a no-show, or either. The broker's RouteGenie rejects a cancel-only reason sent on a no-show."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether this reason is still offered."
          }
        },
        "required": [
          "id",
          "name",
          "applies_to"
        ]
      },
      "DispositionReason": {
        "type": "object",
        "description": "A coded reason your software gives when it accepts or rejects an assigned trip. Separate from cancellation reasons: a disposition is your software's answer to an offer, not an ending of the trip.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this reason."
          },
          "name": {
            "type": "string",
            "description": "The reason as it reads to a person."
          },
          "applies_to": {
            "type": "string",
            "enum": [
              "accepted",
              "rejected",
              "both"
            ],
            "description": "Whether this reason may be used when accepting, rejecting, or either. The broker's RouteGenie rejects a reject-only reason sent on an accept."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether this reason is still offered."
          }
        },
        "required": [
          "id",
          "name",
          "applies_to"
        ]
      },
      "LookupItem": {
        "type": "object",
        "description": "One option from a reference list, and the only shape the reference endpoints return. Map the `id` your software receives on a trip or passenger to a label through the matching reference endpoint.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "code": {
            "type": "string",
            "nullable": true,
            "description": "Stable machine identifier where the list has one. Your software can safely branch on this value."
          },
          "name": {
            "type": "string",
            "description": "Display label. Editable by the broker; do not branch on it."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is in use. Inactive records stay for history rather than being deleted."
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "PassengerSnapshot": {
        "type": "object",
        "description": "The passenger as embedded in a trip. Read-only wherever it appears.\n\nThe rider's personal notes are included. A driver validates the rider by name, or by date of birth where supplied.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "first_name": {
            "type": "string",
            "description": "The rider's given name. Used with the surname for the driver to confirm they have the right person."
          },
          "last_name": {
            "type": "string",
            "description": "The rider's family name."
          },
          "birthday": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date of birth. The second way a driver validates the rider, after the name."
          },
          "contact": {
            "$ref": "#/components/schemas/Contact",
            "description": "How to reach the rider."
          },
          "required_vehicle_model_types": {
            "description": "Vehicle types required for this rider.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LookupItem"
            }
          },
          "custom_trip_type": {
            "description": "The level of service.\n",
            "allOf": [
              {
                "$ref": "#/components/schemas/LookupItem"
              }
            ],
            "nullable": true
          },
          "ride_alone": {
            "type": "boolean",
            "description": "The rider may not share a vehicle with other passengers."
          },
          "need_attendant": {
            "type": "boolean",
            "description": "An attendant or escort must travel with the rider."
          },
          "same_gender": {
            "type": "boolean",
            "description": "The rider requires a driver of the same gender."
          },
          "extra_time_in_vehicle_minutes": {
            "type": "integer",
            "nullable": true,
            "description": "Additional time on top of the normal limit that this rider tolerates in a vehicle."
          },
          "total_time_in_vehicle_minutes": {
            "type": "integer",
            "nullable": true,
            "description": "The longest this rider may spend in a vehicle on one trip, in minutes."
          },
          "trip_purpose": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LookupItem"
              }
            ],
            "nullable": true,
            "description": "Why the rider is traveling. Clinical information; handle it with the same care as a diagnosis code."
          },
          "notes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Note"
            },
            "description": "The rider's personal notes. Every entry has `type: personal`. Private notes are never included."
          }
        },
        "required": [
          "id",
          "first_name",
          "last_name"
        ]
      },
      "Trip": {
        "type": "object",
        "description": "A trip the broker assigned to your driver group.\n\n`driver_group_price` is what the broker pays your driver group for the trip. It requires the `read:trip.payout` scope.\n",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "readOnly": true,
            "description": "The broker's RouteGenie trip identifier. Use it as `{id}` in trip paths. It is the only trip identifier your software receives."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LookupItem"
              }
            ],
            "description": "One of the values from `GET /reference/trip_statuses`."
          },
          "base_mode": {
            "type": "string",
            "enum": [
              "ambulatory",
              "wheelchair",
              "stretcher"
            ],
            "description": "The underlying vehicle class. Read-only. It always equals the `base_mode` of the trip's custom trip type."
          },
          "custom_trip_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LookupItem"
              }
            ],
            "nullable": true,
            "description": "A compact reference with `id`, `code` and `name` only.\n\nVehicle class, attendant and assistant requirements, and loading time are on the full custom trip type object from `GET /custom_trip_types`, matched on this `id`. Read that list to work out which vehicle to send. Fetch it once and cache it. It changes when an administrator edits it, not per trip.\n"
          },
          "is_return_ride": {
            "type": "boolean",
            "description": "This trip is the return leg of a journey."
          },
          "linked_trip_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Ids of other legs of the same journey."
          },
          "pickup_address": {
            "$ref": "#/components/schemas/TripAddress",
            "description": "Where the rider is collected."
          },
          "dropoff_address": {
            "$ref": "#/components/schemas/TripAddress",
            "description": "Where the rider is taken."
          },
          "scheduled_pickup_time": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The scheduled time to pick up the rider."
          },
          "appointment_time": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the rider must arrive."
          },
          "use_appointment": {
            "type": "boolean",
            "description": "Whether the appointment time or the pick-up time drives dispatch."
          },
          "estimated_pickup_time": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the rider is currently expected to be collected."
          },
          "estimated_dropoff_time": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the rider is currently expected to arrive."
          },
          "assigned_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the trip was attached to a vehicle."
          },
          "assigned_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `assigned_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "en_route_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the driver set off toward the rider."
          },
          "en_route_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `en_route_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "arrived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the driver reached the pick-up point."
          },
          "arrived_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `arrived_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "loaded_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Actual pick-up."
          },
          "loaded_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `loaded_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "arrived_at_dropoff_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the driver reached the drop-off point."
          },
          "arrived_at_dropoff_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `arrived_at_dropoff_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Actual drop-off."
          },
          "completed_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `completed_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "canceled_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the trip was canceled. A no-show is recorded separately, in `no_show_at`."
          },
          "canceled_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `canceled_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "no_show_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the rider was marked a no-show. Null unless `no_show` is true."
          },
          "no_show_point": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true,
            "description": "Where the vehicle was at `no_show_at`. For a status your software reports, this is the `location` on that status request. Null where no position was recorded at that moment."
          },
          "no_show": {
            "type": "boolean",
            "description": "The rider did not present for the trip."
          },
          "ambulatory_seats": {
            "type": "integer",
            "nullable": true,
            "description": "Ambulatory seats required, including the rider."
          },
          "wheelchair_seats": {
            "type": "integer",
            "nullable": true,
            "description": "Wheelchair positions required."
          },
          "stretcher_seats": {
            "type": "integer",
            "nullable": true,
            "description": "Stretcher positions required."
          },
          "need_wheelchair": {
            "type": "boolean",
            "description": "A wheelchair is required for this trip."
          },
          "need_attendant": {
            "type": "boolean",
            "description": "An attendant or escort must travel with the rider."
          },
          "need_assistant": {
            "type": "boolean",
            "description": "The driver must assist the rider to and from the vehicle."
          },
          "extra_weight": {
            "type": "boolean",
            "description": "Bariatric. Handle it as health information."
          },
          "wait_on_return": {
            "type": "boolean",
            "description": "The driver waits after the prior leg."
          },
          "distance": {
            "type": "number",
            "nullable": true,
            "description": "Planned distance, in the unit given by `distance_unit`.",
            "multipleOf": 0.01
          },
          "distance_unit": {
            "type": "string",
            "enum": [
              "mi",
              "km"
            ],
            "description": "Unit of every distance on the trip. It is configurable per broker instance, so read it with each distance. Ignoring it misreads every distance."
          },
          "duration_minutes": {
            "type": "integer",
            "nullable": true,
            "description": "Planned duration, in minutes."
          },
          "passenger": {
            "description": "The rider, as the minimal snapshot needed to perform the trip.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PassengerSnapshot"
              }
            ],
            "readOnly": true
          },
          "trip_purpose": {
            "description": "Why the rider is traveling, such as dialysis. Clinical information.",
            "allOf": [
              {
                "$ref": "#/components/schemas/LookupItem"
              }
            ],
            "nullable": true
          },
          "cancellation_reason": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LookupItem"
              }
            ],
            "nullable": true,
            "description": "Coded cancellation or no-show reason. The broker's RouteGenie returns the coded value. It does not return the free-text explanation."
          },
          "terms": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TripAcceptanceTerms"
              }
            ],
            "nullable": true,
            "description": "The terms of the offer in front of your software: the deadline for your software to accept or reject, and what happens if it does not. Null where this trip cannot be accepted or rejected.\n\nThese terms are at the top level of the trip, so your software can see its deadline without the `read:trip.assignment` scope.\n"
          },
          "assignment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TripAssignment"
              }
            ],
            "nullable": true,
            "description": "Current driver and vehicle. Requires `read:trip.assignment`.\n\nThe broker's RouteGenie returns the driver as `DriverRef` (license number) and the vehicle as `VehicleRef` (VIN), and nothing else about either.\n"
          },
          "payer_extras": {
            "description": "The payer's extra fields for this trip: one entry per extra field the payer defines, with the value recorded on the trip. `value` is null where the payer defines the field but nothing is recorded. Empty when the payer defines no extras.\n\nThe payer itself is not identified in any endpoint.\n",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayerExtraValue"
            }
          },
          "driver_group_price": {
            "type": "number",
            "nullable": true,
            "description": "What the broker pays your driver group for this trip. Requires `read:trip.payout`. Null until a price is set.",
            "multipleOf": 0.01
          },
          "two_man_assist": {
            "type": "boolean",
            "nullable": true,
            "description": "Two crew are required."
          },
          "notes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Note"
            },
            "description": "Notes on this trip, one object each, so you can tell them apart, sort them and act on `type`.\n\nCarries `trip` and `dispatch` notes. It does **not** carry `personal` notes. Those belong to the rider and arrive on the passenger object and in `Trip.passenger`, even where a copy has been written onto the trip.\n\nOnly active notes are returned. An empty array means the trip has no notes.\n"
          },
          "signature": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SignatureRecord"
              }
            ],
            "nullable": true,
            "description": "Proof of service for this trip, as your software last submitted it on a status request, which the broker's RouteGenie returns without the image data (`SignatureRecord`). Null where none was captured."
          },
          "attested_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When your software attested that the trip is complete and billable. Null until it does. A trip that stays null is not paid."
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "TripCancelRequest": {
        "type": "object",
        "properties": {
          "cancellation_reason_id": {
            "type": "integer",
            "description": "Coded cancellation reason, by id from `/cancel_reasons`."
          },
          "note": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Free-text explanation to accompany the action."
          }
        },
        "required": [
          "cancellation_reason_id"
        ]
      },
      "TripDispositionRequest": {
        "type": "object",
        "properties": {
          "disposition": {
            "type": "string",
            "enum": [
              "accepted",
              "rejected"
            ],
            "description": "Whether your software accepts or rejects the trip."
          },
          "disposition_reason_id": {
            "type": "integer",
            "nullable": true,
            "description": "Coded reason, by id from `/disposition_reasons`. Its `applies_to` must cover the disposition being sent. Required on reject where the broker maintains disposition reasons."
          },
          "note": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Free-text explanation to accompany the action."
          }
        },
        "required": [
          "disposition"
        ]
      },
      "TripAssignment": {
        "type": "object",
        "description": "One provider's turn at a trip.",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "assigned_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the trip was handed to this provider."
          },
          "reason": {
            "type": "string",
            "enum": [
              "new",
              "reinstated",
              "off_hold",
              "redistributed"
            ],
            "description": "Why this assignment happened."
          },
          "disposition": {
            "description": "Whether the provider accepted or rejected, or the offer lapsed.",
            "type": "string",
            "nullable": true,
            "enum": [
              "accepted",
              "rejected",
              "expired",
              "revoked"
            ]
          },
          "disposition_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the provider answered."
          },
          "terms": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TripAcceptanceTerms"
              }
            ],
            "nullable": true,
            "description": "The terms that applied to this turn: when the answer was due and what happened if it did not come. Null where the trip could not be accepted or rejected.\n\nThe terms of the offer currently in front of your software are on the trip itself, as `Trip.terms`.\n"
          },
          "driver": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DriverRef"
              }
            ],
            "nullable": true,
            "description": "The driver running the trip, by license number. **Empty at assignment.** A broker hands a trip to a provider without a driver or vehicle. Your company chooses them. This is null until your software reports a status carrying the driver."
          },
          "vehicle": {
            "allOf": [
              {
                "$ref": "#/components/schemas/VehicleRef"
              }
            ],
            "nullable": true,
            "description": "The vehicle running the trip, by VIN. **Empty at assignment**, for the same reason as `driver`. Null until your software reports a status carrying the vehicle."
          }
        },
        "required": [
          "id",
          "assigned_at"
        ]
      },
      "Note": {
        "type": "object",
        "description": "One free-text note. Each note carries a `type`, so you can tell notes apart.",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "type": {
            "type": "string",
            "enum": [
              "dispatch",
              "trip",
              "personal"
            ],
            "description": "What kind of note this is.\n\n`dispatch`: the dispatcher's note on the trip.\n\n`trip`: the ordinary operational note on the trip. It holds what the driver needs to know.\n\n`personal`: the rider's own standing note. It travels with the rider rather than with any one trip. It is delivered on the passenger object and on the trip's `PassengerSnapshot`, never in `Trip.notes`.\n"
          },
          "text": {
            "type": "string",
            "description": "The note itself."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the note was written."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the note was last edited."
          }
        },
        "required": [
          "id",
          "type",
          "text",
          "created_at"
        ]
      },
      "TripAcceptanceTerms": {
        "type": "object",
        "description": "The terms of an offer your software can accept or reject: when the answer is due, and what happens if it does not come. The broker's RouteGenie sends them with the trip so your software never computes a deadline from a rule it cannot see.\n\nNull where the trip cannot be accepted or rejected: either the broker does not use accept/turn-back, or uses it without a deadline.\n",
        "properties": {
          "deadline": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The instant by which your software must accept or reject, as ISO 8601 with an offset. Null means there is no deadline and the offer stands until it is answered or revoked."
          },
          "on_expiry": {
            "type": "string",
            "nullable": true,
            "enum": [
              "auto_accept",
              "auto_turn_back"
            ],
            "description": "What the broker's RouteGenie does if the deadline passes unanswered. `auto_accept` leaves the trip with your company, and it is yours to run. `auto_turn_back` returns it to the broker, which your software sees as `trip.revoked`. Null where there is no deadline.\n\nThe two values lead to different events and obligations, so silence means different things depending on this field. Read it if your software lets offers lapse.\n"
          },
          "deadline_basis": {
            "type": "string",
            "nullable": true,
            "enum": [
              "after_assignment",
              "before_pickup",
              "day_before_fixed_time"
            ],
            "description": "How the deadline was derived, which tells your software whether it can move.\n\n- `after_assignment`: a fixed window from when the broker's RouteGenie sent the trip, counted through the broker's business hours.\n- `before_pickup`: a fixed offset before the requested pick-up, clamped to the present if that would put it in the past.\n- `day_before_fixed_time`: a fixed hour on the day before the trip.\n\nOnly `before_pickup` moves when the trip does. If your software caches an offer, use this to know whether a `trip.updated` can shorten the deadline.\n"
          },
          "can_turn_back_after_accept": {
            "type": "boolean",
            "description": "Whether your software may still return the trip to the broker after accepting it. Where this is false, acceptance is final and the only remaining route is `POST /trips/{id}/cancel`.\n\nThis is separate from whether your credential may return trips at all, which is `permitted_trip_actions.return_trip` on `GET /integration/settings`.\n"
          }
        }
      },
      "TripAttestation": {
        "type": "object",
        "description": "Accompanies an attestation. Every field is optional. Attestation asserts that a record your software already reported is complete, so if it has reported its statuses properly there is nothing left to send.\n\nYour software submits the other fields a trip needs for billing on the status requests and the trip itself. The broker's RouteGenie checks that they are set when the attestation arrives.\n",
        "properties": {
          "attested_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When your software attested, if not the moment of the call. Defaults to now."
          },
          "attested_by": {
            "type": "string",
            "nullable": true,
            "description": "Who at your company is making the assertion."
          },
          "final_odometer": {
            "type": "integer",
            "nullable": true,
            "description": "Closing odometer reading, used where the broker prices on measured rather than planned distance."
          },
          "final_odometer_unit": {
            "type": "string",
            "enum": [
              "mi",
              "km"
            ],
            "nullable": true,
            "description": "The unit of the odometer reading."
          },
          "note": {
            "type": "string",
            "maxLength": 500,
            "nullable": true,
            "description": "Free text to accompany the attestation."
          }
        }
      },
      "TripStatusRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Target status code from `GET /reference/trip_statuses`. Report a cancellation with `POST /trips/{id}/cancel`, not as a status."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the status change happened, not when your software reported it. Required, so a queued or retried report does not corrupt the trip timeline."
          },
          "location": {
            "description": "Where the vehicle was when the status changed.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Point"
              }
            ],
            "nullable": true
          },
          "reason_id": {
            "type": "integer",
            "nullable": true,
            "description": "Coded reason. Required for a no-show status."
          },
          "driver": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DriverRef"
              }
            ],
            "nullable": true,
            "description": "The driver running the trip, by license number. **This is how the broker learns who is driving.** A trip is assigned without a driver or vehicle, so your software reports them here. Send it on the first status that has it, usually en route. Repeating it on later statuses is harmless, and is how your software communicates a mid-trip driver change."
          },
          "vehicle": {
            "allOf": [
              {
                "$ref": "#/components/schemas/VehicleRef"
              }
            ],
            "nullable": true,
            "description": "The vehicle running the trip, by VIN. Send it the same way as `driver`: on the first status that has it, and again on any later status to communicate a mid-trip vehicle change."
          },
          "odometer": {
            "description": "Odometer reading at the moment of the status change.",
            "type": "integer",
            "nullable": true
          },
          "odometer_unit": {
            "description": "The unit of the odometer reading.",
            "type": "string",
            "enum": [
              "mi",
              "km"
            ],
            "nullable": true
          },
          "signature": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Signature"
              }
            ],
            "nullable": true,
            "description": "Proof of service, captured by the driver and submitted with its matching status.\n\nSend it on the status it evidences: a signature on a loaded status is the pick-up signature, and a signature on a completed status is the drop-off signature. No separate field states which kind it is.\n\nOmit it on every other status. A rider signature is PHI; do not send one where no signature was taken."
          }
        },
        "required": [
          "status",
          "occurred_at"
        ]
      },
      "Signature": {
        "type": "object",
        "description": "A captured signature, as a base64 data URI. **It is always the passenger's signature**, so no field says who signed.\n\n**Inbound only.** Your software submits it on a status report. A trip read returns `SignatureRecord`, which carries no image data.\n\nSend a full `data:` URI. The broker's RouteGenie accepts only PNG and JPEG, 10 MB at most. It rejects a payload that is bare base64 with no `data:` prefix, or that declares any other MIME type.",
        "properties": {
          "image": {
            "type": "string",
            "description": "The signature as `data:image/png;base64,<data>` or `data:image/jpeg;base64,<data>`. The declared MIME type must match the image bytes.",
            "maxLength": 10485760,
            "example": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..."
          },
          "captured_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the signature was taken, where that differs from `occurred_at` on the status carrying it."
          }
        },
        "required": [
          "image"
        ]
      },
      "SignatureRecord": {
        "type": "object",
        "description": "A signature as returned on a trip read: it shows that one was captured, without the image data. The inbound counterpart, with the image, is `Signature`.",
        "properties": {
          "captured_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the signature was taken, where that differs from `occurred_at` on the status carrying it."
          }
        }
      },
      "TripLocationBatch": {
        "type": "object",
        "description": "A batch of location fixes, queued by your software and posted at the cadence given by `location_batch` in `GET /integration/settings`, rather than once per event.",
        "properties": {
          "locations": {
            "description": "A batch of position fixes, queued by your software and sent at the permitted cadence.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TripLocation"
            }
          }
        },
        "required": [
          "locations"
        ]
      },
      "RejectedLocation": {
        "type": "object",
        "description": "One fix the broker's RouteGenie could not accept from the batch. The broker's RouteGenie still applies the rest of the batch.",
        "properties": {
          "trip_id": {
            "type": "integer",
            "format": "int64",
            "description": "The related trip, by RouteGenie id."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "When this position was measured, which is not when it was sent."
          },
          "code": {
            "type": "string",
            "description": "Stable machine identifier. Your software can safely branch on this value, unlike the display name."
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation. Not stable; do not parse it."
          }
        }
      },
      "IntegrationSettings": {
        "type": "object",
        "description": "What this credential may do and the limits it must respect. Read-only.",
        "properties": {
          "company": {
            "description": "The company that this credential covers.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CompanyRef"
              }
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "broker",
              "provider",
              "both"
            ],
            "description": "Your company's role on the broker's RouteGenie. Provider integrations receive `provider`."
          },
          "permitted_trip_actions": {
            "description": "Which trip actions this credential may perform.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PermittedTripActions"
              }
            ]
          },
          "field_permissions": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Per object, the fields your software receives at reduced fidelity or not at all, with the scope that would unlock each. Lets your software distinguish a missing value from a field it is not entitled to see, without guessing from a null.",
            "examples": [
              {
                "Trip": [
                  "assignment requires read:trip.assignment"
                ]
              }
            ]
          },
          "location_batch": {
            "description": "How often your software sends position batches, and how large they may be.",
            "allOf": [
              {
                "$ref": "#/components/schemas/LocationBatchLimits"
              }
            ]
          },
          "page_size_limits": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Maximum rows per page, keyed by the plural resource name as it appears in the path, such as `trips` or `custom_trip_types`. The limit is 100 for every object type. Read this value rather than hard-coding it."
          },
          "rate_limits": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RateLimits"
              }
            ],
            "description": "The request rate this credential is allowed. Read it rather than discovering it by being refused."
          },
          "api_version": {
            "type": "string",
            "description": "The API version pinned for this integration."
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Your webhook endpoint. The broker's RouteGenie POSTs events to it."
          },
          "auth": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookAuth"
              }
            ],
            "nullable": true,
            "description": "How the broker's RouteGenie authenticates to your webhook endpoint. The broker's RouteGenie never returns the stored secret."
          },
          "enabled_events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Event types the broker's RouteGenie delivers to this endpoint. Endpoints are independent, so two endpoints may take overlapping or disjoint sets. Omitting it subscribes the endpoint to every event. List the events your software handles rather than relying on that default."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is in use. Inactive records are kept for history rather than deleted."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created."
          }
        },
        "required": [
          "id",
          "url"
        ]
      },
      "WebhookEndpointWrite": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Your webhook endpoint. The broker's RouteGenie POSTs events to it."
          },
          "auth": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookAuth"
              }
            ],
            "nullable": true,
            "description": "How the broker's RouteGenie authenticates to your webhook endpoint. Omit or send `none` if the signature alone is enough."
          },
          "enabled_events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Event types the broker's RouteGenie delivers to this endpoint. Endpoints are independent, so two endpoints may take overlapping or disjoint sets. Omitting it subscribes the endpoint to every event. List the events your software handles rather than relying on that default."
          },
          "is_active": {
            "type": "boolean",
            "default": true,
            "description": "Whether the record is in use. Inactive records are kept for history rather than deleted."
          }
        },
        "required": [
          "url"
        ]
      },
      "WebhookAck": {
        "type": "object",
        "description": "The body your webhook endpoint may return when acknowledging a delivery. A bare 2xx response with no body is also a valid acknowledgement.",
        "properties": {
          "received": {
            "type": "boolean",
            "description": "Acknowledges the delivery."
          },
          "disposition": {
            "type": "string",
            "nullable": true,
            "enum": [
              "accepted",
              "rejected"
            ],
            "description": "Valid only on `trip.assigned`, and only where your software can decide in one step. Otherwise your software answers separately with `POST /trips/{id}/disposition`."
          },
          "disposition_reason_id": {
            "type": "integer",
            "nullable": true,
            "description": "Coded reason for the inline `disposition`, by id from `GET /disposition_reasons`."
          }
        }
      },
      "Event": {
        "type": "object",
        "description": "The envelope every webhook delivery shares: what happened, which object it affected, and the associated data.\n\nEach delivery from the broker's RouteGenie carries `x-rg-signature`, an HMAC-SHA256 of the raw body keyed by the endpoint's signing secret, and `x-rg-timestamp`. Verify both before trusting a payload. The broker's RouteGenie reuses the same `id` on retries, so make your handler idempotent on it.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique per event. Stable across retries."
          },
          "type": {
            "type": "string",
            "description": "For example `trip.assigned`."
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was raised."
          },
          "api_version": {
            "type": "string",
            "description": "The API version that produced this payload."
          },
          "data": {
            "type": "object",
            "description": "The body of the event. Its shape depends on the event type."
          }
        },
        "required": [
          "id",
          "type",
          "created",
          "data"
        ]
      },
      "EventTrip": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Event"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "description": "The trip in this event, and on an update the fields that changed.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/EventTripData"
                  }
                ]
              }
            }
          }
        ]
      },
      "DriverRef": {
        "type": "object",
        "description": "A reference to the driver running a trip: the license number and nothing else.\n\n**The broker's RouteGenie sends no state qualifier.** License numbers are unique within an issuing state, not across states, so two providers in different states could present the same number.",
        "properties": {
          "license_number": {
            "type": "string",
            "description": "The driver's license number, and the identifying value."
          }
        },
        "required": [
          "license_number"
        ]
      },
      "VehicleRef": {
        "type": "object",
        "description": "A reference to the vehicle running a trip: the VIN and nothing else. The VIN is globally unique and permanent.",
        "properties": {
          "vin": {
            "type": "string",
            "description": "Vehicle identification number, and the identifying value."
          }
        },
        "required": [
          "vin"
        ]
      },
      "PayerExtraValue": {
        "type": "object",
        "description": "One payer-defined extra field on a trip, as a name and a value. The broker's RouteGenie returns it on every trip read as `Trip.payer_extras`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "The extra field that this value fills."
          },
          "value": {
            "type": "string",
            "description": "The value for that field. Null on a trip read where the payer defines the field but nothing is recorded.",
            "nullable": true
          }
        }
      },
      "TripLocation": {
        "type": "object",
        "description": "One vehicle position at one moment, for one trip. Your software sends it in batches rather than one call per fix.",
        "properties": {
          "trip_id": {
            "type": "integer",
            "format": "int64",
            "description": "The related trip, by RouteGenie id."
          },
          "point": {
            "$ref": "#/components/schemas/Point",
            "description": "Latitude and longitude, used for routing and geofencing."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the fix was taken, not when it was sent."
          },
          "heading": {
            "type": "integer",
            "nullable": true,
            "description": "Degrees from north."
          },
          "speed": {
            "type": "integer",
            "nullable": true,
            "description": "Current speed."
          },
          "speed_unit": {
            "type": "string",
            "enum": [
              "mph",
              "kph"
            ],
            "nullable": true,
            "description": "The unit of the speed."
          }
        },
        "required": [
          "trip_id",
          "point",
          "recorded_at"
        ]
      },
      "CompanyRef": {
        "type": "object",
        "description": "A reference to a company in the broker's RouteGenie: its id and display name.",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Unique identifier for this record."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          }
        }
      },
      "LocationBatchLimits": {
        "type": "object",
        "description": "How often and how many vehicle positions this credential may submit.",
        "properties": {
          "interval_seconds": {
            "type": "integer",
            "description": "How often your software sends a batch."
          },
          "max_batch_size": {
            "type": "integer",
            "description": "The largest batch the broker's RouteGenie accepts."
          }
        }
      },
      "EventTripData": {
        "type": "object",
        "description": "The body of a trip event: the trip itself, and on an update the names of the fields that changed.",
        "properties": {
          "object": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Trip"
              }
            ],
            "description": "The same object `GET /trips/{id}` returns."
          },
          "changed": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names of the fields that changed. Present on `trip.updated`."
          }
        },
        "required": [
          "object"
        ]
      },
      "PermittedTripActions": {
        "type": "object",
        "description": "Which trip actions this credential may perform. A false value means the action is switched off for this credential, and the broker's RouteGenie refuses a request for it.",
        "properties": {
          "cancel_trip": {
            "type": "boolean",
            "description": "This credential may cancel a trip."
          },
          "return_trip": {
            "type": "boolean",
            "description": "Whether your credential may return a trip to the broker."
          }
        }
      },
      "RateLimits": {
        "type": "object",
        "description": "The request rate allowed for the calling credential. Limits are per credential: two credentials on one company are counted separately, and one credential used from several machines shares one budget.\n\nValues can change over time. Read them here rather than hard-coding them.",
        "properties": {
          "requests_per_minute": {
            "type": "integer",
            "description": "Requests allowed in a rolling minute."
          },
          "requests_per_day": {
            "type": "integer",
            "nullable": true,
            "description": "Requests allowed in a rolling day, where a daily ceiling applies."
          },
          "burst": {
            "type": "integer",
            "nullable": true,
            "description": "Requests allowed in a short burst above the sustained rate, where bursting is permitted."
          }
        },
        "required": [
          "requests_per_minute"
        ]
      },
      "WebhookAuth": {
        "type": "object",
        "description": "How the broker's RouteGenie authenticates **to your webhook endpoint**. This is separate from the signature, which is how your software authenticates the broker's RouteGenie: the signature proves a delivery came from the broker's RouteGenie and was not altered, and the broker's RouteGenie always sends it. This setting says what your webhook endpoint needs on top of that before it accepts the call.\n\nAll four types are supported.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "none",
              "header",
              "basic",
              "oauth2_client_credentials"
            ],
            "description": "`none` - the signature is the only proof, and your webhook endpoint must be reachable without credentials.\n`header` - a fixed header you choose, which covers an API key or a static bearer token.\n`basic` - HTTP basic.\n`oauth2_client_credentials` - the broker's RouteGenie fetches a token from your token URL and refreshes it when it expires."
          },
          "header_name": {
            "type": "string",
            "nullable": true,
            "description": "For `header`. The header to send, for example `X-Api-Key` or `Authorization`."
          },
          "secret": {
            "type": "string",
            "writeOnly": true,
            "nullable": true,
            "description": "Write-only. The header value, the basic password, or the OAuth client secret, depending on `type`. Never returned - a read shows `secret_set` instead."
          },
          "username": {
            "type": "string",
            "nullable": true,
            "description": "For `basic`, or the client id for `oauth2_client_credentials`."
          },
          "token_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "For `oauth2_client_credentials`. Where the broker's RouteGenie asks for a token."
          },
          "scope": {
            "type": "string",
            "nullable": true,
            "description": "For `oauth2_client_credentials`. Scopes to request, space separated."
          },
          "secret_set": {
            "type": "boolean",
            "readOnly": true,
            "description": "Read-only. Whether a secret is stored. The value itself is never returned."
          }
        },
        "required": [
          "type"
        ]
      }
    }
  }
}