Examples
Copy an example. Understand it in five minutes. Adapt it to production. Every code block here calls a verified official HERE endpoint with parameters checked against HERE’s current specification. Where we could not verify something, we omitted the example rather than inventing it.How to use this section
These pages explain the code, not the concept. Why truck routing needs explicit dimensions belongs in Truck Routing. How to send the request belongs here. Parameter reference belongs to HERE. We link to it. We do not reproduce it, because it changes and a stale copy is worse than no copy. Nothing here is a starter template. Every example includes timeouts, error handling that distinguishes403 from 429, and the validation that prevents a route no vehicle can drive. Toy code that omits these teaches the wrong lesson at the moment someone copies it.
Setup
Every example reads the key from the environment. Never hardcode it, never put it in a query string in production code — URLs are logged by proxies, load balancers, and CDNs.HERE’s REST APIs accept the API key as an
apiKey query parameter, and most also accept an OAuth 2.0 Bearer token. The examples use apiKey because it is what HERE’s own specification documents for these endpoints.For production, consider proxying through your own backend so the key is never exposed and you can enforce per-tenant quota. See Multi-Tenant Location Platform.Error handling, once
Every example handles these the same way. We will not repeat the explanation on each page.
Retrying
403 is patient, well-engineered, and permanently futile. It generates support tickets.
The examples
Geocode an address
Address → coordinates, with confidence scoring and the access point.
Reverse geocode
Coordinates → address. Single and batch, with the telematics pattern.
Autocomplete an address
Debounced type-ahead. The one that bills per keystroke if you get it wrong.
Search nearby POIs
/discover vs /browse — relevance ranking vs distance ranking.Calculate a car route
The baseline.
departureTime, return fields, and empty-routes handling.Calculate a truck route
Constraints, units, and CI assertions against trap geometry.
Distance matrix
Async job lifecycle, and the flat array that transposes silently.
Batch geocoding
The job API.
204 is not an error.Related
Guides
What the APIs do and when to use them.
Architecture
Cost, caching, and the decisions that matter more than the API call.
HERE documentation
Need production HERE API keys or implementation support? Placematic is an official HERE Technologies reseller and implementation partner. Talk to us.