Skip to main content
POST
/
realtime
/
device
Get Realtime Positions
curl --request POST \
  --url https://api.pathstack.io/realtime/device \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "filters": {
    "connection_ids": [
      "<string>"
    ],
    "tags": [
      "<string>"
    ],
    "device_ids": [
      "<string>"
    ],
    "connection_devices": [
      {
        "connection_id": "<string>",
        "system_device_ids": [
          "<string>"
        ]
      }
    ]
  },
  "options": {
    "include_speed": true,
    "include_driver_id": true
  }
}
'
import requests

url = "https://api.pathstack.io/realtime/device"

payload = {
"filters": {
"connection_ids": ["<string>"],
"tags": ["<string>"],
"device_ids": ["<string>"],
"connection_devices": [
{
"connection_id": "<string>",
"system_device_ids": ["<string>"]
}
]
},
"options": {
"include_speed": True,
"include_driver_id": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filters: {
connection_ids: ['<string>'],
tags: ['<string>'],
device_ids: ['<string>'],
connection_devices: [{connection_id: '<string>', system_device_ids: ['<string>']}]
},
options: {include_speed: true, include_driver_id: true}
})
};

fetch('https://api.pathstack.io/realtime/device', 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/realtime/device",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filters' => [
'connection_ids' => [
'<string>'
],
'tags' => [
'<string>'
],
'device_ids' => [
'<string>'
],
'connection_devices' => [
[
'connection_id' => '<string>',
'system_device_ids' => [
'<string>'
]
]
]
],
'options' => [
'include_speed' => true,
'include_driver_id' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.pathstack.io/realtime/device"

payload := strings.NewReader("{\n \"filters\": {\n \"connection_ids\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"device_ids\": [\n \"<string>\"\n ],\n \"connection_devices\": [\n {\n \"connection_id\": \"<string>\",\n \"system_device_ids\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"options\": {\n \"include_speed\": true,\n \"include_driver_id\": true\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.pathstack.io/realtime/device")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"connection_ids\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"device_ids\": [\n \"<string>\"\n ],\n \"connection_devices\": [\n {\n \"connection_id\": \"<string>\",\n \"system_device_ids\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"options\": {\n \"include_speed\": true,\n \"include_driver_id\": true\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pathstack.io/realtime/device")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filters\": {\n \"connection_ids\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"device_ids\": [\n \"<string>\"\n ],\n \"connection_devices\": [\n {\n \"connection_id\": \"<string>\",\n \"system_device_ids\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"options\": {\n \"include_speed\": true,\n \"include_driver_id\": true\n }\n}"

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "connection_id": "<string>",
      "device_id": "<string>",
      "system_device_id": "<string>",
      "position": {
        "timestamp": "<string>",
        "longitude": 123,
        "latitude": 123,
        "heading": 123,
        "speed": {
          "speed_kph": 123
        },
        "driver_id": {
          "value": "<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": "Unknown device_ids <string>, ..."
}
}
{
"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

Body

application/json
filters
RealTimeFilter · object | null
options
RealTimeOption · object | null

Response

Successful Response

data
(RealtimeValidState · object | RealtimeTimeoutState · object)[]
required

Successful response payload