> ## Documentation Index
> Fetch the complete documentation index at: https://developers.portao3.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an air search

> Starts a search for flights, one way or round trip.

Searches are asynchronous: this answers `202` at once with the search in `PROCESSING` status while the travel suppliers answer in the background. Poll the search with its `id` until `status` is `COMPLETED` — or `FAILED` — to read the results. A flight search lasts 15 minutes (see `ttl`); after that, create it again. Creating the same search again while it lasts returns the same `id`, and only your organization can read the searches it created.

Find `origin` and `destination` with the locations endpoint. To book a result, open the item for its fares, then create a trip with the item's `id` as `searchItemId` and the chosen fare's `id` as `fareId`.

An error the travel provider reports about the request — an unknown airport, say — is returned with its own status, `code` and `message`.


## OpenAPI

````yaml /api-reference/travel.openapi.json post /realms/{realmId}/organizations/{organizationId}/air/searches
openapi: 3.0.3
info:
  title: Travel
  version: 1.0.0
  description: >-
    Portão 3 travel API. Every endpoint requires a bearer token in the
    Authorization header (Authorization: Bearer <token>) unless its page states
    otherwise; see the Authentication guide. That requirement is not repeated
    per endpoint. Generated by tools/openapi from code (routes + security) and
    the hand-written spec (request/response bodies). Passenger directory, trips
    and the search proxy (air/hotel/bus/vehicle). Every route validates path,
    query and body through a zod Input class (`travel/src/domain/*/input`),
    which documents its parameters and body; responses are the named interfaces
    in `travel/src/domain/*/response.ts`. Confidence tiers: generated:typed=53
    copied:manual=0 unknown=0.
servers:
  - url: https://api.travel.v2.portao3.com.br/
    description: production
  - url: https://api.travel.dev.3pers.com.br/
    description: development
security: []
tags:
  - name: Passengers
  - name: Trips
  - name: Air search
  - name: Hotel search
  - name: Bus search
  - name: Vehicle search
