API key authentication is a type of authentication that uses long-lived access tokens
API key authentication is the easiest type of authentication to use, but it is not sufficient to protect confidential information. It is recommended only if you are an ArcGIS developer working exclusively with public information and basic location services
You can use API key authentication to:
- Create public applications
A public application is an application that allows anonymous access without requiring users to sign in with an ArcGIS account. It supports API key or app authentication. that do not require users to sign in. - Build applications that access location services
ArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. and private items such as hosted layersA hosted layer is an item in a portal that contains the properties and settings for a hosted data service or a layer in a hosted data service. and data servicesData services, also known as hosted data services, are services created dynamically to store and provide access to your data in ArcGIS. Examples are feature services, vector tile services, map tile services, image services, and scene services. . - Create personal automation scripts that access the portal service
A portal service provides the functionality to securely create, access, and manage content, data services, users, and groups in a portal. The service can be hosted by Esri or in ArcGIS Enterprise. and spatial analysis servicesSpatial analysis services are services that perform geometry and statistical analyses on feature and raster data. . - Quickly and easily generate access tokens
An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. . - Embed an access token
An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. directly into apps that remains valid for up to 1 year. - Access secure resources with the privileges of your ArcGIS account
An ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. .
How API key authentication works
API key authentication requires creating and configuring API key credentials
The general steps to implement API key authentication are:
-
Create API key credentials
API key credentials are an item that contains the parameters used to create and manage long-lived access tokens for API key authentication. They are a type of developer credential. to get an API key. -
Paste the API key
An API key is a long-lived access token created using API key credentials. They are valid for up to one year and are typically embedded directly into client applications. access token into your application. -
Your application uses the API key as an access token
An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. to access secure resourcesA secure resource is any item or service in an ArcGIS that requires an ArcGIS account and authentication to access. Examples include ArcGIS Location Services, and items and data services in an ArcGIS portal. .
Your API key must have the correct privileges
API key credentials
API key credentials
API key authentication requires API key credentials. The most common pattern is to create a new API key credentials item
Tutorials
Create an API key
Create and configure API key credentials to get a long-lived API key access token.
Manage API key credentials
Manage previously created API key credentials to regenerate, edit privileges, and edit item access of API keys.
Update to API key credentials
Migrate from an API key (legacy) created before June 2024 to an API key from API key credentials.
Rotate API keys
Hybrid authentication
In ArcGIS APIsAuthentication and Identity classes automatically implement a hybrid approach when using both API key authentication
Applications can use both API keys and user authentication, utilizing their API key to access services while the user is signed out and then switching to an access token
Product and account requirements
API key authentication is available with ArcGIS Location Platform
ArcGIS Location Platform
All ArcGIS Location Platform accounts have the correct privileges to manage API key authentication by default.
ArcGIS Online
API key authentication requires an ArcGIS Online account with a user type of Creator or higher. The account must also have these additional privileges
- General privileges > Content > Assign privileges to OAuth 2.0 applications
- General privileges > Content > Generate API keys
Your organization administrator can grant you these privileges using a custom role. Learn more in the FAQ.
ArcGIS Online Trial: API key authentication is not available in ArcGIS Online Trial subscriptions.
ArcGIS for Personal Use: API key authentication is not available in ArcGIS Online subscriptions purchased through ArcGIS for Personal Use.
ArcGIS Hub: API key authentication is not available with for accounts with the Hub Community Member user type. This includes community administrators.
ArcGIS Enterprise
API key authentication requires an ArcGIS Enterprise account with a user type of Creator or higher. The account must also have these additional privileges
- General privileges > Content > Assign privileges to OAuth 2.0 applications
- General privileges > Content > Generate API keys
Your organization administrator can grant you these privileges using a custom role. Learn more in the FAQ.
Version requirement: API key authentication is only available with ArcGIS Enterprise
Limitations
Location services
ArcGIS Enterprise limitations: API key authentication cannot be used to access ArcGIS Location Services
API key credentials
Creating credentials: There is no limit to the number of API key credentials and API keys you can create.
Accessing items: An API key credential can be configured to access a maximum of 100 items
Viewing API keys: The value of an API key
Changing properties: Editing any of the privileges
API keys (legacy)
Prior to June 2024, API key authentication used API keys (legacy)
Service support
The following table provides an overview of the functionality available with each type of authentication:
| API key authentication | User authentication | App authentication | |
|---|---|---|---|
| ArcGIS Location Services | 1 | 1 | 1 |
| Data services (Item access) | 2 | ||
| Spatial analysis services | 1 | 1 | |
| Portal service (General privileges) | |||
| Portal service (Admin privileges) |
- 1. Supported with ArcGIS Online and ArcGIS Location Platform.
- 2. Supported, but not recommended due to security risks.