Learn how to use the developer dashboard to create and configure an API key to access ArcGIS resources.

An Application programming interface key (API key) is a permanent access token that defines the scope and permission for granting applications access to ArcGIS location services and content items.
In this tutorial you learn how to:
- Create a new API key
- Set location service and content item scopes
- Set referrers
- Use an API key in code
- Monitor API key usage
Prerequisites
Steps
Create a new API key
To create a new key, you use the developer dashboard.
-
Go to the API key page in your developer dashboard.
-
On the left, click +New API Key.
If you have an ArcGIS Developer account, a default key was created for you when you signed up.

If you have an ArcGIS Online account, you will need to create a new API key.


- Set a Title and Description for the key > Create API key.
Set location service scopes
When you create a new key, it is automatically configured to access some ArcGIS location services. You can add or remove services to customize the scope of the API key.
If you have an ArcGIS Developer account, the following services are scoped by default:
- Basemaps
- Geocoding (not stored)
- Routing
- Service areas
If you have an ArcGIS Online account, an API key, by default, has the following scopes set:
- Basemaps
- Geocoding (not stored)
-
Go to the API key page in your developer dashboard.
-
Choose the API key that you want to edit. In the API key box, click Edit API key.


- In the Overview, find the Location services box and click Set service scopes.

- In the window, check or uncheck the service cards to set the scope of your key. The scopes available depend on the type of account you have.
If you have an ArcGIS Developer account, you need to enable pay-as-you-go to add the scope for some services and service functionality such as Geocoding (stored), Optimized routing, and the GeoEnrichment service. Enable pay-as-you-go in the Billing section of the developer dashboard.

If you have an ArcGIS Online account, you need a user type of Creator or higher to access all scopes.

- Click Apply to set the scopes.
Set content item scopes
If you have an ArcGIS Developer account, you can use API keys to access private content items. However, there are only a limited set of item types. You cannot access this feature with an ArcGIS Online account. To learn more about limitations and restrictions, go to ArcGIS data service scopes.
-
Go to the API key page in your developer dashboard.
-
Choose the API key that you want to edit. In the API key box, click Edit API key.
-
In the Overview, find the Maps, layers, and data box. If you have an ArcGIS Developer account, you will be able to click Set content item scopes.


- Select the items that you want the API key to access and the Add item(s).

Set a referrer
An HTTP referrer
is an HTTP header field used to identify the client requesting a server resource. This functions as a security measure, allowing applications to confirm their client's identity. If an API key does not have a referer
, any request that uses the API key is valid. Learn more in API key referrers.
-
Go to the API key page in your developer dashboard.
-
Choose the API key that you want to edit. In the API key box, click Edit API key.
-
In the Overview, find the Referrers box > Add Referrer.

- Enter the referrer address, such as
http:
or//localhost: 8000 https:
> Add Referrer Header.//*.your-app.com
Set the API key in an application
After you create and configure an API key, you can copy the key from the dashboard and use it in an application.
-
Set the API key scopes to access the services and content items required by your application.
-
Copy the key from your dashboard.
-
Set the key in the application code. Learn more in How to use API keys in apps.
esriConfig.apiKey = "YOUR_API_KEY";
const map = new Map({
basemap: "arcgis-navigation"
});
Monitor API key usage
It is recommended that you regularly monitor your API key usage for irregularites and to frequently rotate API keys to prevent unauthorized access. The usage that is recorded depends on the services accessed by the API key.
-
Go to the API key page in your developer dashboard.
-
Choose an API key. In the API key box, click View usage.


- In the dropdown, select a billing cycle or time interval to view the usage of the key. To view an example graph, go to Monitor usage.
Restrict API key deletion
You can enable delete protect to prevent the API key from being deleted.
-
Go to the API key page in your developer dashboard.
-
Choose the API key that you want to edit. In the API key box, click Edit API key.
-
Click the Settings tab.
-
Toggle the protection icon to enable deletion.
What's next?
Learn how to use additional tools, APIs, and location services in these tutorials:

Display a map
Create and display a map with the basemap styles service.

Display a scene
Display a scene with the basemap styles service.

Search for an address
Convert an address or place to a location with the geocoding service.

Find place addresses
Find an address, business, or place with the geocoding service.

Query demographic data
Query demographic information for locations around the world with the GeoEnrichment service.