POST
/
syncs
Request Sync
curl --request POST \
  --url https://api.withterminal.com/tsp/v1/syncs \
  --header 'Authorization: Bearer <token>' \
  --header 'Connection-Token: <connection-token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "days": 7
}'
{
  "id": "sync_01GV12VR4DJP70GD1ZBK0SDWFH",
  "status": "completed",
  "failureReason": "Reason for failure if sync status is 'failed'",
  "issues": [
    "isu_01D8ZQFGHVJ858NBF2Q7DV9MNC"
  ],
  "startFrom": "2021-01-06T03:24:53.000Z",
  "requestedAt": "2021-01-06T03:24:53.000Z",
  "completedAt": "2021-01-06T03:24:53.000Z",
  "attempts": 1
}
By default, Terminal will sync all connections where syncMode = automatic on a regular cadence. For customers that may not need a fleet’s data to be kept up to date and want to reduce their active tracked trucks, you can set syncMode = manual and invoke this endpoint when you want to sync data. If you’re wondering if this is relevent to your use case then feel free to reach out and we’d be happy to assist.

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.

Example:

"con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4"

Body

application/json

How to sync the data. If startFrom is not provided, it will either sync from the last time a sync was requested or now if the connection has no sync history. Can also provide days instead of startFrom and it will be converted to a date and used in place of startFrom.

startFrom
string<date-time>

When to start syncing from. If startFrom is not provided, it will either sync from the last time a sync was requested or now if the connection has no sync history.

Example:

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

days
number

How many days of history to sync from now. Will be converted to a date and used in place of startFrom

providerRequests
enum<string>[]

Request additional information from the provider for this sync.

Example:
[{ "type": "historical_files" }]

Response

Created

id
string<ulid>
required
Example:

"sync_01GV12VR4DJP70GD1ZBK0SDWFH"

status
enum<string>
required

The status of the sync

Available options:
requested,
in_progress,
completed,
failed
Example:

"completed"

requestedAt
string<date-time>
required
Example:

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

failureReason
string

If the sync failed, this will contain the reason

Example:

"Reason for failure if sync status is 'failed'"

issues
(string<ulid> | ExpandableIssue · object)[]

Issues are problems encountered with a connection that did not result in a failed sync but may require manual intervention. You can see the issues for a given sync by providing issues to the expand parameter.

startFrom
string<date-time>

The earliest records to sync for those based on time (ex: historical locations and stats)

Example:

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

completedAt
string<date-time>
Example:

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

attempts
number
Example:

1