curl --request GET \
--url https://api.withterminal.com/tsp/v1/connections/current \
--header 'Authorization: Bearer <token>' \
--header 'Connection-Token: <connection-token>'import requests
url = "https://api.withterminal.com/tsp/v1/connections/current"
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/connections/current', 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/connections/current",
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/connections/current"
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/connections/current")
.header("Connection-Token", "<connection-token>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withterminal.com/tsp/v1/connections/current")
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": "conn_01GV12VR4DJP70GD1ZBK0SDWFH",
"company": {
"name": "Frank's Trucking",
"dotNumbers": [
"1234567"
]
},
"account": {
"name": "Frank's Trucking",
"dotNumbers": [
"1234567"
],
"user": {
"sourceId": "1234567",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com"
}
},
"provider": {
"code": "geotab",
"name": "Geotab"
},
"syncMode": "automatic",
"token": "con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4",
"createdAt": "2021-01-06T03:24:53.000Z",
"updatedAt": "2021-01-06T03:24:53.000Z",
"status": "connected",
"options": {
"ingestHistoryFromSourceSystem": true
},
"linkUrl": "https://link.withterminal.com/connection/{CONNECTION_ID}?key={PUBLISHABLE_KEY}",
"agreements": [
{
"id": "agr_01D9ZQFGHVJ858NBF2Q7DV9MNH",
"agreementUrl": "<string>",
"acceptedAt": "2021-01-06T03:24:53.000Z",
"connectionId": "conn_01GV12VR4DJP70GD1ZBK0SDWFH",
"acceptedBy": {
"sourceId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>"
},
"location": "New York, NY",
"ipAddress": "127.0.0.1",
"userAgent": "<string>"
}
],
"externalId": "1234",
"sourceId": "123456789",
"tags": [
"Tag Name"
],
"filters": {
"vehicles": {
"status": "active",
"excludeIds": [
"vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"includeIds": [
"vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC"
]
},
"drivers": {
"status": "active",
"excludeIds": [
"drv_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"includeIds": [
"drv_01D8ZQFGHVJ858NBF2Q7DV9MNC"
]
}
},
"lastSync": {
"id": "sync_01GV12VR4DJP70GD1ZBK0SDWFH",
"status": "completed",
"requestedAt": "2021-01-06T03:24:53.000Z",
"failureReason": "Reason for failure if sync status is 'failed'",
"progress": 85,
"issues": [
"isu_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"startFrom": "2021-01-06T03:24:53.000Z",
"completedAt": "2021-01-06T03:24:53.000Z",
"attempts": 1,
"providerRequests": [
"historical_files"
]
}
}{
"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": "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"
}{
"code": "gateway_timeout",
"message": "Gateway Timeout"
}Get Current Connection
Get the details of the current active connection. The current connection is derived from the provided connection token.
curl --request GET \
--url https://api.withterminal.com/tsp/v1/connections/current \
--header 'Authorization: Bearer <token>' \
--header 'Connection-Token: <connection-token>'import requests
url = "https://api.withterminal.com/tsp/v1/connections/current"
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/connections/current', 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/connections/current",
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/connections/current"
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/connections/current")
.header("Connection-Token", "<connection-token>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withterminal.com/tsp/v1/connections/current")
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": "conn_01GV12VR4DJP70GD1ZBK0SDWFH",
"company": {
"name": "Frank's Trucking",
"dotNumbers": [
"1234567"
]
},
"account": {
"name": "Frank's Trucking",
"dotNumbers": [
"1234567"
],
"user": {
"sourceId": "1234567",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com"
}
},
"provider": {
"code": "geotab",
"name": "Geotab"
},
"syncMode": "automatic",
"token": "con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4",
"createdAt": "2021-01-06T03:24:53.000Z",
"updatedAt": "2021-01-06T03:24:53.000Z",
"status": "connected",
"options": {
"ingestHistoryFromSourceSystem": true
},
"linkUrl": "https://link.withterminal.com/connection/{CONNECTION_ID}?key={PUBLISHABLE_KEY}",
"agreements": [
{
"id": "agr_01D9ZQFGHVJ858NBF2Q7DV9MNH",
"agreementUrl": "<string>",
"acceptedAt": "2021-01-06T03:24:53.000Z",
"connectionId": "conn_01GV12VR4DJP70GD1ZBK0SDWFH",
"acceptedBy": {
"sourceId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>"
},
"location": "New York, NY",
"ipAddress": "127.0.0.1",
"userAgent": "<string>"
}
],
"externalId": "1234",
"sourceId": "123456789",
"tags": [
"Tag Name"
],
"filters": {
"vehicles": {
"status": "active",
"excludeIds": [
"vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"includeIds": [
"vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC"
]
},
"drivers": {
"status": "active",
"excludeIds": [
"drv_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"includeIds": [
"drv_01D8ZQFGHVJ858NBF2Q7DV9MNC"
]
}
},
"lastSync": {
"id": "sync_01GV12VR4DJP70GD1ZBK0SDWFH",
"status": "completed",
"requestedAt": "2021-01-06T03:24:53.000Z",
"failureReason": "Reason for failure if sync status is 'failed'",
"progress": 85,
"issues": [
"isu_01D8ZQFGHVJ858NBF2Q7DV9MNC"
],
"startFrom": "2021-01-06T03:24:53.000Z",
"completedAt": "2021-01-06T03:24:53.000Z",
"attempts": 1,
"providerRequests": [
"historical_files"
]
}
}{
"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": "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"
}{
"code": "gateway_timeout",
"message": "Gateway Timeout"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Scopes the request to a Terminal application in the caller's organization. Required for multi-application organizations when using a user session or OAuth access token. API keys are already bound to a single application.
The token returned when a user authenticated their account. This authorizes access to a specific account.
^con_tkn_\S+$"con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4"
Response
OK
The connection your application has with your customer's TSP.
"conn_01GV12VR4DJP70GD1ZBK0SDWFH"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Enum values:
automatic: Terminal will keep this connections data up to datemanual: Terminal will only sync data upon request
automatic, manual This token is used when interacting with a connections' data.
^con_tkn_\S+$"con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4"
The current status of the connection.
connected, disconnected, archived, pending_deletion - Omnitracs Options
- Omnitracs ES Options
- Omnitracs XRS Options
Show child attributes
Show child attributes
The URL to send your user to in order to have them re-authenticate the connection.
"https://link.withterminal.com/connection/{CONNECTION_ID}?key={PUBLISHABLE_KEY}"
Show child attributes
Show child attributes
An optional ID from your system that can be used to reference connections.
"1234"
The ID used in the source system to represent the account this connection has or had access to.
This may be an organizationId or accountId.
Note: not all systems expose this information, in which case it may be undefined.
"123456789"
An optional list of tags from your system that can be used to reference connections.
Filters applied to connection data
Show child attributes
Show child attributes
Show child attributes
Show child attributes