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

# Trips

> This endpoint returns the Trips for a Device.

You can optionally specify parameters for start_time_utc and end_time_utc to filter the results.

The response is paginated, so if the next link is not null, use that link to get the next page of results.



## OpenAPI

````yaml openapi_2024-03-26 get /device/{device_id}/trip
openapi: 3.1.0
info:
  title: FastAPI
  version: '2024-03-26'
servers:
  - url: https://api.pathstack.io
    description: PathStack production environment
security: []
paths:
  /device/{device_id}/trip:
    get:
      tags:
        - Trips
      summary: Trips
      description: >-
        This endpoint returns the Trips for a Device.


        You can optionally specify parameters for start_time_utc and
        end_time_utc to filter the results.


        The response is paginated, so if the next link is not null, use that
        link to get the next page of results.
      operationId: trips_device__device_id__trip_get
      parameters:
        - name: device_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Device id
            description: Device ID of the Trips to be returned
          description: Device ID of the Trips to be returned
        - name: start_time_utc
          in: query
          required: false
          schema:
            type: string
            format: date-time
            title: Start time
            description: >-
              Start time from when the data will be returned. Trips with end
              time >= start time will be returned
          description: >-
            Start time from when the data will be returned. Trips with end time
            >= start time will be returned
        - name: end_time_utc
          in: query
          required: false
          schema:
            type: string
            format: date-time
            title: End time
            description: >-
              End time from when the data will be returned. Trips with end time
              <= specified end time will be returned
          description: >-
            End time from when the data will be returned. Trips with end time <=
            specified end time will be returned
        - name: verify_data_collection
          in: query
          required: false
          schema:
            type: boolean
            title: Verify data collection
            description: >-
              Verify data collection status, If true, checks data collection
              jobs for the time period and fails with a 424 status if any jobs
              have failed or are still running.
            default: false
          description: >-
            Verify data collection status, If true, checks data collection jobs
            for the time period and fails with a 424 status if any jobs have
            failed or are still running.
        - name: verify_trip_validity
          in: query
          required: false
          schema:
            type: boolean
            title: Checks the validity of a trip
            description: >-
              Pathstack determines the validity of a trip during data
              collection. A trip can be deemed invalid if it has incorrect or
              incomplete data. Pathstack sets the validity of the trip via the
              field is_valid along with comments on the reason in validation
              comments
            default: true
          description: >-
            Pathstack determines the validity of a trip during data collection.
            A trip can be deemed invalid if it has incorrect or incomplete data.
            Pathstack sets the validity of the trip via the field is_valid along
            with comments on the reason in validation comments
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            title: Page number
            description: Page number for pagination (zero-indexed)
            default: 0
          description: Page number for pagination (zero-indexed)
        - name: x-api-version
          in: header
          required: false
          schema:
            type: string
            format: date
            default: '2024-03-26'
            title: X-Api-Version
          examples:
            default:
              value: '2024-03-26'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedSuccess_list_Trip__'
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 400
                        title: Error code
                      message:
                        type: string
                        example: Invalid JWT format
                        title: Error message
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 401
                        title: Error code
                      message:
                        type: string
                        example: >-
                          Authentication header is missing, or token is
                          invalid/expired.
                        title: Error message
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 403
                        title: Error code
                      message:
                        type: string
                        example: You do not have access to this resource
                        title: Error message
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 404
                        title: Error code
                      message:
                        type: string
                        example: Device with ID <device_id> not found
                        title: Error message
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 422
                        title: Error code
                      message:
                        type: string
                        example: Field required
                        title: Error message
                      loc:
                        items:
                          anyOf:
                            - type: string
                            - type: integer
                        type: array
                        title: Location
                      msg:
                        type: string
                        title: Message
                      type:
                        type: string
                        title: Error Type
          description: Unprocessable Entity
      security:
        - JWTBearer: []
components:
  schemas:
    PaginatedSuccess_list_Trip__:
      properties:
        data:
          items:
            $ref: '#/components/schemas/Trip'
          type: array
          title: Data
          description: Successful response payload
        links:
          $ref: '#/components/schemas/PaginationLinks'
      type: object
      required:
        - data
        - links
      title: PaginatedSuccess[list[Trip]]
    Trip:
      properties:
        start_latitude:
          type: number
          title: Start Latitude
        start_longitude:
          type: number
          title: Start Longitude
        end_latitude:
          type: number
          title: End Latitude
        end_longitude:
          type: number
          title: End Longitude
        system_trip_id:
          anyOf:
            - type: string
            - type: 'null'
          title: System Trip Id
        start_time:
          type: string
          title: Start Time
        end_time:
          type: string
          title: End Time
        distance_metres:
          type: number
          title: Distance Metres
        duration_seconds:
          type: number
          title: Duration Seconds
        driving_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Driving Seconds
        idling_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Idling Seconds
        auxiliary_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Auxiliary Seconds
        is_valid:
          type: boolean
          title: Is Valid
        validation_comments:
          anyOf:
            - type: string
            - type: 'null'
          title: Validation Comments
        id:
          type: string
          format: uuid4
          title: Id
        device_id:
          type: string
          format: uuid4
          title: Device Id
      type: object
      required:
        - start_latitude
        - start_longitude
        - end_latitude
        - end_longitude
        - system_trip_id
        - start_time
        - end_time
        - distance_metres
        - duration_seconds
        - driving_seconds
        - idling_seconds
        - auxiliary_seconds
        - is_valid
        - validation_comments
        - id
        - device_id
      title: Trip
    PaginationLinks:
      properties:
        previous:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous
        current:
          anyOf:
            - type: string
            - type: 'null'
          title: Current
        next:
          anyOf:
            - type: string
            - type: 'null'
          title: Next
      type: object
      title: PaginationLinks
  securitySchemes:
    JWTBearer:
      type: http
      scheme: bearer

````