Getting started overview
To begin using HERE Maps APIs, developers typically follow a sequence of steps: account registration, obtaining API access credentials, and executing an initial API request to validate the setup. This process ensures that the development environment is correctly configured for integrating HERE Maps's location services, such as geocoding, routing, or map rendering.
HERE Maps offers a free tier that includes 250,000 transactions per month, suitable for initial development and testing, with paid plans available for increased usage. Supported client-side SDKs include JavaScript, Android, iOS, Flutter, and React Native, while server-side interactions can be performed using standard HTTP requests with languages like Python or Java.
Quick Reference Guide
| Step | What to Do | Where |
|---|---|---|
| 1. Sign up | Create a free HERE developer account. | HERE Developer Portal |
| 2. Get API Keys | Generate an API key for authentication. | HERE Identity & Access Management documentation |
| 3. Make Request | Execute a sample API call (e.g., Geocoding API). | Geocoding & Search API reference |
| 4. Explore Docs | Review further API documentation and examples. | HERE Maps developer documentation |
Create an account and get keys
The first step in using HERE Maps services is to create a developer account. This registration provides access to the HERE Developer Portal, where API keys and project configurations are managed. HERE Maps offers a freemium plan allowing 250,000 transactions per month, which enables developers to explore and build applications without immediate cost.
-
Navigate to the HERE Developer Portal: Open a web browser and go to the HERE developer pricing page.
-
Sign Up: Click on the "Sign Up" or "Get Started" button, typically found at the top right or center of the page. You will be prompted to enter an email address, create a password, and agree to the terms of service.
-
Verify Email: After registration, HERE Maps will send a verification email to the address provided. Follow the instructions in the email to activate your account.
-
Access Dashboard: Once verified, log in to your developer account. This will lead you to the HERE Developer Dashboard.
-
Create a Project: Within the dashboard, you may need to create a new project. Projects help organize your API keys and usage data. Select a meaningful name for your project.
-
Generate API Key: For each project, you can generate one or more API keys. An API key is a unique alphanumeric string that authenticates your application's requests to HERE Maps APIs. Navigate to the "API Keys" section of your project and click "Create API Key." This process is detailed in the HERE Identity & Access Management guide.
-
Secure Your Key: Treat your API key as a sensitive credential. Do not embed it directly in client-side code that could be publicly exposed, and restrict its usage to specific domains if possible. For server-side applications, store keys securely, such as in environment variables.
Your first request
Once you have an API key, you can make your first API request to confirm your setup. The Geocoding & Search API is a common starting point, allowing you to convert addresses into geographic coordinates (geocoding) or vice versa. This example uses the cURL command-line tool, a widely used utility for making HTTP requests, and JavaScript for a client-side example.
Before proceeding, ensure you have your API key ready. Replace YOUR_API_KEY with the actual key generated from your HERE Developer Dashboard.
Using cURL (Command Line)
This cURL example performs a basic geocoding request to find the coordinates for "Pariser Platz, Berlin".
curl -X GET \
"https://geocode.search.hereapi.com/v1/geocode?q=Pariser+Platz%2C+Berlin&apiKey=YOUR_API_KEY"
Explanation:
-X GETspecifies the HTTP method as GET."https://geocode.search.hereapi.com/v1/geocode"is the endpoint for the Geocoding API.q=Pariser+Platz%2C+Berlinis the query parameter, specifying the address to geocode. URLs typically use%2Cfor commas and+for spaces.apiKey=YOUR_API_KEYpasses your authentication key.
A successful response will return a JSON object containing location data, including latitude and longitude. An example successful response structure from the Geocoding & Search API reference might look like this (abbreviated):
{
"items": [
{
"title": "Pariser Platz, Berlin, Germany",
"id": "here:geocoding:ep:59132100-3486-4444-9343-441d441d441d",
"resultType": "houseNumber",
"address": {
"label": "Pariser Platz, Berlin, Germany",
"countryCode": "DE",
"countryName": "Germany",
"state": "Berlin",
"city": "Berlin",
"street": "Pariser Platz"
},
"position": {
"lat": 52.51627,
"lng": 13.3777
},
"access": [
{
"lat": 52.51627,
"lng": 13.3777
}
],
"distance": 100
}
]
}
Using JavaScript (Browser)
For client-side applications, you can use the fetch API or HERE Maps's JavaScript SDK. Here's an example using fetch:
async function geocodeAddress(address) {
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key
const encodedAddress = encodeURIComponent(address);
const url = `https://geocode.search.hereapi.com/v1/geocode?q=${encodedAddress}&apiKey=${apiKey}`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log('Geocoding Result:', data);
// Process the data, e.g., display on a map
} catch (error) {
console.error('Error during geocoding:', error);
}
}
geocodeAddress('100 Main Street, Anytown, USA');
This JavaScript snippet makes an asynchronous request and logs the result to the console. For production, client-side requests should ideally use the HERE Maps JavaScript API for optimized performance and features, which abstracts some of the direct API calls.
Common next steps
After successfully making your first API call, consider these next steps for further integration and development:
-
Explore Other APIs: HERE Maps offers a suite of APIs beyond geocoding, including Routing API for directions, Maps API for displaying interactive maps, and Traffic API for real-time traffic information. Review the developer documentation to identify services relevant to your application's needs.
-
Integrate SDKs: For client applications (web, mobile), leverage the available SDKs (JavaScript, Android, iOS, Flutter, React Native). SDKs simplify integration by providing pre-built components and helper functions, reducing the amount of boilerplate code required. For example, the HERE Maps JavaScript API Quick Start Guide demonstrates how to embed an interactive map.
-
Implement Authentication Best Practices: For enhanced security and control, consider moving from direct API Key usage to OAuth 2.0 authentication for server-to-server communication, as outlined by general OAuth 2.0 specifications. Restrict API key usage by IP address or domain when possible within your HERE project settings.
-
Monitor Usage: Regularly check your API usage within the HERE Developer Dashboard to stay within your plan limits and understand your application's consumption patterns. This helps in anticipating billing and optimizing API calls.
-
Error Handling and Retries: Implement robust error handling in your application to gracefully manage failed API requests. This includes handling network issues, rate limits, and invalid parameters. Consider implementing retry mechanisms with exponential backoff for transient errors, as suggested in general API client development best practices.
Troubleshooting the first call
If your initial API request does not return the expected results, consider the following common issues and troubleshooting steps:
-
Invalid API Key: Double-check that the API key you are using exactly matches the one generated in your HERE Developer Dashboard. Even a single character mismatch will result in an authentication error (e.g., HTTP 401 Unauthorized).
-
Incorrect Endpoint or Parameters: Verify that the API endpoint URL is correct (e.g.,
geocode.search.hereapi.com) and that all required query parameters (likeqfor query, andapiKey) are correctly spelled and formatted. Refer to the Geocoding & Search API reference documentation for exact syntax. -
URL Encoding: Ensure that any special characters in your query (e.g., spaces, commas, ampersands) are properly URL-encoded. For instance, spaces become
%20or+, and commas become%2C. Most HTTP client libraries handle this automatically, but manual cURL requests require careful encoding. -
Network Connectivity: Confirm that your development environment has an active internet connection and that no firewalls or network policies are blocking outgoing requests to HERE Maps API domains.
-
Rate Limits Exceeded: While unlikely for a very first call, repeated requests in a short period could trigger rate limiting. Check the API response headers for
X-RateLimitinformation if you suspect this is the case. The HERE rate limiting documentation provides more details. -
Account Status: Log into your HERE Developer Dashboard to ensure your account is active and not suspended, and that your project has not been deactivated. Also, verify that you haven't exceeded your free tier limits, although this typically results in a different error code (e.g., HTTP 429 Too Many Requests).
-
Referer/Origin Restrictions: If you've configured API key restrictions based on HTTP Referer headers (for web applications) or IP addresses (for server applications), ensure that your request originates from an allowed source. Adjust these settings in your HERE project dashboard if necessary.
-
Consult Documentation and Support: If issues persist, review the HERE Maps developer documentation for specific error codes and their meanings. The HERE Developer Portal also offers support forums and contact options for further assistance.