Skip to main content
GET
/
safety
/
events
/
{id}
Get Safety Event
curl --request GET \
  --url https://api.withterminal.com/tsp/v1/safety/events/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Connection-Token: <connection-token>'
import requests

url = "https://api.withterminal.com/tsp/v1/safety/events/{id}"

headers = {
    "Connection-Token": "<connection-token>",
    "Authorization": "Bearer <token>"
}

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

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

fetch('https://api.withterminal.com/tsp/v1/safety/events/{id}', 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.withterminal.com/tsp/v1/safety/events/{id}",
  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>",
    "Connection-Token: <connection-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.withterminal.com/tsp/v1/safety/events/{id}"

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

	req.Header.Add("Connection-Token", "<connection-token>")
	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.withterminal.com/tsp/v1/safety/events/{id}")
  .header("Connection-Token", "<connection-token>")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.withterminal.com/tsp/v1/safety/events/{id}")

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

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

response = http.request(request)
puts response.read_body
{
  "id": "sft_evt_01D8ZQFGHVJ858NBF2Q7DV9MNC",
  "sourceId": "123456789",
  "provider": "geotab",
  "vehicle": "vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC",
  "startedAt": "2021-01-06T03:24:53.000Z",
  "metadata": {
    "addedAt": "2023-11-07T05:31:56Z",
    "modifiedAt": "2023-11-07T05:31:56Z"
  },
  "sourceType": "HARD_CORE_BRAKING_MESSAGE",
  "driver": "drv_01D8ZQFGHVJ858NBF2Q7DV9MNC",
  "startLocation": {
    "longitude": -122.4194155,
    "latitude": 37.7749295
  },
  "endedAt": "2021-01-06T03:24:53.000Z",
  "endLocation": {
    "longitude": -122.4194155,
    "latitude": 37.7749295
  },
  "stats": {
    "maximumSpeed": 95.33,
    "averageSpeed": 95.33,
    "roadSpeedLimit": 95.33,
    "gForceForwardBackward": 1,
    "gForceSideToSide": 1,
    "heading": 25
  },
  "cameraMedia": {
    "frontFacing": {
      "available": true,
      "sourceId": "12345"
    },
    "rearFacing": {
      "available": true,
      "sourceId": "12345"
    }
  },
  "extensions": {
    "here": {
      "speedLimit": 95.33,
      "speedLimitSource": "posted",
      "truckSpeedLimit": 95.33,
      "roadName": "John St",
      "linkAttributes": {
        "countryCode": "<string>",
        "vehicleTypes": "<string>",
        "isUrban": "<string>",
        "transportVerified": "<string>",
        "functionalClass": "<string>",
        "controlledAccess": "<string>",
        "limitedAccessRoad": "<string>",
        "travelDirection": "<string>",
        "isBoatFerry": "<string>",
        "isRailFerry": "<string>",
        "isMultiDigitized": "<string>",
        "isDivided": "<string>",
        "isDividerLegal": "<string>",
        "isFrontage": "<string>",
        "isPaved": "<string>",
        "isRamp": "<string>",
        "isPrivate": "<string>",
        "hasPoiAccess": "<string>",
        "intersectionCategory": "<string>",
        "speedCategory": "<string>",
        "laneCategory": "<string>",
        "coverageIndicator": "<string>",
        "lowMobility": "<string>",
        "hasPublicAccess": "<string>",
        "routeTypes": "<string>"
      },
      "weather": {
        "latitude": 123,
        "longitude": 123,
        "temperature": 123,
        "dewPoint": 123,
        "humidity": 123,
        "pressure": 123,
        "windSpeed": 123,
        "windDirection": 123,
        "locationId": "<string>",
        "precipitationType": "<string>",
        "intensityOfPrecipitation": 123,
        "visibility": 123
      }
    }
  },
  "raw": []
}
{
  "code": "bad_request",
  "message": "Invalid request body",
  "detail": [
    {
      "message": "'vehicleId' property must be a valid ulid",
      "path": "{requestQuery}.vehicleId",
      "suggestion": "Please ensure you submit a valid 'vehicleId' property",
      "context": {}
    }
  ]
}
{
  "code": "unauthorized",
  "message": "Unauthorized Request",
  "detail": "Please ensure you have a valid API key"
}
{
  "code": "forbidden",
  "message": "Forbidden Request",
  "detail": "Please ensure the connection token matches the resource you are attempting to access."
}
{
  "code": "not_found",
  "message": "Resource not found",
  "detail": "Could not find resource with ID: 2342342"
}
{
  "code": "too_many_requests",
  "message": "Too Many Requests",
  "retryAfter": 60,
  "detail": "You have exceeded your rate limit. Please try again later."
}
{
  "code": "internal_server_error",
  "message": "Internal Server Error",
  "detail": "Something went wrong"
}

Authorizations

Authorization
string
header
required

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

Headers

Connection-Token
string
required

The token returned when a user authenticated their account. This authorizes access to a specific account.

Pattern: ^con_tkn_\S+$
Example:

"con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4"

Path Parameters

id
string<ulid>
required

The id of the safety event.

Pattern: ^sft_evt_[0-9A-HJKMNP-TV-Z]{26}$
Example:

"sft_evt_01D8ZQFGHVJ858NBF2Q7DV9MNC"

Query Parameters

expand
enum<string>

Expand resources in the returned response

Available options:
driver,
vehicle,
driver,vehicle,
vehicle,driver
raw
boolean

Include raw responses used to normalize model. Used for debugging or accessing unique properties that are not unified.

Response

OK

id
string<ulid>
required
Pattern: ^sft_evt_[0-9A-HJKMNP-TV-Z]{26}$
Example:

"sft_evt_01D8ZQFGHVJ858NBF2Q7DV9MNC"

sourceId
string
required

The ID used to represent the entity in the source system.

Example:

"123456789"

provider
string
required

Every provider has a unique code to identify it across Terminal's system. You can find each provider's code under provider details.

Example:

"geotab"

type
enum<string>
required
Available options:
harsh_brake,
harsh_acceleration,
harsh_turn,
speeding,
crash,
near_crash,
tailgating,
cell_phone,
distracted,
drowsiness,
smoking,
seat_belt_violation,
stop_sign_violation,
red_light_violation,
unsafe_lane_change,
camera_obstruction,
eating_and_drinking,
rolling_stop,
unsafe_parking
vehicle
required

The ID of the vehicle that was involved in the event.

Pattern: ^vcl_[0-9A-HJKMNP-TV-Z]{26}$
Example:

"vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC"

startedAt
string<date-time>
required
Example:

"2021-01-06T03:24:53.000Z"

metadata
EntityMetadata · object
required

Internal metadata about the record.

sourceType
string

The original event type as defined by the telematics provider's system

Example:

"HARD_CORE_BRAKING_MESSAGE"

driver

Entities in Terminal are expandable. Using the expand query parameter you can choose to ingest just an ID or the full entity details.

Pattern: ^drv_[0-9A-HJKMNP-TV-Z]{26}$
Example:

"drv_01D8ZQFGHVJ858NBF2Q7DV9MNC"

startLocation
Coordinates · object
endedAt
string<date-time>
Example:

"2021-01-06T03:24:53.000Z"

endLocation
Coordinates · object
stats
object
cameraMedia
Camera Media Reference · object
extensions
object

Includes data enriched via third-party vendors. See Extensions

raw
RawData · object[]
Example:
[]