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

# Get Device Active Trip

> Check if a single device is currently in motion and get its active trip.

Returns active trip status for a single device based on its latest GPS sample. The `id` path parameter accepts either `short_id` or `hardware_id`.

## Path parameters

<ParamField path="id" type="string" required>
  Device identifier — either `short_id` or `hardware_id`.
</ParamField>

## Query parameters

<ParamField query="maxAgeSeconds" type="number" default="300">
  Maximum age of latest GPS sample in seconds.
</ParamField>

<ParamField query="lookbackSeconds" type="number" default="14400">
  How far back to load GPS history for trip detection.
</ParamField>

<ParamField query="speedThreshold" type="number" default="3">
  km/h — below this speed is considered stopped.
</ParamField>

<ParamField query="minimalTripDuration" type="number" default="300">
  Seconds — minimum moving time to count as a trip.
</ParamField>

<ParamField query="minimalTripDistance" type="number" default="500">
  Meters — minimum distance to count as a trip.
</ParamField>

<ParamField query="minimalParkingDuration" type="number" default="180">
  Seconds — minimum stopped time to end a trip.
</ParamField>

<ParamField query="minimalNoDataDuration" type="number" default="1800">
  Seconds — data gaps longer than this are treated as stops.
</ParamField>

<ParamField query="minimalAvgSpeed" type="number" default="1">
  km/h — minimum average speed to count as a trip.
</ParamField>

<ParamField query="maxAcceleration" type="number" default="10">
  m/s² — filter GPS spikes exceeding this value.
</ParamField>

## Response

<ResponseField name="hardware_id" type="string" required>Device hardware ID.</ResponseField>
<ResponseField name="active" type="boolean" required>Whether the device is currently in motion.</ResponseField>

<ResponseField name="activeTrip" type="object">
  Present when `active` is `true`. Contains `hardware_id`, `speed`, `last_position_at`, `last_position_age_seconds`, `location`, and `trip` data.
</ResponseField>

<ResponseField name="summary" type="object" required>
  Configuration and parameters used for detection.
</ResponseField>

<RequestExample>
  ```bash theme={null}
  curl -H "X-API-Key: YOUR_API_KEY" \
    "https://your-api-host/trips/ABC123/active?maxAgeSeconds=180"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "hardware_id": "ABC123",
    "active": true,
    "activeTrip": {
      "hardware_id": "ABC123",
      "speed": 19.6,
      "last_position_at": "2025-12-17T10:30:00.000Z",
      "last_position_age_seconds": 24,
      "location": { "lat": 37.7749, "long": -122.4194 },
      "trip": {
        "startTime": "2025-12-17T09:50:00.000Z",
        "endTime": "2025-12-17T10:30:00.000Z",
        "startLocation": { "lat": 37.7601, "long": -122.4312 },
        "endLocation": { "lat": 37.7749, "long": -122.4194 },
        "distance": 5234,
        "duration": 2400,
        "maxSpeed": 45.2,
        "avgSpeed": 7.8,
        "pointCount": 54
      }
    },
    "summary": {
      "configUsed": {
        "speedThreshold": 3,
        "minimalTripDuration": 300,
        "minimalTripDistance": 500,
        "minimalParkingDuration": 180,
        "minimalNoDataDuration": 1800,
        "minimalAvgSpeed": 1,
        "maxAcceleration": 10
      },
      "maxAgeSeconds": 180,
      "lookbackSeconds": 14400
    }
  }
  ```
</ResponseExample>
