Public Token Exchange
Exchange the publicToken
returned by our hosted authentication flow for a long lived connection token that will be used when requesting data from a customer's TSP.
curl --request POST \
--url https://api.withterminal.com/tsp/v1/public-token/exchange \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"publicToken": "pub_tkn_9jNzH26e5b9RgErDnRt8zfm5emDUUyyG"
}'
{
"id": "conn_01GV12VR4DJP70GD1ZBK0SDWFH",
"status": "connected",
"sourceId": "123456789",
"provider": {
"name": "Geotab",
"code": "geotab"
},
"company": {
"name": "Frank's Trucking",
"dotNumbers": []
},
"externalId": "1234",
"syncMode": "automatic",
"token": "con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4",
"createdAt": "2021-01-06T03:24:53.000Z",
"updatedAt": "2021-01-06T03:24:53.000Z"
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Token returned by the authentication flow. Public tokens are one time use and expire after they are exchanged for a long-lived connection token.
Response
Enum values:
connected
: active and authenticated connectiondisconnected
: connection is no longer authenticated - please ask your user to link the account againarchived
: connection has been archived from view - attempts to re-connect will cause us to check the connection status again
connected
, disconnected
, archived
The ID used in the source system to represent the account this connection has access to.
This may be an organizationId
or accountId
.
Note: not all systems expose this information, in which case it may be undefined.
An optional ID from your system that can be used to reference connections.
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.
ISO 8601 date
ISO 8601 date
curl --request POST \
--url https://api.withterminal.com/tsp/v1/public-token/exchange \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"publicToken": "pub_tkn_9jNzH26e5b9RgErDnRt8zfm5emDUUyyG"
}'
{
"id": "conn_01GV12VR4DJP70GD1ZBK0SDWFH",
"status": "connected",
"sourceId": "123456789",
"provider": {
"name": "Geotab",
"code": "geotab"
},
"company": {
"name": "Frank's Trucking",
"dotNumbers": []
},
"externalId": "1234",
"syncMode": "automatic",
"token": "con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4",
"createdAt": "2021-01-06T03:24:53.000Z",
"updatedAt": "2021-01-06T03:24:53.000Z"
}