Authenticate API Calls

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 MAPSstring
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 intervalstring
expiresThe date and time at which the token is set to expireDateTime

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 accountstring
AccountNameName of corresponding fleet accountstring

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