Authenticate API Calls
Contents
Resource URL
The base URL for all Fleet API calls is:
https://fleets.trimblemaps.com/api/assets/v1
POST /accounts/authenticate
Use the API key provided by Trimble Maps in the authentication request to the server. If the authentication is successful, the server creates and sends a JSON Web Token (JWT) in the response. To access the API resources, all subsequent requests must pass the JWT in the request header.
Request Body
Name | Description | Data Type |
---|---|---|
apiKey (Required) | API key provided by Trimble Maps |
string |
accountId (Optional) | Not required for direct CoPilot customer/fleet account Required for partners/resellers who work with multiple fleet accounts to authenticate with a specific account |
string |
Response
Name | Description | Data Type |
---|---|---|
token | Authentication token that expires after a set time interval |
string |
expires | The date and time at which the token is set to expire |
DateTime |
Sample Request
{
"apiKey": "string",
"accountId": "string"
}
Sample Response
{
"token": "string",
"expires": "2019-01-21T19:18:23.228Z"
}
Error Codes
Message | Error Code | Description |
---|---|---|
Invalid apiKey value or alias sent | 400 | This error is thrown when API key or account id is invalid. |
GET /accounts
CoPilot telematics partners and resellers can use this API to get a list of all fleet accounts associated with them. Using the fleet AccountIds returned in the response, partners and resellers can then get an authentication token specific to a fleet account, by calling /accounts/authenticate
. (See above.)
Response
Name | Description | Data Type |
---|---|---|
AccountId | Account Id associated with specific fleet account |
string |
AccountName | Name of corresponding fleet account |
string |
Sample Response
{
"data": [
{
"AccountName": "Fleet Account 1",
"AccountId": "FLTACC1"
},
{
"AccountName": "Fleet Account 2",
"AccountId": "FLTACC2"
}
]
}
Error Codes
Message | Error Code | Description |
---|---|---|
Token does not have partner level access | 400 | This error is thrown when the API key does not have access to get all accounts with the Partner |