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

# Update trip

> Partially updates a trip. Only provided fields will be updated.



## OpenAPI

````yaml patch /v1/businesses/{businessId}/mileage/trips/{tripId}
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/mileage/trips/{tripId}:
    patch:
      tags: []
      summary: Update trip
      description: Partially updates a trip. Only provided fields will be updated.
      operationId: business.mileage.trips.tripId.patch
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business
          required: true
          schema:
            type: string
            format: uuid
        - name: tripId
          in: path
          description: The UUID of the trip
          required: true
          schema:
            type: string
            format: uuid
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchTripParams'
      responses:
        '200':
          description: The updated trip
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTrip'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Business or trip not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    PatchTripParams:
      type: object
      properties:
        vehicle_id:
          type: string
          format: uuid
          description: The UUID of the vehicle used for this trip
        external_id:
          type: string
          nullable: true
          description: An optional external identifier for the trip
        distance:
          type: string
          description: The distance traveled in miles, as a decimal string
        trip_date:
          type: string
          format: date
          description: The date of the trip (YYYY-MM-DD)
        purpose:
          $ref: '#/components/schemas/TripPurpose'
          description: The purpose classification of the trip
        start_address:
          type: string
          nullable: true
          description: The starting address of the trip
        end_address:
          type: string
          nullable: true
          description: The ending address of the trip
        description:
          type: string
          nullable: true
          description: An optional description or notes about the trip
      description: All fields are optional. Only provided fields will be updated.
    ApiTrip:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the trip
        vehicle:
          $ref: '#/components/schemas/ApiVehicle'
          description: The vehicle used for this trip
        external_id:
          type: string
          nullable: true
          description: An optional external identifier for the trip, used for idempotency
        distance:
          type: string
          description: The distance traveled in miles, as a decimal string
        trip_date:
          type: string
          format: date
          description: The date of the trip (YYYY-MM-DD)
        purpose:
          $ref: '#/components/schemas/TripPurpose'
          description: The purpose classification of the trip
        start_address:
          type: string
          nullable: true
          description: The starting address of the trip
        end_address:
          type: string
          nullable: true
          description: The ending address of the trip
        description:
          type: string
          nullable: true
          description: An optional description or notes about the trip
        mileage_deduction_rate:
          type: string
          description: >-
            The IRS standard mileage rate in cents per mile applicable for the
            trip date
        estimated_deduction:
          type: integer
          format: int64
          description: >-
            The estimated tax deduction in cents. Only calculated for BUSINESS
            trips; returns 0 for PERSONAL and UNREVIEWED trips.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the trip was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the trip was last updated
        deleted_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the trip was deleted, or null if not deleted
      required:
        - id
        - vehicle
        - distance
        - trip_date
        - purpose
        - mileage_deduction_rate
        - estimated_deduction
        - created_at
        - updated_at
    ApiError:
      type: object
      properties: {}
      example: ''
      description: ''
    TripPurpose:
      type: string
      enum:
        - UNREVIEWED
        - BUSINESS
        - PERSONAL
      description: >-
        The purpose classification of a trip. UNREVIEWED indicates the trip has
        not been categorized yet, BUSINESS indicates a business-related trip
        eligible for mileage deduction, and PERSONAL indicates a personal trip
        not eligible for deduction.
    ApiVehicle:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the vehicle
        business_id:
          type: string
          format: uuid
          description: The UUID of the business this vehicle belongs to
        external_id:
          type: string
          nullable: true
          description: >-
            An optional external identifier for the vehicle, used for
            idempotency
        make_and_model:
          type: string
          description: The make and model of the vehicle (e.g., 'Toyota Camry')
        year:
          type: integer
          description: The model year of the vehicle
        license_plate:
          type: string
          nullable: true
          description: The license plate number of the vehicle
        vin:
          type: string
          nullable: true
          description: The Vehicle Identification Number (VIN)
        description:
          type: string
          nullable: true
          description: An optional description or notes about the vehicle
        is_primary:
          type: boolean
          description: >-
            Whether this is the primary vehicle for the business. Only one
            vehicle can be primary at a time.
        is_eligible_for_deletion:
          type: boolean
          description: >-
            Whether the vehicle can be deleted. A vehicle cannot be deleted if
            it has trips or is archived.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the vehicle was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the vehicle was last updated
        archived_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the vehicle was archived, or null if not archived
        deleted_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the vehicle was deleted, or null if not deleted
      required:
        - id
        - business_id
        - make_and_model
        - year
        - is_primary
        - is_eligible_for_deletion
        - created_at
        - updated_at
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````