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

# Events

> This endpoint returns the Events for a Device.

You can optionally specify parameters for event_type, 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-27 get /device/{device_id}/event
openapi: 3.1.0
info:
  title: FastAPI
  version: '2024-03-27'
servers:
  - url: https://api.pathstack.io
    description: PathStack production environment
security: []
paths:
  /device/{device_id}/event:
    get:
      tags:
        - Events
      summary: Events
      description: >-
        This endpoint returns the Events for a Device.


        You can optionally specify parameters for event_type, 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: events_device__device_id__event_get
      parameters:
        - name: device_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Device id
            description: Device ID of the Events to be returned
          description: Device ID of the Events to be returned
        - name: start_time_utc
          in: query
          required: true
          schema:
            type: string
            format: date-time
            title: Start time
            description: Start time from when the data will be returned
          description: Start time from when the data will be returned
        - name: end_time_utc
          in: query
          required: true
          schema:
            type: string
            format: date-time
            title: End time
            description: End time from when the data will be returned
          description: End time from when the data will be returned
        - name: event_type
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/EventTypeEnum'
            title: Event type
            description: Only include events of this type
          description: Only include events of this type
        - 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: 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-27'
            title: X-Api-Version
          examples:
            default:
              value: '2024-03-27'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedSuccess_list_Event__'
        '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:
    EventTypeEnum:
      type: string
      enum:
        - ignition_status
        - idling
        - odometer
        - harsh_braking
        - harsh_acceleration
        - hard_cornering
        - engine_speed
        - accident
        - total_fuel
        - over_speeding
        - power_take_off_engaged
        - auxiliary_equipment_operation
        - gps_signal_blocked
        - adas_distance_maintenance
        - adas_forward_collision
        - adas_lane_departure
        - adas_pedestrian_collision
        - dms_distraction
        - dms_eyes_closed
        - dms_no_driver
        - dms_phone_calling
        - dms_smoking
        - dms_yawn
      title: EventTypeEnum
    PaginatedSuccess_list_Event__:
      properties:
        data:
          items:
            $ref: '#/components/schemas/Event'
          type: array
          title: Data
          description: Successful response payload
        links:
          $ref: '#/components/schemas/PaginationLinks'
      type: object
      required:
        - data
        - links
      title: PaginatedSuccess[list[Event]]
    Event:
      properties:
        event_key:
          $ref: '#/components/schemas/EventTypeEnum'
        time:
          type: string
          format: date-time
          title: Time
        raw_data:
          additionalProperties: true
          type: object
          title: Raw Data
        value:
          anyOf:
            - $ref: '#/components/schemas/EventHarshBrakingValue'
            - $ref: '#/components/schemas/EventHardCorneringValue'
            - $ref: '#/components/schemas/EventHarshAccelerationValue'
            - $ref: '#/components/schemas/EventEngineSpeedValue'
            - $ref: '#/components/schemas/EventAccidentValue'
            - $ref: '#/components/schemas/EventTotalFuelValue'
            - $ref: '#/components/schemas/EventPowerTakeOffValue'
            - $ref: '#/components/schemas/EventIgnitionStatusValue'
            - $ref: '#/components/schemas/EventOdometerValue'
            - $ref: '#/components/schemas/EventAuxiliaryEquipmentOperationValue'
            - $ref: '#/components/schemas/EventIdlingValue'
            - $ref: '#/components/schemas/EventAdasDistanceMaintenanceValue'
            - $ref: '#/components/schemas/EventAdasForwardCollisionValue'
            - $ref: '#/components/schemas/EventAdasLaneDepartureValue'
            - $ref: '#/components/schemas/EventAdasPedestrianCollisionValue'
            - $ref: '#/components/schemas/EventDmsDistractionValue'
            - $ref: '#/components/schemas/EventDmsEyesClosedValue'
            - $ref: '#/components/schemas/EventDmsNoDriverValue'
            - $ref: '#/components/schemas/EventDmsPhoneCallingValue'
            - $ref: '#/components/schemas/EventDmsSmokingValue'
            - $ref: '#/components/schemas/EventDmsYawnValue'
            - $ref: '#/components/schemas/EventGpsSignalBlockedValue'
          title: Value
        position:
          anyOf:
            - $ref: '#/components/schemas/Coordinate'
            - type: 'null'
          title: Position
        id:
          type: string
          format: uuid4
          title: Id
        device_id:
          type: string
          format: uuid4
          title: Device Id
        trip_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trip Id
      type: object
      required:
        - event_key
        - time
        - raw_data
        - value
        - position
        - id
        - device_id
      title: Event
    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
    EventHarshBrakingValue:
      properties:
        harsh_braking:
          type: boolean
          title: Harsh Braking
      type: object
      required:
        - harsh_braking
      title: EventHarshBrakingValue
    EventHardCorneringValue:
      properties:
        hard_cornering:
          type: boolean
          title: Hard Cornering
      type: object
      required:
        - hard_cornering
      title: EventHardCorneringValue
    EventHarshAccelerationValue:
      properties:
        harsh_acceleration:
          type: boolean
          title: Harsh Acceleration
      type: object
      required:
        - harsh_acceleration
      title: EventHarshAccelerationValue
    EventEngineSpeedValue:
      properties:
        revolutions_per_minute:
          type: integer
          title: Revolutions Per Minute
      type: object
      required:
        - revolutions_per_minute
      title: EventEngineSpeedValue
    EventAccidentValue:
      properties:
        accident:
          type: boolean
          title: Accident
      type: object
      required:
        - accident
      title: EventAccidentValue
    EventTotalFuelValue:
      properties:
        total_fuel_litres:
          type: number
          title: Total Fuel Litres
      type: object
      required:
        - total_fuel_litres
      title: EventTotalFuelValue
    EventPowerTakeOffValue:
      properties:
        power_take_off_engaged:
          type: boolean
          title: Power Take Off Engaged
      type: object
      required:
        - power_take_off_engaged
      title: EventPowerTakeOffValue
    EventIgnitionStatusValue:
      properties:
        ignition_on:
          type: boolean
          title: Ignition On
      type: object
      required:
        - ignition_on
      title: EventIgnitionStatusValue
    EventOdometerValue:
      properties:
        odometer_kilometres:
          type: number
          title: Odometer Kilometres
      type: object
      required:
        - odometer_kilometres
      title: EventOdometerValue
    EventAuxiliaryEquipmentOperationValue:
      properties:
        auxiliary_equipment_operation:
          type: boolean
          title: Auxiliary Equipment Operation
      type: object
      required:
        - auxiliary_equipment_operation
      title: EventAuxiliaryEquipmentOperationValue
    EventIdlingValue:
      properties:
        idling:
          type: boolean
          title: Idling
      type: object
      required:
        - idling
      title: EventIdlingValue
    EventAdasDistanceMaintenanceValue:
      properties:
        adas_distance_maintenance:
          type: boolean
          title: Adas Distance Maintenance
      type: object
      required:
        - adas_distance_maintenance
      title: EventAdasDistanceMaintenanceValue
    EventAdasForwardCollisionValue:
      properties:
        adas_forward_collision:
          type: boolean
          title: Adas Forward Collision
      type: object
      required:
        - adas_forward_collision
      title: EventAdasForwardCollisionValue
    EventAdasLaneDepartureValue:
      properties:
        adas_lane_departure:
          type: boolean
          title: Adas Lane Departure
      type: object
      required:
        - adas_lane_departure
      title: EventAdasLaneDepartureValue
    EventAdasPedestrianCollisionValue:
      properties:
        adas_pedestrian_collision:
          type: boolean
          title: Adas Pedestrian Collision
      type: object
      required:
        - adas_pedestrian_collision
      title: EventAdasPedestrianCollisionValue
    EventDmsDistractionValue:
      properties:
        dms_distraction:
          type: boolean
          title: Dms Distraction
      type: object
      required:
        - dms_distraction
      title: EventDmsDistractionValue
    EventDmsEyesClosedValue:
      properties:
        dms_eyes_closed:
          type: boolean
          title: Dms Eyes Closed
      type: object
      required:
        - dms_eyes_closed
      title: EventDmsEyesClosedValue
    EventDmsNoDriverValue:
      properties:
        dms_no_driver:
          type: boolean
          title: Dms No Driver
      type: object
      required:
        - dms_no_driver
      title: EventDmsNoDriverValue
    EventDmsPhoneCallingValue:
      properties:
        dms_phone_calling:
          type: boolean
          title: Dms Phone Calling
      type: object
      required:
        - dms_phone_calling
      title: EventDmsPhoneCallingValue
    EventDmsSmokingValue:
      properties:
        dms_smoking:
          type: boolean
          title: Dms Smoking
      type: object
      required:
        - dms_smoking
      title: EventDmsSmokingValue
    EventDmsYawnValue:
      properties:
        dms_yawn:
          type: boolean
          title: Dms Yawn
      type: object
      required:
        - dms_yawn
      title: EventDmsYawnValue
    EventGpsSignalBlockedValue:
      properties:
        gps_signal_blocked:
          type: boolean
          title: Gps Signal Blocked
      type: object
      required:
        - gps_signal_blocked
      title: EventGpsSignalBlockedValue
    Coordinate:
      properties:
        latitude:
          anyOf:
            - type: number
              maximum: 90
              minimum: -90
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Latitude
        longitude:
          anyOf:
            - type: number
              maximum: 180
              minimum: -180
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Longitude
      type: object
      required:
        - latitude
        - longitude
      title: Coordinate
      description: >-
        Coordinate parses Latitude and Longitude.


        You can use the `Coordinate` data type for storing coordinates.
        Coordinates can be

        defined using one of the following formats:


        1. Tuple: `(Latitude, Longitude)`. For example: `(41.40338, 2.17403)` or
        `(Decimal('41.40338'), Decimal('2.17403'))`.

        2. `Coordinate` instance: `Coordinate(latitude=Latitude,
        longitude=Longitude)`.


        ```py

        from decimal import Decimal

        from pydantic import BaseModel


        from pydantic_extra_types.coordinate import Coordinate



        class Location(BaseModel):
            coordinate: Coordinate


        # Using float values

        location1 = Location(coordinate=(41.40338, 2.17403))

        # > coordinate=Coordinate(latitude=41.40338, longitude=2.17403)


        # Using Decimal values

        location2 = Location(coordinate=(Decimal('41.40338'),
        Decimal('2.17403')))

        # > coordinate=Coordinate(latitude=41.40338, longitude=2.17403)

        ```
  securitySchemes:
    JWTBearer:
      type: http
      scheme: bearer

````