Skip to main content
GET
/
device
/
{device_id}
/
event
Events
curl --request GET \
  --url https://api.pathstack.io/device/{device_id}/event \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.pathstack.io/device/{device_id}/event"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.pathstack.io/device/{device_id}/event', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathstack.io/device/{device_id}/event",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.pathstack.io/device/{device_id}/event"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.pathstack.io/device/{device_id}/event")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pathstack.io/device/{device_id}/event")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "time": "2023-11-07T05:31:56Z",
      "raw_data": {},
      "value": {
        "harsh_braking": true
      },
      "position": {
        "latitude": 0,
        "longitude": 0
      },
      "id": "<string>",
      "device_id": "<string>",
      "trip_id": "<string>"
    }
  ],
  "links": {
    "previous": "<string>",
    "current": "<string>",
    "next": "<string>"
  }
}
{
"error": {
"code": 400,
"message": "Invalid JWT format"
}
}
{
"error": {
"code": 401,
"message": "Authentication header is missing, or token is invalid/expired."
}
}
{
"error": {
"code": 403,
"message": "You do not have access to this resource"
}
}
{
"error": {
"code": 404,
"message": "Device with ID <device_id> not found"
}
}
{
"error": {
"code": 422,
"message": "Field required",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-api-version
string<date>
default:2024-03-27

Path Parameters

device_id
string<uuid>
required

Device ID of the Events to be returned

Query Parameters

start_time_utc
string<date-time>
required

Start time from when the data will be returned

end_time_utc
string<date-time>
required

End time from when the data will be returned

event_type
enum<string>

Only include events of this type

Available options:
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
verify_data_collection
boolean
default:false

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.

page
integer
default:0

Page number for pagination (zero-indexed)

Required range: x >= 0

Response

Successful Response

data
Event · object[]
required

Successful response payload