API keys

An API key is a long term access token that you manually create, configure, and scope using the developer dashboard. Using API keys is typically the easiest way to access ArcGIS location services in your applications.

To use API keys, you need to have one of the following accounts:

  • ArcGIS Developer account
  • ArcGIS Online account

How to use an API key

You can use the developer dashboard to create and manage API keys to access location services. API keys can be scoped. Make sure you have properly scoped your key in order to access the service(s) or content item(s) required in your application.

This is the typical workflow for using an API key in your application:

  1. Determine the API key scope required for the application.
  2. Create and scope an API key using your dashboard. To create a key, go to the Create an API key tutorial.
  3. Use the API key in your code where authentication is required.

Example

Use an API key to display a basemap

Use dark colors for code blocksCopy
                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const apiKey = "YOUR_API_KEY";
const basemapURL = "https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Streets?type=style&token=";

olms(map, basemapURL + apiKey); // API key scoped to access the basemap layer service

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.