openapi: 3.0.1
info:
  title: Travel API
  description: Brex Travel External API.
  contact:
    name: Admin
    url: https://brex.com
    email: developer-support@brex.com
  version: '1.0'
  x-logo:
    altText: Brex Logo
    url: https://www.brex.com/logo.png
servers:
  - url: https://api.brex.com
    description: Production
  - url: https://api-staging.brex.com
    description: >-
      Staging (Note: This is not a sandbox. It will not work with customer
      tokens.)
security:
  - OAuth2: []
tags:
  - name: Trips
    description: Endpoints for getting trip data.
paths:
  /v1/trips:
    get:
      tags:
        - Trips
      summary: List trips
      description: Lists trips according to the filters passed in the query string.
      operationId: listTrips
      parameters:
        - name: cursor
          in: query
          required: false
          schema:
            type: string
            nullable: true
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            format: int64
            nullable: true
        - name: last_updated_after
          in: query
          required: false
          schema:
            type: string
            format: date-time
            nullable: true
        - name: load_custom_fields
          in: query
          description: Whether to load custom field values on the returned resources.
          schema:
            type: boolean
            nullable: true
      responses:
        '200':
          description: A page with a list of trips.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_Trip_'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal server error
      security:
        - OAuth2:
            - travel.trips
            - travel.trips.readonly
  /v1/trips/{trip_id}:
    get:
      tags:
        - Trips
      summary: Get trip
      description: Retrieves a trip by ID.
      operationId: getTrip
      parameters:
        - name: trip_id
          in: path
          required: true
          schema:
            type: string
        - name: load_custom_fields
          in: query
          description: Whether to load custom field values on the returned resources.
          schema:
            type: boolean
            nullable: true
      responses:
        '200':
          description: The trip that was retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Trip'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal server error
      security:
        - OAuth2:
            - travel.trips
            - travel.trips.readonly
  /v1/trips/{trip_id}/bookings:
    get:
      tags:
        - Trips
      summary: List trip bookings
      description: Lists the bookings within a trip.
      operationId: listTripBookings
      parameters:
        - name: cursor
          in: query
          required: false
          schema:
            type: string
            nullable: true
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            format: int64
            nullable: true
        - name: load_custom_fields
          in: query
          description: Whether to load custom field values on the returned resources.
          schema:
            type: boolean
            nullable: true
        - name: trip_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A page with a list of bookings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_Booking_'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal server error
      security:
        - OAuth2:
            - travel.trips
            - travel.trips.readonly
  /v1/trips/{trip_id}/bookings/{booking_id}:
    get:
      tags:
        - Trips
      summary: Get booking
      description: Retrieves a booking by trip and booking ID.
      operationId: getBooking
      parameters:
        - name: trip_id
          in: path
          required: true
          schema:
            type: string
        - name: booking_id
          in: path
          required: true
          schema:
            type: string
        - name: load_custom_fields
          in: query
          description: Whether to load custom field values on the returned resources.
          schema:
            type: boolean
            nullable: true
      responses:
        '200':
          description: The booking that was retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Booking'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal server error
      security:
        - OAuth2:
            - travel.trips
            - travel.trips.readonly
