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

# Get User Drives

> Retrieve a paginated list of drives for a specific user, ordered by last modification date (most recent first). Supports filtering by drive classification (business, personal, or all) and date ranges. Note: The 'created' field represents when the drive was recorded in the system, while 'started_at' and 'ended_at' indicate the actual drive times. Users can only access their own drive data. Returns comprehensive drive information including locations, distance, value calculations, and metadata.



## OpenAPI

````yaml https://external-api.mileiq.com/openapi.json get /v1/users/{user_id}/drives
openapi: 3.1.0
info:
  title: MileIQ External API
  description: External API for integrating with the MileIQ Platform.
  termsOfService: https://mileiq.com/terms
  contact:
    name: MileIQ
    url: https://developer.mileiq.com/
    email: support@mileiq.com
  version: 1.4.0
servers:
  - url: https://external-api.mileiq.com
    description: MileIQ External API
security: []
paths:
  /v1/users/{user_id}/drives:
    get:
      tags:
        - users
      summary: Get User Drives
      description: >-
        Retrieve a paginated list of drives for a specific user, ordered by last
        modification date (most recent first). Supports filtering by drive
        classification (business, personal, or all) and date ranges. Note: The
        'created' field represents when the drive was recorded in the system,
        while 'started_at' and 'ended_at' indicate the actual drive times. Users
        can only access their own drive data. Returns comprehensive drive
        information including locations, distance, value calculations, and
        metadata.
      operationId: get_user_drives
      parameters:
        - name: classification
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/DriveClassificationFilter'
            description: Drive classification
            default: business
          description: Drive classification
          example: business
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            exclusiveMinimum: 0
            description: The number of drives to retrieve
            default: 100
            title: Limit
          description: The number of drives to retrieve
          example: '50'
        - name: date_before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: >-
              The end date of the range to retrieve drives for based on the
              defined filter_by param (exclusive). Filter_by needs to be set for
              this field to be used. Should be in UTC
            title: Date Before
          description: >-
            The end date of the range to retrieve drives for based on the
            defined filter_by param (exclusive). Filter_by needs to be set for
            this field to be used. Should be in UTC
          example: '2024-05-05T16:01:07Z'
        - name: date_after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: >-
              The start date of the range to retrieve drives for based on the
              defined filter_by param (exclusive). Filter_by needs to be set for
              this field to be used. Should be in UTC
            title: Date After
          description: >-
            The start date of the range to retrieve drives for based on the
            defined filter_by param (exclusive). Filter_by needs to be set for
            this field to be used. Should be in UTC
          example: '2024-05-05T16:01:07Z'
        - name: filter_by
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/GetDrivesRequestFilterBy'
              - type: 'null'
            description: >-
              Use 'ended' to filter by the date the drive has ended. Use
              'modified' to filter by the date the drive was last updated
            title: Filter By
          description: >-
            Use 'ended' to filter by the date the drive has ended. Use
            'modified' to filter by the date the drive was last updated
        - name: modified_before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: >-
              The end date of the range to retrieve drives for (exclusive). If
              the drive was reviewed by an admin, this will be the last review
              date. If not, this will be the same as the date it was reported.
              [DEPRECATED] Use [date_before, date_after] + filter_by instead
            title: Modified Before
          description: >-
            The end date of the range to retrieve drives for (exclusive). If the
            drive was reviewed by an admin, this will be the last review date.
            If not, this will be the same as the date it was reported.
            [DEPRECATED] Use [date_before, date_after] + filter_by instead
          example: '2024-05-12T16:01:07Z'
        - name: modified_after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: >-
              The start date of the range to retrieve drives for (exclusive). If
              the drive was reviewed by an admin, this will be the last review
              date. If not, this will be the same as the date it was reported.
              [DEPRECATED] Use [date_before, date_after] + filter_by instead
            title: Modified After
          description: >-
            The start date of the range to retrieve drives for (exclusive). If
            the drive was reviewed by an admin, this will be the last review
            date. If not, this will be the same as the date it was reported.
            [DEPRECATED] Use [date_before, date_after] + filter_by instead
          example: '2024-05-05T16:01:07Z'
        - name: Authorization
          in: header
          required: false
          schema:
            type: string
            title: Authorization
      responses:
        '200':
          description: >-
            Successfully retrieved user drives. Returns paginated list of drives
            with complete details including locations, distance calculations,
            monetary values, and trip metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDrivesResponse'
        '400':
          description: >-
            Bad request. Invalid query parameters such as limit exceeding
            maximum allowed value, invalid date format, or unsupported
            classification filter.
        '401':
          description: Authentication failed. Invalid or missing authorization token.
        '403':
          description: >-
            Insufficient permissions. User does not have the required drive read
            scopes, is not authenticated, or is attempting to access another
            user's drives.
        '404':
          description: >-
            User not found. The specified user ID does not exist or is not
            accessible.
        '422':
          description: >-
            Validation error. Invalid user ID format or malformed query
            parameters.
        '429':
          description: Rate limit exceeded. Maximum 20 requests per minute allowed.
        '500':
          description: >-
            Internal server error. An unexpected error occurred while processing
            the request.
