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. This means you need to ensure you have properly scoped (enabled access) to the service(s) or content item(s) required in your application.


The typical workflow when using an API key in Esri Leaflet is to:

  1. Determine the API key scope required for the application.
  2. Create and scope an API key using your dashboard.
  3. Set the API key where authentication is required.


Set an API key

Use dark colors for code blocks
  const apiKey = "YOUR_API_KEY";

    apiKey: apiKey //Scoped to access the basemap layer service

To learn more, go to the Create an API key tutorial.

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