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

# Save mileage

> Save new (or update existing) mileage records



## OpenAPI

````yaml https://dev.tight.com/v3/api-docs post /v6/mileage
openapi: 3.0.1
info:
  title: Tight API
  contact:
    name: Hurdlr, Inc. (dba Tight)
    url: https://www.tight.com
    email: api@tight.com
  version: 6.0.0
servers:
  - url: https://sandbox.tight.com
    description: Staging Environment
  - url: https://prod.tight.com
    description: Production Environment
security:
  - EmbedToken: []
paths:
  /v6/mileage:
    post:
      tags:
        - Mileage
      summary: Save mileage
      description: Save new (or update existing) mileage records
      operationId: postMileage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MultiParamMileagePostDto'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseListMultiResponseMileageGetDto'
        '207':
          description: >-
            Some mileage records failed to save. See response body for error
            details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseListMultiResponseMileageGetDto'
        '400':
          description: All mileage records failed to save.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseListMultiResponseMileageGetDto'
        '401':
          description: Not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: INVALID_TOKEN
                    message: Invalid access token
        '403':
          description: Not authorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: FORBIDDEN
                    message: Expired access token
        '404':
          description: Endpoint not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: BAD_REQUEST
                    message: Resource not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: UNKNOWN_ERROR
                    message: Something went wrong. Please try again later.
      security:
        - EmbedToken: []
