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
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:
- Determine the API key scope required for the application.
- Create and scope an API key using your dashboard. To create a key, go to the Create an API key tutorial.
- Use the API key in your code where authentication is required.
const apiKey = "YOUR_API_KEY";
apiKey: apiKey //Scoped to access the basemap styles service