Authentication Guide
Contents
All requests to PC*Miler Web Services (PCMWS) require a valid API key. You can request a free trial key to test the APIs for a limited time.
This guide covers the two authentication options for PC*Miler Routing, Location, and Mapping APIs: JWT and API key. The base RESTful URI for PCMWS is:
https://pcmiler.alk.com/apis/rest/v1.0/service.svc
Quick reference
| Option | How to send | Best for |
|---|---|---|
| JWT | Authorization: Bearer YOUR_JWT
| Token-based clients after exchanging an API key |
| API key (POST) | Authorization: YOUR_API_KEY
| POST and most server-side calls |
| API key (GET) | ?authToken=YOUR_API_KEY
| GET and query-friendly calls |
Failed authentication typically returns HTTP 403 Forbidden or 401 Unauthorized.
Option #1: JWT (Bearer token)
PCMWS accepts a JSON Web Token on the Authorization header.
Authorization: Bearer YOUR_JWT_HERE
curl --location 'https://pcmiler.alk.com/apis/rest/v1.0/service.svc/route/routeReports' \
--header 'Authorization: Bearer YOUR_JWT_HERE' \
--header 'Content-Type: application/json' \
--data '{ /* request body */ }'
When the token expires, request a new JWT (or use a refresh token if the identity response provided one) and retry.
How to retrieve a JWT
Exchange your API key for a short-lived JWT at the Trimble Maps identity service, then send that token as Authorization: Bearer … on API calls.
Endpoints
URL (AWS): https://api.trimblemaps.com/identity/v2/token
URL (Azure): https://api.az.trimblemaps.com/identity/v2/token
curl -X POST 'https://api.trimblemaps.com/identity/v2/token' \
--header 'Content-Type: application/json' \
--data '{"apiKey":"YOUR_API_KEY_HERE"}'
Sample response:
{
"access_token": "eyJhbGciOiJ...",
"token_type": "Bearer",
"expires_in": 21600,
"refresh_token": "...",
"scope": "offline_access"
}
Use access_token as the Bearer value on subsequent requests.
Flow summary
- Obtain an API key from Trimble Maps.
POSTthe key toidentity/v2/token.- Read
access_token. - Call PCMWS with
Authorization: Bearer {token}. - When the token expires, authenticate again (or refresh if your client uses
refresh_token).
Option #2: API key
An API key is a 32-character hexadecimal string. It identifies the account and licensed features.
POST Method
Put the key in the Authorization header:
POST /apis/rest/v1.0/service.svc/route/routeReports HTTP/1.1
Host: pcmiler.alk.com
Authorization: YOUR_API_KEY_HERE
Content-Type: application/json
curl --location 'https://pcmiler.alk.com/apis/rest/v1.0/service.svc/route/routeReports' \
--header 'Authorization: YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data '{ /* request body */ }'
GET Method
Append the key as the authToken query parameter:
https://pcmiler.alk.com/apis/rest/v1.0/service.svc/maptile?authToken=YOUR_API_KEY_HERE&x=5&y=4&z=3
https://pcmiler.alk.com/apis/rest/v1.0/service.svc/locations?city=Princeton&state=NJ&authToken=YOUR_API_KEY_HERE
If both are present, the Authorization header is used. If the header is missing, the service falls back to authToken.
Choosing an option
| Situation | Recommendation |
|---|---|
| Simple Routing / Location / Mapping integration | API key on each request |
| Shared client that already uses Trimble JWT auth | Exchange key → JWT, then Bearer |
| GET map tiles or reverse geocode from a URL | API key via authToken
|
For classic PCMWS Routing, Mapping, and Location calls, API key on every request is the simplest path. JWT is useful when you already obtain tokens for other Trimble Maps APIs or want a short-lived credential instead of sending the key on every call.