components:
  schemas:
    MultiParamMileagePostDto:
      required:
        - data
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MileagePostDto'
    ResponseListMultiResponseMileageGetDto:
      type: object
      properties:
        result:
          type: string
          description: The result of the action performed.
          enum:
            - SUCCESS
            - FAILURE
        data:
          type: array
          description: The data generated by the action performed.
          items:
            $ref: '#/components/schemas/MultiResponseMileageGetDto'
        error:
          type: array
          items:
            $ref: '#/components/schemas/ErrorItem'
    ErrorResponse:
      type: object
      properties:
        result:
          type: string
          description: The result of the action performed.
          enum:
            - SUCCESS
            - FAILURE
        data:
          type: object
          description: The data generated by the action performed.
          nullable: true
        error:
          type: array
          items:
            $ref: '#/components/schemas/ErrorItem'
    MileagePostDto:
      type: object
      properties:
        id:
          type: string
          description: >-
            Id of the mileage record, required when updating an existing mileage
            record
          example: mlg_12345
        date:
          type: string
          description: Date of the mileage record
          format: date
          nullable: false
          example: '2024-03-15'
        status:
          type: string
          description: Status of the mileage record
          nullable: false
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - REMOVED
        mileageStatus:
          type: string
          description: Trip classification status of the mileage record
          nullable: false
          example: BUSINESS
          enum:
            - PENDING
            - BUSINESS
            - PERSONAL
        description:
          type: string
          description: Description of the mileage trip
          nullable: false
          example: Drive to client meeting
        notes:
          type: string
          description: Notes for the mileage record
          nullable: false
          example: Client was not available
        customerId:
          type: string
          description: Id of the customer assigned to this mileage record
          nullable: true
          example: cus_4852707
        dimensionValueIds:
          type: array
          nullable: true
          items:
            type: string
        distance:
          $ref: '#/components/schemas/MileageDistancePostDto'
        start:
          $ref: '#/components/schemas/MileageLocationPostDto'
        end:
          $ref: '#/components/schemas/MileageLocationPostDto'
        duration:
          type: integer
          description: The duration of this mileage, in milliseconds
          format: int32
          nullable: false
          example: 3600000
        deduction:
          $ref: '#/components/schemas/MileageDeductionPostDto'
        carId:
          type: string
          description: Id of the car associated with this mileage record
          nullable: true
          example: car_28868401
        customData:
          $ref: '#/components/schemas/JsonNode'
    MultiResponseMileageGetDto:
      type: object
      properties:
        result:
          type: string
          description: The result of the action performed.
          enum:
            - SUCCESS
            - FAILURE
        statusCode:
          $ref: '#/components/schemas/HttpStatus'
        data:
          $ref: '#/components/schemas/MileageGetDto'
        error:
          type: array
          items:
            $ref: '#/components/schemas/ErrorItem'
      description: The data generated by the action performed.
    ErrorItem:
      type: object
      properties:
        type:
          type: string
          description: The type of the error. Safe for programmatic use.
          enum:
            - UNKNOWN_ERROR
            - INVALID_TOKEN
            - EXPIRED_TOKEN
            - FORBIDDEN
            - BAD_REQUEST
            - JSON_ERROR
            - DUPLICATE
            - REQUIRED
            - INVALID_VALUE
            - NOT_MODIFIABLE
            - INVALID_FORMAT
            - NOT_FOUND
        message:
          type: string
          description: >-
            A human-readable message providing more details about the error.
            Safe for displaying to a user.
        param:
          type: string
          description: >-
            If the error is parameter-specific, the parameter related to the
            error. This can be used to display a message near the correct form
            field.
      description: Errors associated with the action performed, if applicable.
    MileageDistancePostDto:
      type: object
      properties:
        type:
          type: string
          description: The unit of distance
          example: MILE
          enum:
            - MILE
            - KILOMETER
        value:
          type: string
          description: The distance value
          example: '12.5'
      description: Distance of the mileage trip
      nullable: false
    MileageLocationPostDto:
      type: object
      properties:
        time:
          type: string
          description: The time of the location point
          format: date-time
        lat:
          type: string
          description: The latitude of the location point
          example: '38.8977'
        lng:
          type: string
          description: The longitude of the location point
          example: '-77.0365'
        locationId:
          type: string
          description: >-
            Id of the favorite location associated with this mileage location
            point
          nullable: true
          example: loc_28868401
        address:
          $ref: '#/components/schemas/AddressPostDto'
      description: End location of the mileage trip
      nullable: false
    MileageDeductionPostDto:
      type: object
      properties:
        amount:
          type: integer
          description: The deduction amount in cents
          format: int32
          example: 6775
      description: Tax deduction associated with this mileage record
      nullable: false
    JsonNode:
      type: object
      properties:
        empty:
          type: boolean
        array:
          type: boolean
        'null':
          type: boolean
        object:
          type: boolean
        float:
          type: boolean
        string:
          type: boolean
        number:
          type: boolean
        missingNode:
          type: boolean
        valueNode:
          type: boolean
        nodeType:
          type: string
          enum:
            - ARRAY
            - BINARY
            - BOOLEAN
            - MISSING
            - 'NULL'
            - NUMBER
            - OBJECT
            - POJO
            - STRING
        pojo:
          type: boolean
        integralNumber:
          type: boolean
        floatingPointNumber:
          type: boolean
        short:
          type: boolean
        int:
          type: boolean
        long:
          type: boolean
        double:
          type: boolean
        bigDecimal:
          type: boolean
        bigInteger:
          type: boolean
        textual:
          type: boolean
          deprecated: true
        boolean:
          type: boolean
        binary:
          type: boolean
        container:
          type: boolean
        embeddedValue:
          type: boolean
      description: >-
        Custom JSON in which you can store any data with max length of 2000
        characters
      nullable: true
      example:
        internal_key: some_internal_key
        some_other_field: 23434
    HttpStatus:
      type: integer
      description: The HTTP status code for the action performed.
      format: int32
      enum:
        - 200
        - 400
        - 401
        - 403
        - 404
        - 500
    MileageGetDto:
      required:
        - car
        - customer
        - date
        - deduction
        - description
        - dimensionValues
        - distance
        - duration
        - end
        - id
        - mileageStatus
        - notes
        - route
        - start
        - status
      type: object
      properties:
        id:
          type: string
          description: Id of the mileage record
          example: mlg_12345
        date:
          type: string
          description: Date of the mileage record
          format: date
          example: '2024-03-15'
        status:
          type: string
          description: Status of the mileage record
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - REMOVED
        mileageStatus:
          type: string
          description: Trip classification status of the mileage record
          example: BUSINESS
          enum:
            - PENDING
            - BUSINESS
            - PERSONAL
        description:
          type: string
          description: Description of the mileage trip
          nullable: true
          example: Drive to client meeting
        notes:
          type: string
          description: Notes for the mileage record
          nullable: true
          example: Client was not available
        customer:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/CustomerExpanded'
        dimensionValues:
          type: array
          items:
            $ref: '#/components/schemas/DimensionValueExpanded'
        distance:
          $ref: '#/components/schemas/MileageDistanceGetDto'
        start:
          $ref: '#/components/schemas/MileageLocationGetDto'
        end:
          $ref: '#/components/schemas/MileageLocationGetDto'
        duration:
          type: integer
          description: The duration of this mileage, in milliseconds
          format: int32
          example: 3600000
        deduction:
          $ref: '#/components/schemas/MileageDeductionGetDto'
        route:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/RouteExpanded'
        car:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/CarExpanded'
        customData:
          $ref: '#/components/schemas/JsonNode'
      description: The data generated by the action performed.
    AddressPostDto:
      type: object
      properties:
        state:
          type: string
          description: State/Province of the address
          nullable: false
        city:
          type: string
          description: City of the address
          nullable: false
        zip:
          type: string
          description: Zip/Postal code of the address
          nullable: false
        phoneWork:
          type: string
          description: The US/CA phone number in E.164 format (e.g., +14155551234)
          nullable: false
        address1:
          type: string
          description: First line of the address
          nullable: false
        address2:
          type: string
          description: Second line of the address
          nullable: false
      description: Address of the vendor
      nullable: false
    CustomerExpanded:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: Id of the customer
          example: cus_4852707
        name:
          type: string
          description: Name of the customer
          example: Abigail Adams
        email:
          type: string
          description: Email of the customer
          example: abigail@tight.com
      description: Customer associated with this time entry
      nullable: true
    DimensionValueExpanded:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: Id of the dimension value
          example: dv_593051
        dimension:
          $ref: '#/components/schemas/DimensionExpanded'
        name:
          type: string
          description: Name of the dimension value
          example: Mid-Atlantic
        child:
          $ref: '#/components/schemas/ChildDimensionValue'
      description: List of dimension values associated with this time entry
    MileageDistanceGetDto:
      required:
        - type
        - value
      type: object
      properties:
        type:
          type: string
          description: The unit of distance
          example: MILE
          enum:
            - MILE
            - KILOMETER
        value:
          type: string
          description: The distance value
          example: '12.5'
      description: Distance of the mileage trip
      nullable: true
    MileageLocationGetDto:
      required:
        - address
        - lat
        - lng
        - location
        - time
      type: object
      properties:
        time:
          type: string
          description: The time of the location point
          format: date-time
        lat:
          type: string
          description: The latitude of the location point
          example: '38.8977'
        lng:
          type: string
          description: The longitude of the location point
          example: '-77.0365'
        location:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/LocationExpanded'
        address:
          $ref: '#/components/schemas/AddressGetDto'
      description: End location of the mileage trip
      nullable: true
    MileageDeductionGetDto:
      required:
        - amount
      type: object
      properties:
        amount:
          type: integer
          description: The deduction amount in cents
          format: int32
          example: 6775
      description: Tax deduction associated with this mileage record
      nullable: true
    RouteExpanded:
      required:
        - id
        - waypoints
      type: object
      properties:
        id:
          type: string
          description: Id of the route
          example: mrt_12345
        waypoints:
          type: array
          items:
            $ref: '#/components/schemas/WaypointGetDto'
      description: Route associated with this mileage record
      nullable: true
    CarExpanded:
      required:
        - id
        - make
        - model
        - name
      type: object
      properties:
        id:
          type: string
          description: Id of the car
          example: car_28868401
        name:
          type: string
          description: Name of the car
          nullable: true
          example: My Toyota Camry
        make:
          type: string
          description: Make of the car
          nullable: true
          example: Toyota
        model:
          type: string
          description: Model of the car
          nullable: true
          example: Camry
      description: Car associated with this mileage record
      nullable: true
    DimensionExpanded:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: Id of the dimension
          example: dim_4521
        name:
          type: string
          description: Name of the dimension
          example: Region
        requiredness:
          type: string
          description: Requiredness of the dimension
          example: NOT_REQUIRED
          enum:
            - REQUIRED
            - NOT_REQUIRED
      description: Dimension for this dimension value
    ChildDimensionValue:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: Id of the dimension value
          example: dv_593052
        dimension:
          $ref: '#/components/schemas/DimensionExpanded'
        name:
          type: string
          description: Name of the dimension value
          example: Washington DC
        child:
          $ref: '#/components/schemas/ChildDimensionValue'
      description: Child dimension value, if applicable
    LocationExpanded:
      required:
        - id
        - name
      type: object
      properties:
        id:
          type: string
          description: Id of the location
          example: loc_28868401
        name:
          type: string
          description: Name of the location
          example: Home Office
      description: Favorite location associated with this mileage location point
      nullable: true
    AddressGetDto:
      type: object
      properties:
        countryCode:
          type: string
          description: Country Code of the address
          example: USA
          enum:
            - USA
            - CAN
            - GBR
        state:
          type: string
          description: State/Province of the address
        city:
          type: string
          description: City of the address
        zip:
          type: string
          description: Zip/Postal code of the address
        phoneWork:
          type: string
          description: The phone number
        address1:
          type: string
          description: First line of the address
        address2:
          type: string
          description: Second line of the address
      description: Address of the vendor
      nullable: true
    WaypointGetDto:
      required:
        - lat
        - lng
      type: object
      properties:
        lat:
          type: string
          description: The latitude of the waypoint
          example: '38.8977'
        lng:
          type: string
          description: The longitude of the waypoint
          example: '-77.0365'
      description: Ordered list of waypoints defining the route
  securitySchemes:
    EmbedToken:
      type: http
      description: >-
        Bearer authentication header of the form `Bearer <token>`, see
        [Authentication for more
        detail](/api-reference/authentication#partner-level-authentication).
      scheme: bearer

````