Skip to main content

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

NameDescriptionData 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

NameDescriptionData Type
tokenAuthentication token that expires after a set time interval
string
expiresThe 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

MessageError CodeDescription
Invalid apiKey value or alias sent400This 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

NameDescriptionData Type
AccountIdAccount Id associated with specific fleet account
string
AccountNameName of corresponding fleet account
string

Sample Response

{
  "data": [
    {
      "AccountName": "Fleet Account 1",
      "AccountId": "FLTACC1"
    },
    {
      "AccountName": "Fleet Account 2",
      "AccountId": "FLTACC2"
    }
  ]
}

Error Codes

MessageError CodeDescription
Token does not have partner level access400This error is thrown when the API key does not have access to get all accounts with the Partner
Last updated August 4, 2022.
Contents