components:
  schemas:
    DriveClassificationFilter:
      type: string
      enum:
        - business
        - personal
        - all
      title: DriveClassificationFilter
    GetDrivesRequestFilterBy:
      type: string
      enum:
        - modified
        - ended
      title: GetDrivesRequestFilterBy
    GetDrivesResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/DriveSchema'
          type: array
          title: Results
          description: >-
            Array of drive objects containing comprehensive trip information
            including locations, distances, values, and metadata
        has_more:
          type: boolean
          title: Has More
          description: >-
            Pagination indicator - true if additional drives exist beyond the
            current result set within the specified filters and date range
      type: object
      required:
        - results
        - has_more
      title: GetDrivesResponse
    DriveSchema:
      properties:
        distance:
          anyOf:
            - $ref: '#/components/schemas/Distance'
            - $ref: '#/components/schemas/DistanceWithDiscount'
            - type: 'null'
          title: Distance
          description: The distance of the drive
        value:
          anyOf:
            - $ref: '#/components/schemas/Value'
            - type: 'null'
          description: The value of the drive
        toll_fees:
          anyOf:
            - $ref: '#/components/schemas/Value'
            - type: 'null'
          description: The toll fees of the drive
        parking_fees:
          anyOf:
            - $ref: '#/components/schemas/Value'
            - type: 'null'
          description: The parking fees of the drive
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: The description of the drive from the driver notes
        entry:
          $ref: '#/components/schemas/DriveEntry'
          description: The entry method of the drive
        classification:
          anyOf:
            - $ref: '#/components/schemas/DriveClassification'
            - type: 'null'
          description: The classification of the drive
        purpose:
          anyOf:
            - type: string
            - type: 'null'
          title: Purpose
          description: The purpose of the drive
        start:
          anyOf:
            - $ref: '#/components/schemas/Geolocation'
            - type: 'null'
          description: The start location of the drive
        end:
          anyOf:
            - $ref: '#/components/schemas/Geolocation'
            - type: 'null'
          description: The end location of the drive
        drive_id:
          type: integer
          title: Drive Id
          description: The ID of the drive
        created:
          type: string
          format: date-time
          title: Created
          description: The time in which the drive was reported. In ISO 8601 format
        modified:
          type: string
          format: date-time
          title: Modified
          description: >-
            The last time the drive was reviewed. If it was not reviewed, should
            be the same as created.In ISO 8601 format
        started_at:
          type: string
          format: date-time
          title: Started At
          description: The start time for the drive in ISO 8601 format
        ended_at:
          type: string
          format: date-time
          title: Ended At
          description: The end time for the drive in ISO 8601 format
      type: object
      required:
        - distance
        - value
        - toll_fees
        - parking_fees
        - description
        - entry
        - classification
        - purpose
        - start
        - end
        - drive_id
        - created
        - modified
        - started_at
        - ended_at
      title: DriveSchema
      description: Represents a single drive (trip) with all its details.
    Distance:
      properties:
        amount:
          type: number
          title: Amount
          description: The amount of the distance, in the specified units
        units:
          $ref: '#/components/schemas/DistanceUnits'
          description: The units of the distance
      type: object
      required:
        - amount
        - units
      title: Distance
      description: Represent the distance for a drive
    DistanceWithDiscount:
      properties:
        amount:
          type: number
          title: Amount
          description: The amount of the distance, in the specified units
        units:
          $ref: '#/components/schemas/DistanceUnits'
          description: The units of the distance
        discounted:
          anyOf:
            - type: integer
            - type: 'null'
          title: Discounted
          description: The discounted amount of the distance, in the specified units
      type: object
      required:
        - amount
        - units
      title: DistanceWithDiscount
      description: >-
        Represent the distance for a drive, with a discounted value set by the
        team
    Value:
      properties:
        amount:
          type: integer
          title: Amount
          description: The amount of the value, in the smallest unit of currency
        currency:
          $ref: '#/components/schemas/Currency'
          description: The currency of the value, in ISO 4217 format
      type: object
      required:
        - amount
        - currency
      title: Value
      description: Represent the value of a drive (excluding toll & parking fees)
    DriveEntry:
      type: string
      enum:
        - manual
        - automatic
      title: DriveEntry
      description: Whether the drive was entered manually or automatically
    DriveClassification:
      type: string
      enum:
        - business
        - personal
        - unclassified
      title: DriveClassification
      description: Drive classifications
    Geolocation:
      properties:
        name:
          type: string
          title: Name
          description: The name of the location
        lat:
          anyOf:
            - type: string
            - type: 'null'
          title: Lat
          description: The latitude of the location
        lon:
          anyOf:
            - type: string
            - type: 'null'
          title: Lon
          description: The longitude of the location
        time:
          type: string
          format: date-time
          title: Time
          description: The time in ISO 8601 format
        address:
          anyOf:
            - $ref: '#/components/schemas/Address'
            - type: 'null'
          description: The address of the location
      type: object
      required:
        - name
        - time
      title: Geolocation
      description: Represent the geolocation information of a drive
    DistanceUnits:
      type: string
      enum:
        - mi
        - km
      title: DistanceUnits
      description: Different distance units used for drives
    Currency:
      type: string
      enum:
        - USD
        - CAD
        - GBP
      title: Currency
      description: Different currencies used for drives
    Address:
      properties:
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
          description: Country name or code where the location is situated
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: State, province, or administrative region within the country
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: City or municipality name
        street:
          anyOf:
            - type: string
            - type: 'null'
          title: Street
          description: Street address including number and street name
        postal_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Postal Code
          description: Postal or ZIP code for the location
      type: object
      title: Address
      description: >-
        Geographical address information for drive locations with standardized
        components

````