paths:
  /realms/{realmId}/organizations/{organizationId}/air/searches:
    post:
      tags:
        - Air search
      summary: Create an air search
      description: Starts a search for flights, one way or round trip.
      operationId: postRealmsByRealmIdOrganizationsByOrganizationIdAirSearches
      parameters:
        - name: realmId
          in: path
          required: true
          description: |-
            ID of your realm.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
        - name: organizationId
          in: path
          required: true
          description: |-
            ID of your organization.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                departureDate:
                  type: string
                  minLength: 1
                  description: Outbound flight date (`YYYY-MM-DD`). Today or later.
                  example: '2026-11-02'
                returnDate:
                  description: >-
                    Return flight date (`YYYY-MM-DD`), on or after
                    `departureDate`. Omit it for a one-way trip.
                  example: '2026-11-05'
                  type: string
                  minLength: 1
                origin:
                  type: string
                  minLength: 1
                  description: >-
                    Origin airport: its 3-letter IATA code or its `id` from the
                    locations endpoint. Must differ from `destination`.
                  example: GRU
                destination:
                  type: string
                  minLength: 1
                  description: >-
                    Destination airport: its 3-letter IATA code or its `id` from
                    the locations endpoint. Must differ from `origin`.
                  example: GIG
                passengers:
                  minItems: 1
                  type: array
                  items:
                    type: string
                    enum:
                      - ADULT
                      - CHILD
                      - INFANT
                      - SENIOR
                    example: ADULT
                  description: >-
                    Who is traveling, one entry per traveler, at least one:
                    `ADULT`, `CHILD`, `INFANT` or `SENIOR`.


                    ---


                    Example: `["ADULT"]`
                cabin:
                  description: >-
                    Cabin to search: `ECONOMY`, `PREMIUM_ECONOMY`, `BUSINESS`,
                    `FIRST_CLASS` or `UNDEFINED`. Defaults to `ECONOMY`.
                  example: ECONOMY
                  type: string
                  minLength: 1
              required:
                - departureDate
                - origin
                - destination
                - passengers
      responses:
        '202':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: >-
                      ID of the search. The same search parameters, within the
                      time the search lasts, return the same ID.
                    example: srch_V1StGXR8Z5jdHi6BmyT2k
                  searchParams:
                    type: object
                    properties:
                      departureDate:
                        type: string
                        description: Outbound date, as sent.
                        example: '2026-11-02'
                      returnDate:
                        type: string
                        description: Return date, as sent. Absent for a one-way trip.
                        example: '2026-11-05'
                      origin:
                        type: string
                        description: Origin airport, as sent.
                        example: GRU
                      destination:
                        type: string
                        description: Destination airport, as sent.
                        example: GIG
                      passengers:
                        type: array
                        items:
                          type: string
                          enum:
                            - ADULT
                            - CHILD
                            - INFANT
                            - SENIOR
                          example: ADULT
                        description: |-
                          Travelers, as sent.

                          ---

                          Example: `["ADULT"]`
                      cabin:
                        type: string
                        enum:
                          - ECONOMY
                          - PREMIUM_ECONOMY
                          - BUSINESS
                          - FIRST_CLASS
                          - UNDEFINED
                        description: Cabin searched; `ECONOMY` when the request had none.
                        example: ECONOMY
                    required:
                      - departureDate
                      - origin
                      - destination
                      - passengers
                      - cabin
                    description: What the search was made for.
                  type:
                    type: string
                    enum:
                      - AIR
                    description: Always `AIR`.
                    example: AIR
                  status:
                    type: string
                    enum:
                      - PROCESSING
                      - FAILED
                      - COMPLETED
                    description: >-
                      `PROCESSING` right after creation. It becomes `COMPLETED`
                      or `FAILED` on its own: poll the search.
                    example: PROCESSING
                  warning:
                    description: >-
                      How the search went across the suppliers. `null` while it
                      is processing.
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - ALL_FAILED
                          - PARTIAL_SUCCESS
                          - ALL_SUCCESS
                        description: >-
                          `ALL_SUCCESS`: every supplier answered.
                          `PARTIAL_SUCCESS`: some suppliers failed, so the
                          results may be incomplete. `ALL_FAILED`: no supplier
                          answered.
                        example: ALL_SUCCESS
                      message:
                        type: string
                        description: Human-readable explanation.
                        example: All suppliers answered.
                    required:
                      - code
                      - message
                    nullable: true
                  ttl:
                    type: number
                    description: Seconds until the search expires.
                    example: 900
                  facets:
                    description: >-
                      Facets to build filters from (price ranges, airlines).
                      `null` until the search completes.
                    type: object
                    additionalProperties: {}
                    nullable: true
                  createdAt:
                    type: string
                    description: When the search was created.
                    example: '2026-10-19T15:00:00.000Z'
                    format: date-time
                required:
                  - id
                  - searchParams
                  - type
                  - status
                  - warning
                  - ttl
                  - facets
                  - createdAt
                description: >-
                  A search just created for flights. Results come later: poll
                  the search.
        '422':
          description: >-
            `BAD_REQUEST` — A path parameter is not a valid ID or the body
            failed validation; `fields` lists each offending field.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - BAD_REQUEST
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - TRAVEL
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                  fields:
                    type: array
                    description: >-
                      One entry per invalid request field (validation errors
                      only).
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          description: >-
                            Path of the invalid field, e.g. `label` or
                            `values[0].value`.
                          example: label
                        message:
                          type: string
                          description: Why the field was rejected.
                          example: label is required
                        code:
                          type: string
                          description: >-
                            `<FIELD>_<REASON>` — e.g. `LABEL_REQUIRED`,
                            `TYPE_ONE_OF`, `VALUES_VALUE_TYPE_ERROR`.
                          example: LABEL_REQUIRED
                        values:
                          type: array
                          items:
                            type: string
                          description: >-
                            The accepted values, when the field is an
                            enumeration.
                      required:
                        - field
                        - message
                        - code
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: BAD_REQUEST
                origin: TRAVEL
                message: >-
                  Bad Request: Your request is invalid or incomplete. Please
                  make sure you are requesting with the right fields.
                fields:
                  - field: departureDate
                    message: 'Invalid input: expected string, received undefined'
                    code: DEPARTUREDATE_REQUIRED
        '503':
          description: >-
            `PROVIDER_UNAVAILABLE` — The travel provider could not be reached;
            no search was created. Retry later.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - PROVIDER_UNAVAILABLE
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - TRAVEL
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: PROVIDER_UNAVAILABLE
                origin: TRAVEL
                message: Travel provider temporarily unavailable, please retry.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.