> ## 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.

# Create Trip Event

> Records an event.



## OpenAPI

````yaml /api-reference/driver/openapi.json post /api/v1/driver/trips/{tripId}/events
openapi: 3.0.0
info:
  title: DEVMOB Driver API
  description: DEVMOB API
  version: '1.0'
  contact: {}
servers: []
security: []
tags:
  - name: Auth
    description: Authentication and token lifecycle
  - name: Invite
    description: Driver invitation preview and acceptance
  - name: Notification
    description: Driver inbox notifications
  - name: OTP
    description: One-time password flows
  - name: Profile
    description: Authenticated driver profile
  - name: Session
    description: Authenticated sessions
  - name: Storage
    description: Storage uploads
  - name: Trip
    description: Driver trips
  - name: Trip Boarding
    description: Ticket boarding
  - name: Trip Event
    description: Trip operational events
  - name: Trip Manifest
    description: Trip passenger manifest
  - name: Trip Tracking
    description: Driver GPS tracking
paths:
  /api/v1/driver/trips/{tripId}/events:
    post:
      tags:
        - Trip Event
      summary: Create Trip Event
      description: Records an event.
      operationId: createDriverTripEvent
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTripEventRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TripEvent'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '409':
          $ref: '#/components/responses/ConflictError'
        '422':
          $ref: '#/components/responses/UnprocessableEntityError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearer: []
components:
  schemas:
    CreateTripEventRequest:
      type: object
      properties:
        tripStopId:
          type: string
          format: uuid
          description: Trip stop identifier.
          example: 0197a810-0e84-773d-acf5-4b2e048d513a
          nullable: true
        type:
          type: string
          enum:
            - DRIVER_CHANGED
            - VEHICLE_CHANGED
            - DEPARTURE_DELAYED
            - ARRIVAL_DELAYED
            - BOARDING_STARTED
            - BOARDING_COMPLETED
            - INCIDENT
          description: Trip event type.
          example: BOARDING_STARTED
        description:
          type: string
          description: Event description.
          example: Boarding started at Sao Paulo.
          nullable: true
        metadata:
          type: object
          additionalProperties: true
          description: Event metadata.
          nullable: true
          example:
            stopName: Sao Paulo
      required:
        - type
      description: Create trip event payload.
    TripEvent:
      type: object
      properties:
        tripEventId:
          type: string
          format: uuid
          description: Identificador único
        tripId:
          type: string
          format: uuid
          description: Referência à viagem
        tripStopId:
          type: string
          format: uuid
          nullable: true
          description: Referência à parada específica relacionada a TripStop, opcional
        type:
          type: string
          enum:
            - DRIVER_CHANGED
            - VEHICLE_CHANGED
            - DEPARTURE_DELAYED
            - ARRIVAL_DELAYED
            - BOARDING_STARTED
            - BOARDING_COMPLETED
            - INCIDENT
          description: Tipo do evento
        description:
          type: string
          nullable: true
          description: Descrição adicional do evento
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: Dados adicionais estruturados
        createdBy:
          type: string
          format: uuid
          nullable: true
          description: Usuário que criou o registro, quando aplicável
        createdAt:
          type: string
          format: date-time
          description: Data de criação
        updatedBy:
          type: string
          format: uuid
          nullable: true
          description: Usuário que fez a última atualização, quando aplicável
        updatedAt:
          type: string
          format: date-time
          description: Data da última atualização
      required:
        - tripEventId
        - tripId
        - tripStopId
        - type
        - description
        - metadata
        - createdBy
        - createdAt
        - updatedBy
        - updatedAt
      description: Eventos operacionais registrados durante uma viagem
    ValidationError:
      type: object
      properties:
        statusCode:
          type: integer
          description: HTTP status code.
          example: 400
        message:
          type: string
          description: Error message.
          example: Bad Request Error
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: Validation code.
                example: invalid_type
              message:
                type: string
                description: Validation message.
                example: Required
              path:
                type: string
                description: Invalid field path.
                example: name
            required:
              - code
              - message
              - path
      required:
        - statusCode
        - message
        - errors
      description: Validation error response.
    ApiError:
      type: object
      properties:
        statusCode:
          type: integer
          description: HTTP status code.
          example: 404
        error:
          type: string
          description: HTTP error name.
          example: Not Found
        message:
          type: string
          description: Machine-readable error code.
          example: resource.not_found
      required:
        - statusCode
        - error
        - message
      description: Domain error response.
  responses:
    BadRequestError:
      description: Validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    UnauthorizedError:
      description: Authentication required.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFoundError:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ConflictError:
      description: State conflict.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    UnprocessableEntityError:
      description: Business rule violation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````