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

# Complete Trip

> Completes a trip.



## OpenAPI

````yaml /api-reference/ops/openapi.json post /api/v1/ops/trips/{tripId}/complete
openapi: 3.0.0
info:
  title: OABUS OPS API
  description: OABUS API
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /api/v1/ops/trips/{tripId}/complete:
    post:
      tags:
        - Trip
      summary: Complete Trip
      description: Completes a trip.
      operationId: completeTrip
      parameters:
        - name: tripId
          required: true
          in: path
          schema:
            type: string
            format: uuid
            description: Trip identifier
            example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
        - name: fields
          required: false
          in: query
          description: >-
            Comma-separated list of fields to include in the response. Supports
            dot notation for nested projection (e.g.
            `id,name,user.email,trips.route.id`). Unknown fields are silently
            dropped.
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/CompleteTrip200Response'
        '400':
          $ref: '#/components/responses/CompleteTrip400Response'
        '401':
          $ref: '#/components/responses/CompleteTrip401Response'
        '403':
          $ref: '#/components/responses/CompleteTrip403Response'
        '500':
          $ref: '#/components/responses/CompleteTrip500Response'
      security:
        - bearer: []
        - bearer: []
components:
  responses:
    CompleteTrip200Response:
      content:
        application/json:
          schema:
            type: object
            properties:
              tripId:
                type: string
                format: uuid
                description: Trip identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
              cooperativeId:
                type: string
                format: uuid
                description: Cooperative identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3b
              transportOperatorId:
                type: string
                format: uuid
                description: Transport operator identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
              tripScheduleId:
                description: Trip schedule identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3d
                nullable: true
                type: string
                format: uuid
              routeId:
                type: string
                format: uuid
                description: Route identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3e
              vehicleId:
                type: string
                format: uuid
                description: Vehicle identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3d
              driverId:
                type: string
                format: uuid
                description: Driver identifier
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3e
              status:
                type: string
                enum:
                  - SCHEDULED
                  - IN_PROGRESS
                  - COMPLETED
                  - CANCELLED
                description: Trip status
                example: SCHEDULED
              events:
                type: array
                items:
                  type: object
                  properties:
                    tripEventId:
                      type: string
                      format: uuid
                      description: Trip event identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                    tripId:
                      type: string
                      format: uuid
                      description: Trip identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3b
                    tripStopId:
                      description: Trip stop identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                      nullable: true
                      type: string
                      format: uuid
                    type:
                      type: string
                      enum:
                        - DRIVER_CHANGED
                        - VEHICLE_CHANGED
                        - DEPARTURE_DELAYED
                        - ARRIVAL_DELAYED
                        - BOARDING_STARTED
                        - BOARDING_COMPLETED
                        - INCIDENT
                      description: Trip event type
                      example: DEPARTURE_DELAYED
                    description:
                      description: Event description
                      example: Departure delayed by 15 minutes due to traffic
                      nullable: true
                      type: string
                    metadata:
                      description: Event metadata
                      nullable: true
                      type: object
                      additionalProperties: {}
                    createdBy:
                      description: Created by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    updatedBy:
                      description: Updated by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    createdAt:
                      type: string
                      format: date-time
                      description: Created at
                      example: '2026-01-01T00:00:00.000Z'
                    updatedAt:
                      type: string
                      format: date-time
                      description: Updated at
                      example: '2026-01-01T00:00:00.000Z'
                  required:
                    - tripEventId
                    - tripId
                    - type
                    - createdAt
                    - updatedAt
                  additionalProperties: false
                description: Trip events
              createdBy:
                description: Created by
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3e
                nullable: true
                type: string
                format: uuid
              updatedBy:
                description: Updated by
                example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3e
                nullable: true
                type: string
                format: uuid
              deletedBy:
                description: Deleted by
                example: null
                nullable: true
                type: string
                format: uuid
              departureAt:
                type: string
                format: date-time
                description: Departure time
                example: '2026-04-15T08:00:00.000Z'
              estimatedArrivalAt:
                type: string
                format: date-time
                description: Estimated arrival time
                example: '2026-04-15T14:00:00.000Z'
              stops:
                type: array
                items:
                  type: object
                  properties:
                    tripStopId:
                      type: string
                      format: uuid
                      description: Trip stop identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                    tripId:
                      type: string
                      format: uuid
                      description: Trip identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3b
                    pointId:
                      type: string
                      format: uuid
                      description: Point identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                    stopOrder:
                      type: integer
                      description: Stop sequence order
                      example: 1
                    createdBy:
                      description: Created by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    updatedBy:
                      description: Updated by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    arrivalAt:
                      description: Arrival time
                      example: '2026-04-15T10:00:00.000Z'
                      nullable: true
                      type: string
                      format: date-time
                    departureAt:
                      description: Departure time
                      example: '2026-04-15T10:15:00.000Z'
                      nullable: true
                      type: string
                      format: date-time
                    point:
                      type: object
                      properties:
                        description:
                          description: Additional description
                          example: Terminal Rodoviário Tietê
                          nullable: true
                          type: string
                        lat:
                          description: Latitude
                          example: -23.5155
                          nullable: true
                          type: number
                          minimum: -90
                          maximum: 90
                        lng:
                          description: Longitude
                          example: -46.6254
                          nullable: true
                          type: number
                          minimum: -180
                          maximum: 180
                        name:
                          type: string
                          description: Point name
                          example: São Paulo
                        pointId:
                          type: string
                          format: uuid
                          description: Point identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                      required:
                        - name
                        - pointId
                      additionalProperties: false
                      description: Stop point
                    createdAt:
                      type: string
                      format: date-time
                      description: Created at
                      example: '2026-01-01T00:00:00.000Z'
                    updatedAt:
                      type: string
                      format: date-time
                      description: Updated at
                      example: '2026-01-01T00:00:00.000Z'
                  required:
                    - tripStopId
                    - tripId
                    - pointId
                    - stopOrder
                    - point
                    - createdAt
                    - updatedAt
                  additionalProperties: false
                description: Trip stops
              itineraries:
                type: array
                items:
                  type: object
                  properties:
                    tripItineraryId:
                      type: string
                      format: uuid
                      description: Trip itinerary identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                    tripId:
                      type: string
                      format: uuid
                      description: Trip identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3b
                    fromStopId:
                      type: string
                      format: uuid
                      description: Origin stop identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                    toStopId:
                      type: string
                      format: uuid
                      description: Destination stop identifier
                      example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3d
                    price:
                      type: integer
                      description: Price in centavos
                      example: 15000
                    createdBy:
                      description: Created by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    updatedBy:
                      description: Updated by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    deletedBy:
                      description: Deleted by
                      example: null
                      nullable: true
                      type: string
                      format: uuid
                    fromStop:
                      type: object
                      properties:
                        tripStopId:
                          type: string
                          format: uuid
                          description: Trip stop identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                        tripId:
                          type: string
                          format: uuid
                          description: Trip identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3b
                        pointId:
                          type: string
                          format: uuid
                          description: Point identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                        stopOrder:
                          type: integer
                          description: Stop sequence order
                          example: 1
                        createdBy:
                          description: Created by
                          example: null
                          nullable: true
                          type: string
                          format: uuid
                        updatedBy:
                          description: Updated by
                          example: null
                          nullable: true
                          type: string
                          format: uuid
                        arrivalAt:
                          description: Arrival time
                          example: '2026-04-15T10:00:00.000Z'
                          nullable: true
                          type: string
                          format: date-time
                        departureAt:
                          description: Departure time
                          example: '2026-04-15T10:15:00.000Z'
                          nullable: true
                          type: string
                          format: date-time
                        point:
                          type: object
                          properties:
                            description:
                              description: Additional description
                              example: Terminal Rodoviário Tietê
                              nullable: true
                              type: string
                            lat:
                              description: Latitude
                              example: -23.5155
                              nullable: true
                              type: number
                              minimum: -90
                              maximum: 90
                            lng:
                              description: Longitude
                              example: -46.6254
                              nullable: true
                              type: number
                              minimum: -180
                              maximum: 180
                            name:
                              type: string
                              description: Point name
                              example: São Paulo
                            pointId:
                              type: string
                              format: uuid
                              description: Point identifier
                              example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                          required:
                            - name
                            - pointId
                          additionalProperties: false
                          description: Stop point
                        createdAt:
                          type: string
                          format: date-time
                          description: Created at
                          example: '2026-01-01T00:00:00.000Z'
                        updatedAt:
                          type: string
                          format: date-time
                          description: Updated at
                          example: '2026-01-01T00:00:00.000Z'
                      required:
                        - tripStopId
                        - tripId
                        - pointId
                        - stopOrder
                        - point
                        - createdAt
                        - updatedAt
                      additionalProperties: false
                      description: Origin stop
                    toStop:
                      type: object
                      properties:
                        tripStopId:
                          type: string
                          format: uuid
                          description: Trip stop identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                        tripId:
                          type: string
                          format: uuid
                          description: Trip identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3b
                        pointId:
                          type: string
                          format: uuid
                          description: Point identifier
                          example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3c
                        stopOrder:
                          type: integer
                          description: Stop sequence order
                          example: 1
                        createdBy:
                          description: Created by
                          example: null
                          nullable: true
                          type: string
                          format: uuid
                        updatedBy:
                          description: Updated by
                          example: null
                          nullable: true
                          type: string
                          format: uuid
                        arrivalAt:
                          description: Arrival time
                          example: '2026-04-15T10:00:00.000Z'
                          nullable: true
                          type: string
                          format: date-time
                        departureAt:
                          description: Departure time
                          example: '2026-04-15T10:15:00.000Z'
                          nullable: true
                          type: string
                          format: date-time
                        point:
                          type: object
                          properties:
                            description:
                              description: Additional description
                              example: Terminal Rodoviário Tietê
                              nullable: true
                              type: string
                            lat:
                              description: Latitude
                              example: -23.5155
                              nullable: true
                              type: number
                              minimum: -90
                              maximum: 90
                            lng:
                              description: Longitude
                              example: -46.6254
                              nullable: true
                              type: number
                              minimum: -180
                              maximum: 180
                            name:
                              type: string
                              description: Point name
                              example: São Paulo
                            pointId:
                              type: string
                              format: uuid
                              description: Point identifier
                              example: 0195e7a1-8b5c-7d3e-9f4a-2c6b8d0e1f3a
                          required:
                            - name
                            - pointId
                          additionalProperties: false
                          description: Stop point
                        createdAt:
                          type: string
                          format: date-time
                          description: Created at
                          example: '2026-01-01T00:00:00.000Z'
                        updatedAt:
                          type: string
                          format: date-time
                          description: Updated at
                          example: '2026-01-01T00:00:00.000Z'
                      required:
                        - tripStopId
                        - tripId
                        - pointId
                        - stopOrder
                        - point
                        - createdAt
                        - updatedAt
                      additionalProperties: false
                      description: Destination stop
                    createdAt:
                      type: string
                      format: date-time
                      description: Created at
                      example: '2026-01-01T00:00:00.000Z'
                    updatedAt:
                      type: string
                      format: date-time
                      description: Updated at
                      example: '2026-01-01T00:00:00.000Z'
                  required:
                    - tripItineraryId
                    - tripId
                    - fromStopId
                    - toStopId
                    - price
                    - fromStop
                    - toStop
                    - createdAt
                    - updatedAt
                  additionalProperties: false
                description: Trip itineraries
              createdAt:
                type: string
                format: date-time
                description: Created at
                example: '2026-01-01T00:00:00.000Z'
              updatedAt:
                type: string
                format: date-time
                description: Updated at
                example: '2026-01-01T00:00:00.000Z'
            required:
              - tripId
              - cooperativeId
              - transportOperatorId
              - routeId
              - vehicleId
              - driverId
              - status
              - events
              - departureAt
              - estimatedArrivalAt
              - stops
              - itineraries
              - createdAt
              - updatedAt
            additionalProperties: false
            description: Trip
      description: OK
    CompleteTrip400Response:
      content:
        application/json:
          example:
            errors:
              - message: required
                path: name
            message: Bad Request Error
            statusCode: 400
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 400
                type: number
              errors:
                items:
                  properties:
                    message:
                      type: string
                    path:
                      type: string
                  required:
                    - message
                    - path
                  type: object
                type: array
            required:
              - message
              - statusCode
            type: object
      description: Bad Request Error
    CompleteTrip401Response:
      content:
        application/json:
          example:
            message: Missing or invalid access token
            statusCode: 401
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 401
                type: number
            required:
              - message
              - statusCode
            type: object
      description: Unauthorized
    CompleteTrip403Response:
      content:
        application/json:
          example:
            message: Insufficient permissions
            statusCode: 403
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 403
                type: number
            required:
              - message
              - statusCode
            type: object
      description: Forbidden
    CompleteTrip500Response:
      content:
        application/json:
          example:
            message: Internal Server Error
            statusCode: 500
          schema:
            properties:
              message:
                type: string
              statusCode:
                enum:
                  - 500
                type: number
            required:
              - message
              - statusCode
            type: object
      description: Internal Server Error
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````