components:
  schemas:
    Address:
      type: object
      properties:
        country:
          type: string
          description: >-
            The country where the address is located. May be an alpha-2 code, an
            alpha-3 code, or the full name of the country.
          nullable: true
          example: Brazil
        administrative_area:
          type: string
          description: >-
            Depending on the country, this can be a state, a province, or
            something equivalent to those. May be an abbreviation or the full
            name.
          nullable: true
          example: RJ
        city:
          type: string
          description: The city where the address is located.
          nullable: true
          example: Rio de Janeiro
        postal_code:
          type: string
          description: The postal code of the given address.
          nullable: true
          example: 21941-900
        address_line_1:
          type: string
          description: The first line of the address.
          nullable: true
          example: Av. Vinte de Janeiro, S/N
        address_line_2:
          type: string
          description: The second line of the address.
          nullable: true
          example: Ilha do Governador
        coordinates:
          allOf:
            - $ref: '#/components/schemas/Address.GeoCoordinates'
            - description: The coordinates of the address.
              nullable: true
        timezone:
          type: string
          description: The timezone in the given address.
          nullable: true
          example: America/Sao_Paulo
      description: >-
        A location. All fields are optional, but the object will hold as much
        information as possible.
    Address.GeoCoordinates:
      required:
        - latitude
        - longitude
      type: object
      properties:
        latitude:
          type: number
          format: double
          example: -22.8145373
        longitude:
          type: number
          format: double
          example: -43.2465548
      description: The coordinates of an address.
    AirBookingData:
      required:
        - journeys
        - tickets
      type: object
      properties:
        journeys:
          type: array
          description: The journeys that make up this booking.
          items:
            $ref: '#/components/schemas/AirBookingData.Journey'
        tickets:
          type: array
          description: The flight tickets in this booking.
          items:
            $ref: '#/components/schemas/AirBookingData.FlightTicket'
        redress_number:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.DocumentNumber'
            - description: The Redress Number associated with this booking.
              nullable: true
        known_traveler_number:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.DocumentNumber'
            - description: The Known Traveler Number associated with this booking.
              nullable: true
        type:
          type: string
      description: Air-specific booking information.
    AirBookingData.CabinClass:
      type: string
      description: The cabin class of a flight.
      example: ECONOMY
      enum:
        - ECONOMY
        - PREMIUM_ECONOMY
        - BUSINESS
        - FIRST
    AirBookingData.DocumentNumber:
      required:
        - document_number
        - issuing_country
      type: object
      properties:
        issuing_country:
          type: string
          description: The country that issued this document.
          example: BR
        document_number:
          type: string
          description: The actual document number.
          example: '1231231'
      description: A document number such as a redress number or a known traveler number.
    AirBookingData.Flight:
      required:
        - arrival_time
        - departure_time
        - destination
        - origin
      type: object
      properties:
        origin:
          $ref: '#/components/schemas/AirBookingData.FlightEndpoint'
        destination:
          $ref: '#/components/schemas/AirBookingData.FlightEndpoint'
        departure_time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: The time when the flight departs the origin.
        arrival_time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: The time when the flight arrives at the destination.
        duration:
          type: string
          description: The duration of the flight in the ISO 8601 PnYnMnDTnHnMnS format.
          nullable: true
          example: PT4h20M
        confirmation_code:
          type: string
          description: The airline confirmation code.
          nullable: true
          example: PWZRTQ
        cabin_class:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.CabinClass'
            - description: The cabin class for this flight.
              nullable: true
        marketing_flight:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.FlightNumber'
            - description: >-
                The marketing flight number. Some flights are sold by one
                airline, but operated by another in the same alliance. This is
                the flight that was originally sold.
              nullable: true
        operating_flight:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.FlightNumber'
            - description: >-
                The operating flight number. Some flights are sold by one
                airline, but operated by another in the same alliance. This is
                the flight the traveler is actually taking.
              nullable: true
        seat:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.FlightSeat'
            - description: The seat reserved for this flight.
              nullable: true
      description: A flight taken by the traveler.
    AirBookingData.FlightEndpoint:
      required:
        - airport_code
      type: object
      properties:
        airport_code:
          pattern: '[A-Z]{3}'
          type: string
          description: The 3-letter IATA code of the airport.
          example: GIG
        terminal:
          type: string
          description: The terminal name and/or number.
          nullable: true
          example: T2
        gate:
          type: string
          description: The gate for boarding or leaving the plane.
          nullable: true
          example: B13
        airport_location:
          allOf:
            - $ref: '#/components/schemas/Address'
            - description: The location of the airport.
              nullable: true
      description: The place where a flight departs from or arrives at.
    AirBookingData.FlightNumber:
      required:
        - airline_code
        - number
      type: object
      properties:
        airline_code:
          pattern: '[0-9A-Z]{2}'
          type: string
          description: The IATA code for the airline.
          example: G3
        number:
          pattern: \d{1,4}
          type: string
          description: The number of the flight.
          example: '1234'
        airline_name:
          type: string
          description: The name of the airline.
          nullable: true
          example: GOL Linhas Aereas S.A.
      description: The flight number, including carrier information.
    AirBookingData.FlightSeat:
      required:
        - number
      type: object
      properties:
        number:
          type: string
          description: The seat number.
          example: 31D
        status:
          allOf:
            - $ref: '#/components/schemas/AirBookingData.FlightSeatStatus'
            - nullable: true
      description: Seat information in a flight.
    AirBookingData.FlightSeatStatus:
      type: string
      description: The status of a flight seat.
      example: CONFIRMED
      enum:
        - PENDING
        - CONFIRMED
        - CANCELED
    AirBookingData.FlightTicket:
      required:
        - number
      type: object
      properties:
        number:
          type: string
          description: The ticket number provided by the airline.
          example: '0017959463925'
        issue_date:
          type: string
          description: The date when the ticket was issued.
          format: date
          nullable: true
          example: '2017-12-27'
      description: A flight ticket.
    AirBookingData.Journey:
      required:
        - flights
        - status
      type: object
      properties:
        flights:
          type: array
          description: The flights that make up this journey.
          items:
            $ref: '#/components/schemas/AirBookingData.Flight'
        status:
          allOf:
            - $ref: '#/components/schemas/BookingStatus'
            - description: The status of this specific journey.
        cabin_display_name:
          type: string
          description: The cabin name as shown by the airline.
          nullable: true
          example: Flexible Economy
      description: >-
        A journey is composed of one or more flight segments that take a
        passenger from an origin to a final destination. E.g. if a traveler is
        doing a round trip from GIG to SFO, but they need to make a connection
        in IAH in each direction, the booking will contain 2 journeys. The first
        will contain 2 segments: GIG > IAH, and IAH > SFO. The second journey
        will also contain 2 segments: SFO > IAH, and IAH > GIG.
    Booking:
      required:
        - booking_data
        - created_at
        - id
        - source
        - status
        - trip_id
        - type
        - updated_at
        - version
      type: object
      properties:
        id:
          type: string
          description: The ID of the booking.
          example: booking_cl9t5dnu800040m3071dandeq
        created_at:
          type: string
          description: The time when the booking was created.
          format: date-time
          example: '2017-12-27T15:42:30Z'
        updated_at:
          type: string
          description: The time when the booking was last updated.
          format: date-time
          example: '2017-12-27T15:42:30Z'
        trip_id:
          type: string
          description: The ID of the trip to which this booking belongs.
          example: trip_cl9rh1n8g001e0j84w6fb4fd1
        version:
          minimum: 1
          type: integer
          description: The current version of the booking.
          format: int32
          example: 2
        type:
          $ref: '#/components/schemas/Booking.Type'
        status:
          $ref: '#/components/schemas/BookingStatus'
        source:
          $ref: '#/components/schemas/Booking.Source'
        booking_data:
          $ref: '#/components/schemas/Booking.Data'
        booking_reference:
          type: string
          description: >-
            The booking reference number shown in the dashboard and used when
            contacting Brex Support. This is the reference from the travel
            provider, not the Brex internal booking ID. May be null if the
            booking has no associated reference.
          nullable: true
          example: '7117228246'
        trip_reference:
          type: string
          description: >-
            The trip reference number shown in the dashboard and used when
            contacting Brex Support. This is the reference from the travel
            provider, not the Brex internal trip ID. May be null if the trip has
            no associated reference.
          nullable: true
          example: '7117228246'
        policy:
          allOf:
            - $ref: '#/components/schemas/Booking.Policy'
          description: >-
            The result of evaluating the customer's travel policy against this
            booking, as shown to the traveler when the booking was made. Mirrors
            the policy information available in the booking export. May be null
            when no policy was evaluated for the booking.
          nullable: true
        custom_fields:
          type: array
          description: Custom field values associated with this resource.
          nullable: true
          items:
            $ref: '#/components/schemas/CustomField'
      description: A booking representation.
    Booking.Data:
      type: object
      description: Type-specific booking data.
      discriminator:
        propertyName: type
        mapping:
          LODGING: '#/components/schemas/LodgingBookingData'
          RAIL: '#/components/schemas/RailBookingData'
          CAR_RENTAL: '#/components/schemas/CarRentalBookingData'
          AIR: '#/components/schemas/AirBookingData'
      oneOf:
        - $ref: '#/components/schemas/AirBookingData'
        - $ref: '#/components/schemas/CarRentalBookingData'
        - $ref: '#/components/schemas/LodgingBookingData'
        - $ref: '#/components/schemas/RailBookingData'
    Booking.Policy:
      required:
        - out_of_policy
      type: object
      properties:
        out_of_policy:
          type: boolean
          description: >-
            Whether the booking is out of policy, i.e. at least one travel
            policy rule was broken.
          example: true
        violations:
          type: array
          description: >-
            The specific travel policy rules that this booking violated. Empty
            when the booking is in policy.
          items:
            $ref: '#/components/schemas/Booking.PolicyViolation'
      description: >-
        The result of evaluating the customer's travel policy against this
        booking, as shown to the traveler when the booking was made. Mirrors the
        policy information available in the booking export. May be null when no
        policy was evaluated for the booking.
    Booking.PolicyViolation:
      required:
        - code
        - description
      type: object
      properties:
        code:
          $ref: '#/components/schemas/Booking.PolicyViolationCode'
        description:
          type: string
          description: A human-readable description of the policy violation.
          example: Fare exceeds maximum allowed
      description: A travel policy rule that a booking violated.
    Booking.PolicyViolationCode:
      type: string
      description: |-
        A machine-readable code identifying the policy rule that was violated:
          * `MIN_DAYS_IN_ADVANCE` - The booking was made less than the minimum number of days in advance.
          * `MAX_FARE_PER_TRAVELER` - The fare exceeds the maximum allowed per traveler.
          * `TICKET_REFUNDABILITY` - The ticket refundability does not meet policy requirements.
          * `TICKET_CHANGEABILITY` - The ticket changeability does not meet policy requirements.
          * `AMOUNT_LIMIT_BY_FLIGHT_DURATION` - The fare exceeds the maximum allowed for the flight duration.
          * `ALLOWED_CABIN_CLASSES_BY_DURATION` - The cabin class is not allowed for the flight duration.
          * `ALLOWED_CABIN_CLASSES_BY_DURATION_DOMESTIC` - The cabin class is not allowed for the domestic flight duration.
          * `ALLOWED_CABIN_CLASSES_BY_DURATION_INTERNATIONAL` - The cabin class is not allowed for the international flight duration.
          * `MEDIAN_PRICE` - The price exceeds the median price.
          * `LOWEST_LOGICAL_FARE` - The price exceeds the lowest logical fare.
          * `MAX_STARS` - The hotel rating exceeds the maximum allowed.
          * `DEFAULT_NIGHTLY_RATE` - The nightly rate exceeds the maximum allowed.
          * `NIGHTLY_RATE_FOR_LOCATION` - The nightly rate exceeds the maximum allowed for the location.
          * `MAX_HOTEL_BOOKING_PRICE` - The hotel booking price exceeds the maximum allowed.
          * `ALLOWED_CAR_CLASSES` - The car class is not allowed.
          * `MAX_DAILY_RATE` - The daily rate exceeds the maximum allowed.
          * `OTHER` - A policy violation that is not covered by the other codes.
      example: MAX_FARE_PER_TRAVELER
      enum:
        - MIN_DAYS_IN_ADVANCE
        - MAX_FARE_PER_TRAVELER
        - TICKET_REFUNDABILITY
        - TICKET_CHANGEABILITY
        - AMOUNT_LIMIT_BY_FLIGHT_DURATION
        - ALLOWED_CABIN_CLASSES_BY_DURATION
        - ALLOWED_CABIN_CLASSES_BY_DURATION_DOMESTIC
        - ALLOWED_CABIN_CLASSES_BY_DURATION_INTERNATIONAL
        - MEDIAN_PRICE
        - LOWEST_LOGICAL_FARE
        - MAX_STARS
        - DEFAULT_NIGHTLY_RATE
        - NIGHTLY_RATE_FOR_LOCATION
        - MAX_HOTEL_BOOKING_PRICE
        - ALLOWED_CAR_CLASSES
        - MAX_DAILY_RATE
        - OTHER
    Booking.Source:
      type: string
      description: |-
        The original source of a booking:
          * `BREX_TRAVEL` - The booking was created via Brex Travel.
          * `EXTERNAL` - The booking was manually inserted, e.g. a hotel room block for a group event.
      example: BREX_TRAVEL
      enum:
        - BREX_TRAVEL
        - EXTERNAL
    Booking.Time:
      required:
        - local_time
      type: object
      properties:
        local_time:
          type: string
          description: The local time in the relevant location in the ISO 8601 format.
          format: date-time
        timestamp:
          type: string
          description: An ISO 8601 timestamp.
          format: date-time
          nullable: true
          example: '2017-12-27T15:42:30Z'
      description: >-
        A time within a booking, including local time in the relevant location,
        and a timestamp when possible.
    Booking.Type:
      type: string
      description: The type of a booking.
      example: AIR
      enum:
        - AIR
        - CAR_RENTAL
        - LODGING
        - RAIL
    BookingStatus:
      type: string
      description: |-
        The status of the booking:
          * `HOLD` - The booking is a hold, and may be canceled without being charged.
          * `PENDING` - Some action needs to be completed before the booking is confirmed. Usually the action is the payment being confirmed.
          * `CONFIRMED` - The booking is confirmed.
          * `COMPLETED` - The booking has already happened.
          * `CANCELED` - The booking has been canceled.
          * `IN_PROGRESS` - The booking is currently in progress.
          * `REFUNDED` - A refund has been issued. It may or may not be a full refund.
          * `VOIDED` - Voided is similar to (and can be treated the same as) canceled.
          * `PROCESSING` - The booking has been created or changed, but confirmation from the vendor has not been received yet.
          * `UNCONFIRMED` - The booking was in the `PROCESSING` state for too long and some action is probably required to get this booking confirmed.
          * `AIRLINE_CONTROL` - The airline has taken control of the booking and further updates may not be visible.
          * `PAYMENT_DECLINED` - The payment for the booking has failed.
          * `SCHEDULE_CHANGE` - Some change has happened to the booking schedule, e.g. the flight getting canceled and the passenger reallocated to another flight. Travel support should reach out to confirm the traveler accepts the new schedule.
          * `APPROVAL_REQUESTED` - The booking is subject to approval, and it is waiting for a review.
          * `APPROVAL_DENIED` - A reviewer has denied the booking, or the deadline to approve the booking has passed and it got canceled.
          * `CANCELLATION_IN_PROGRESS` - The booking is currently being canceled.
      example: CONFIRMED
      enum:
        - HOLD
        - PENDING
        - CONFIRMED
        - COMPLETED
        - CANCELED
        - IN_PROGRESS
        - REFUNDED
        - VOIDED
        - PROCESSING
        - UNCONFIRMED
        - AIRLINE_CONTROL
        - PAYMENT_DECLINED
        - SCHEDULE_CHANGE
        - APPROVAL_REQUESTED
        - APPROVAL_DENIED
        - CANCELLATION_IN_PROGRESS
    BooleanListValue:
      title: Boolean list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            type: boolean
            description: The data of the custom field.
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Boolean list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    BooleanValue:
      title: Boolean value
      required:
        - data_type
      type: object
      properties:
        data:
          type: boolean
          description: The data of the custom field.
          nullable: true
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Boolean value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    CarRentalBookingData:
      required:
        - car_details
        - reservation_details
      type: object
      properties:
        car_details:
          $ref: '#/components/schemas/CarRentalBookingData.CarDetails'
        reservation_details:
          $ref: '#/components/schemas/CarRentalBookingData.ReservationDetails'
        type:
          type: string
      description: Car rental-specific booking information.
    CarRentalBookingData.CarClass:
      type: string
      description: The kind of car.
      example: INTERMEDIATE
      enum:
        - ECONOMY
        - COMPACT
        - INTERMEDIATE
        - PREMIUM
        - LUXURY
        - CONVERTIBLE
        - COMPACT_SUV
        - INTERMEDIATE_SUV
        - PREMIUM_SUV
        - LUXURY_SUV
        - MINI_VAN
        - PASSENGER_VAN
        - PICKUP_TRUCK
        - HYBRID
        - ELECTRIC
        - MINI
        - STANDARD
        - FULL_SIZE
        - SUV
        - SPORTS
        - SPECIAL
        - RECREATIONAL_VEHICLE
        - OTHER
    CarRentalBookingData.CarDetails:
      required:
        - display_name
      type: object
      properties:
        display_name:
          type: string
          description: The name of the car as displayed to the user.
          example: Intermediate car
        car_class:
          allOf:
            - $ref: '#/components/schemas/CarRentalBookingData.CarClass'
            - nullable: true
      description: Information on a rental car.
    CarRentalBookingData.RentalEndpoint:
      required:
        - location
        - time
      type: object
      properties:
        location:
          allOf:
            - $ref: '#/components/schemas/Address'
            - description: >-
                The location where the car can be picked up or where it must be
                returned.
        time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: >-
                The time when the car will be available for pickup or by when it
                must be returned.
      description: Information about the car pickup or drop-off.
    CarRentalBookingData.ReservationDetails:
      required:
        - drop_off
        - pickup
      type: object
      properties:
        confirmation_code:
          type: string
          description: The confirmation code given by the vendor.
          nullable: true
          example: 7003XBQ504
        pickup:
          allOf:
            - $ref: '#/components/schemas/CarRentalBookingData.RentalEndpoint'
            - description: Information on the car pickup.
        drop_off:
          allOf:
            - $ref: '#/components/schemas/CarRentalBookingData.RentalEndpoint'
            - description: Information on the car return.
        rental_company:
          type: string
          description: Name of car rental company.
          nullable: true
          example: Catch-A-Ride
      description: Information on a car reservation such as pickup, drop-off, etc.
    CustomField:
      required:
        - key
        - value
      type: object
      properties:
        key:
          type: string
          description: The key of the custom field.
        value:
          allOf:
            - $ref: '#/components/schemas/CustomField.ValueWrapper'
            - description: The value of the custom field.
              oneOf:
                - $ref: '#/components/schemas/StringValue'
                - $ref: '#/components/schemas/DecimalValue'
                - $ref: '#/components/schemas/BooleanValue'
                - $ref: '#/components/schemas/EnumValue'
                - $ref: '#/components/schemas/TimestampValue'
                - $ref: '#/components/schemas/DateValue'
                - $ref: '#/components/schemas/MoneyValue'
                - $ref: '#/components/schemas/OptionStringValue'
                - $ref: '#/components/schemas/StringListValue'
                - $ref: '#/components/schemas/DecimalListValue'
                - $ref: '#/components/schemas/BooleanListValue'
                - $ref: '#/components/schemas/EnumListValue'
                - $ref: '#/components/schemas/TimestampListValue'
                - $ref: '#/components/schemas/DateListValue'
                - $ref: '#/components/schemas/MoneyListValue'
                - $ref: '#/components/schemas/OptionStringListValue'
    CustomField.ValueWrapper:
      required:
        - data_type
        - value_type
      type: object
      properties:
        value_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldValueType'
            - description: The type of the custom field value.
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Base class for custom field values
    CustomField.ValueWrapper.MultipleValueWrapper:
      required:
        - value_type
      type: object
      properties:
        value_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldValueType'
            - description: The type of the custom field value.
      description: Multiple value wrapper for custom fields
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    CustomField.ValueWrapper.SingleValueWrapper:
      required:
        - value_type
      type: object
      properties:
        value_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldValueType'
            - description: The type of the custom field value.
      description: Single value wrapper for custom fields
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    CustomFieldDataType:
      type: string
      description: The type of the custom field data.
      enum:
        - STRING
        - DECIMAL
        - BOOLEAN
        - ENUM
        - TIMESTAMP
        - DATE
        - MONEY
        - OPTION_STRING
    CustomFieldValueType:
      type: string
      description: The type of the custom field value.
      enum:
        - SINGLE_VALUE
        - LIST
    DateListValue:
      title: Date list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            type: string
            description: The data of the custom field.
            format: date
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Date list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    DateValue:
      title: Date value
      required:
        - data_type
      type: object
      properties:
        data:
          type: string
          description: The data of the custom field.
          format: date
          nullable: true
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Date value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    DecimalListValue:
      title: Decimal list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            type: number
            description: The data of the custom field.
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Decimal list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    DecimalValue:
      title: Decimal value
      required:
        - data_type
      type: object
      properties:
        data:
          type: number
          description: The data of the custom field.
          nullable: true
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Decimal value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    EnumListValue:
      title: Enum list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            type: string
            description: The data of the custom field.
            format: enum
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Enum list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    EnumValue:
      title: Enum value
      required:
        - data_type
      type: object
      properties:
        data:
          type: string
          description: The data of the custom field.
          format: enum
          nullable: true
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Enum value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    LodgingBookingData:
      required:
        - lodging_details
        - reservation_details
      type: object
      properties:
        lodging_details:
          $ref: '#/components/schemas/LodgingBookingData.LodgingDetails'
        reservation_details:
          $ref: '#/components/schemas/LodgingBookingData.ReservationDetails'
        type:
          type: string
      description: Lodging-specific booking information.
    LodgingBookingData.ContactInfo:
      type: object
      properties:
        phone:
          type: string
          description: The phone number of the venue.
          nullable: true
          example: 12345554321
        fax:
          type: string
          description: The fax number of the venue.
          nullable: true
          example: 12345554321
        email:
          type: string
          description: The email address of the venue.
          nullable: true
          example: city@hotelchain.com
      description: Contact information of a venue.
    LodgingBookingData.LodgingDetails:
      required:
        - display_name
      type: object
      properties:
        display_name:
          type: string
          description: The name of the venue as displayed to the user.
          example: Fancy Hotel
        contact_information:
          allOf:
            - $ref: '#/components/schemas/LodgingBookingData.ContactInfo'
            - nullable: true
        star_rating:
          type: number
          description: The star rating of the hotel. Some hotels have half stars.
          format: float
          nullable: true
          example: 3.5
        brand_name:
          type: string
          description: The brand name of the hotel.
          nullable: true
          example: Marriott Hotels
        chain_name:
          type: string
          description: The name of the hotel chain.
          nullable: true
          example: Accor Hotels
        location:
          allOf:
            - $ref: '#/components/schemas/Address'
            - description: The location of the hotel.
              nullable: true
      description: Information on a lodging venue.
    LodgingBookingData.ReservationDetails:
      required:
        - check_in_time
        - checkout_time
      type: object
      properties:
        confirmation_code:
          type: string
          description: Confirmation code provided by the vendor.
          nullable: true
          example: 7003XBQ504
        check_in_time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: The time when check-in will be available.
        checkout_time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: The time limit for checkout.
        room:
          allOf:
            - $ref: '#/components/schemas/LodgingBookingData.Room'
            - nullable: true
      description: Information on a reservation such as check-in, checkout, etc.
    LodgingBookingData.Room:
      type: object
      properties:
        display_name:
          type: string
          description: The name of the room as displayed to the user.
          nullable: true
          example: Standard room
        description:
          type: string
          description: A description of the room.
          nullable: true
          example: Superior room
        bed_type:
          type: string
          description: The kind of bed.
          nullable: true
          example: DOUBLE
        bed_count:
          type: integer
          description: The number of beds.
          format: int32
          nullable: true
          example: 1
      description: Information on a room that was booked.
    Money:
      required:
        - amount
      type: object
      properties:
        amount:
          type: integer
          description: >-
            The amount of money, in the smallest denomination of the currency
            indicated by currency. For example, when currency is USD, amount is
            in cents.
          format: int64
          example: 700
        currency:
          type: string
          description: The type of currency, in ISO 4217 format.
          nullable: true
          example: USD
          default: USD
      description: >

        Money fields can be signed or unsigned. Fields are signed (an unsigned
        value will be interpreted as positive). The amount of money will be
        represented in the smallest denomination

        of the currency indicated. For example, USD 7.00 will be represented in
        cents with an amount of 700.
    MoneyListValue:
      title: Money list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/Money'
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Money list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    MoneyValue:
      title: Money value
      required:
        - data_type
      type: object
      properties:
        data:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/Money'
            - description: The data of the custom field.
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Money value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    OptionString:
      type: object
      properties:
        option_id:
          type: string
          description: The identifier when custom field data is of type option string.
          nullable: true
        option_label:
          type: string
          description: The label when custom field data is of type option string.
          nullable: true
      description: Option string fields have a label and a identifier.
    OptionStringListValue:
      title: Option string list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/OptionString'
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Option string list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    OptionStringValue:
      title: Option string value
      required:
        - data_type
      type: object
      properties:
        data:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/OptionString'
            - description: The data of the custom field.
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Option string value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    Page_Booking_:
      required:
        - items
      type: object
      properties:
        next_cursor:
          type: string
          nullable: true
        items:
          type: array
          items:
            $ref: '#/components/schemas/Booking'
    Page_Trip_:
      required:
        - items
      type: object
      properties:
        next_cursor:
          type: string
          nullable: true
        items:
          type: array
          items:
            $ref: '#/components/schemas/Trip'
    RailBookingData:
      required:
        - journeys
      type: object
      properties:
        journeys:
          type: array
          description: The journeys that make up this booking.
          items:
            $ref: '#/components/schemas/RailBookingData.RailJourney'
        type:
          type: string
      description: Rail-specific booking information.
    RailBookingData.RailClass:
      type: string
      description: The class of travel for a rail leg.
      example: SLEEPER
      enum:
        - FIRST
        - STANDARD
        - BUSINESS
        - SLEEPER
        - STANDARD_PREMIUM
        - BUSINESS_PREMIUM
        - COACH
        - ROOM
        - EXECUTIVE
    RailBookingData.RailJourney:
      required:
        - legs
      type: object
      properties:
        legs:
          type: array
          description: The legs that make up this journey.
          items:
            $ref: '#/components/schemas/RailBookingData.RailLeg'
      description: >-
        A journey is composed of the legs that take a passenger from an origin
        to a final destination. E.g. if a traveler is going from Aberdeen to
        London, but they need to change trains in Edinburgh, the booking will
        contain 1 journey composed of 2 legs. The first leg is Aberdeen to
        Edinburgh, and the second is Edinburgh to London.
    RailBookingData.RailLeg:
      required:
        - arrival_time
        - departure_time
        - destination
        - origin
      type: object
      properties:
        origin:
          $ref: '#/components/schemas/RailBookingData.RailStation'
        destination:
          $ref: '#/components/schemas/RailBookingData.RailStation'
        departure_time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: The time when the leg starts.
        arrival_time:
          allOf:
            - $ref: '#/components/schemas/Booking.Time'
            - description: The time when the leg ends.
        duration:
          type: string
          description: PT4h20M
          nullable: true
          example: PT4h20M
        vehicle:
          allOf:
            - $ref: '#/components/schemas/RailBookingData.Vehicle'
            - description: The vehicle that will be used in this leg.
              nullable: true
        seat:
          allOf:
            - $ref: '#/components/schemas/RailBookingData.RailSeat'
            - description: The seat that has been reserved for this leg.
              nullable: true
        rail_class:
          allOf:
            - $ref: '#/components/schemas/RailBookingData.RailClass'
            - nullable: true
      description: A leg is a portion of the journey between two consecutive stops.
    RailBookingData.RailSeat:
      type: object
      properties:
        coach_number:
          type: string
          description: The number of the coach.
          nullable: true
          example: '12'
        seat_number:
          type: string
          description: The number of the seat.
          nullable: true
          example: '41'
      description: A seat in a train leg.
    RailBookingData.RailStation:
      type: object
      properties:
        name:
          type: string
          description: The name of the station.
          nullable: true
          example: London - King's Cross
        location:
          allOf:
            - $ref: '#/components/schemas/Address'
            - description: The location of the station.
              nullable: true
        type:
          allOf:
            - $ref: '#/components/schemas/RailBookingData.RailStationType'
            - nullable: true
      description: An endpoint in a rail leg.
    RailBookingData.RailStationType:
      type: string
      description: >-
        The kind of station. Some rail itineraries include taking a bus or
        walking between stations, and these are represented as legs in the
        journey.
          * `INDIVIDUAL` - A regular train station.
          * `GROUP` - Stations grouped together, usually in a major European city. E.g. "London, Any".
          * `METRO` - A metro/subway station.
          * `BUS_STOP` - A bus stop.
          * `FERRY_TERMINAL` - A ferry terminal.
      example: INDIVIDUAL
      enum:
        - INDIVIDUAL
        - GROUP
        - METRO
        - BUS_STOP
        - FERRY_TERMINAL
    RailBookingData.Vehicle:
      type: object
      properties:
        carrier:
          type: string
          description: The carrier that operates this leg. E.g. Amtrak, Thameslink.
          nullable: true
          example: Amtrak
        timetable_id:
          type: string
          description: >-
            The timetable ID for the vehicle. The concept is similar to a flight
            number.
          nullable: true
          example: L79727
        type:
          allOf:
            - $ref: '#/components/schemas/RailBookingData.VehicleType'
            - nullable: true
      description: >-
        A vehicle used in a train leg. Some rail itineraries include taking a
        bus or walking between stations, and these are represented as legs in
        the journey.
    RailBookingData.VehicleType:
      type: string
      description: >-
        The kind of vehicle to be used in a leg. Some rail itineraries include
        taking a bus or walking between stations, and these are represented as
        legs in the journey.
          * `TRAIN` - A regular train.
          * `BUS` - A bus.
          * `FERRY` - A ferry.
          * `WALK`- Walking between stations.
          * `TAXI` - A taxi between stations.
          * `TRAM` - Tram/light rail.
          * `METRO` - Metro/subway.
          * `TUBE` - London underground.
      example: TRAIN
      enum:
        - TRAIN
        - BUS
        - FERRY
        - WALK
        - TAXI
        - TRAM
        - METRO
        - TUBE
    StringListValue:
      title: String list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            type: string
            description: The data of the custom field.
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: String list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    StringValue:
      title: String value
      required:
        - data_type
      type: object
      properties:
        data:
          type: string
          description: The data of the custom field.
          nullable: true
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: String value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    TimestampListValue:
      title: Timestamp list value
      required:
        - data_type
      type: object
      properties:
        data:
          type: array
          nullable: true
          items:
            type: string
            description: The data of the custom field.
            format: date-time
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Timestamp list value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.MultipleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    TimestampValue:
      title: Timestamp value
      required:
        - data_type
      type: object
      properties:
        data:
          type: string
          description: The data of the custom field.
          format: date-time
          nullable: true
        data_type:
          allOf:
            - $ref: '#/components/schemas/CustomFieldDataType'
            - description: The type of the custom field data.
      description: Timestamp value for a custom field
      allOf:
        - $ref: '#/components/schemas/CustomField.ValueWrapper.SingleValueWrapper'
        - $ref: '#/components/schemas/CustomField.ValueWrapper'
    Traveler:
      required:
        - type
      type: object
      properties:
        type:
          $ref: '#/components/schemas/Traveler.Type'
        name:
          allOf:
            - $ref: '#/components/schemas/Traveler.Name'
            - nullable: true
        guest_email:
          type: string
          description: If the traveler is a guest, this is their email.
          nullable: true
          example: guest@gmail.com
        user_id:
          type: string
          description: If the traveler is an employee, this is their user ID.
          nullable: true
          example: cuuser_cky0xs54b004h01pidi0pcuz1
      description: Information on the person who will be traveling.
    Traveler.Name:
      type: object
      properties:
        first_name:
          type: string
          description: The traveler's first name.
          example: John
        middle_name:
          type: string
          description: The traveler's middle name.
          nullable: true
          example: Paul
        last_name:
          type: string
          description: The traveler's last name.
          example: Doe
        suffix:
          type: string
          description: The suffix in the traveler's name.
          nullable: true
          example: Jr.
      description: The name of the traveler.
    Traveler.Type:
      type: string
      description: Whether the trip is for an employee or a guest.
      example: EMPLOYEE
      enum:
        - EMPLOYEE
        - GUEST
    Trip:
      required:
        - booker_user_id
        - created_at
        - id
        - status
        - updated_at
        - version
      type: object
      properties:
        id:
          type: string
          description: The ID of the trip.
          example: trip_cl9rh1n8g001e0j84w6fb4fd1
        created_at:
          type: string
          description: The time when the trip was created.
          format: date-time
          example: '2017-12-27T15:42:30Z'
        updated_at:
          type: string
          description: The time when the latest trip update happened.
          format: date-time
          example: '2017-12-27T15:42:30Z'
        name:
          maxLength: 100
          type: string
          description: The name of the trip as seen in the dashboard.
          nullable: true
          example: Trip to Rio de Janeiro
        booker_user_id:
          type: string
          description: >-
            The ID of the user who booked the trip. If the trip was created on
            copilot mode, this will be the ID of the user on behalf of whom the
            trip was booked.
          example: cuuser_cky0xs54b004h01pidi0pcuz1
        status:
          allOf:
            - $ref: '#/components/schemas/Trip.Status'
            - description: The current status of the trip.
        traveler:
          allOf:
            - $ref: '#/components/schemas/Traveler'
            - description: Information on the person who will be traveling.
              nullable: true
        version:
          minimum: 1
          type: integer
          description: The current version of the trip.
          format: int32
          example: 2
        billable_at:
          type: string
          description: >-
            The time when the trip became billable. If absent, the trip is
            currently not billable.
          format: date-time
          nullable: true
          example: '2017-12-27T15:42:30Z'
        starts_at:
          type: string
          description: The time when the first booking in the trip starts.
          format: date-time
          nullable: true
          example: '2017-12-27T15:42:30Z'
        ends_at:
          type: string
          description: The time when the last booking in the trip ends.
          format: date-time
          nullable: true
          example: '2017-12-27T15:42:30Z'
        trip_reference:
          type: string
          description: >-
            The trip reference number shown in the dashboard and used when
            contacting Brex Support. This is the reference from the travel
            provider, not the Brex internal trip ID. May be null if the trip has
            no associated reference.
          nullable: true
          example: '7117228246'
        custom_fields:
          type: array
          description: Custom field values associated with this resource.
          nullable: true
          items:
            $ref: '#/components/schemas/CustomField'
      description: A trip representation.
    Trip.Status:
      type: string
      description: The current status of a trip.
      example: UPCOMING
      enum:
        - PENDING
        - UPCOMING
        - IN_PROGRESS
        - COMPLETED
        - CANCELED
        - REFUNDED
        - VOIDED
        - DRAFT
        - DELETED
        - PROCESSING
        - UNCONFIRMED
        - AIRLINE_CONTROL
        - PAYMENT_DECLINED
        - SCHEDULE_CHANGE
        - HOLD
        - APPROVAL_REQUESTED
        - APPROVAL_DENIED
        - CANCELLATION_IN_PROGRESS
  securitySchemes:
    OAuth2:
      type: oauth2
      description: OAuth2 security scheme
      flows:
        authorizationCode:
          authorizationUrl: https://accounts-api.brex.com/oauth2/default/v1/authorize
          tokenUrl: https://accounts-api.brex.com/oauth2/default/v1/token
          scopes:
            openid: openid
            offline_access: offline access
    oAuth2ClientCredentials:
      type: oauth2
      description: >

        Refer to [these](https://developer.brex.com/docs/onboarding_examples/)
        docs on how to use client credentials 
      flows:
        clientCredentials:
          tokenUrl: https://accounts-api.brex.com/oauth2/default/v1/token
          scopes:
            openid: openid
            offline_access: offline access
x-explorer-enabled: false
