Learn how to manage API key credentials to generate API keys and manage their privileges and item access.
API key credentials are a type of developer credentials used in API key authentication. You can manage the settings of your API keys from the item page of your API key credentials.
This tutorial shows how to manage API key credentials in your portal to complete the following tasks:
-
Edit privileges to enable access to the geocoding service.
-
Edit item access to enable access to a private feature layer.
-
Regenerate an API key to apply the new privileges and item access rights.
-
Generate a secondary API key with a new expiration date.
Prerequisites
Steps
Sign in to your portal
You use your portal to create and manage items, including API key credentials.
- Sign in to your portal with your ArcGIS account.
Find your API key credentials
Developer credentials are stored as an item in your portal. Go to the item page of your credentials to manage their settings.
-
Go to Content > My content.
-
Search for the developer credentials you created in the prerequisites step.
-
Click on the developer credentials to go to its item page.
Edit privileges
The privileges of API key credentials are managed through the settings on their item page. Add privileges to your credentials to enable access to the geocoding service.
-
Go to Settings on the item page of your API key credentials.
-
Under Application > Privileges, click the Edit privileges button.
-
Select new privileges for your API keys using the Edit privileges window. The privileges used in this scenario are:
- Privileges: Location services > Geocoding > Geocoding (not stored)
To view a list of all privileges available to API keys, go to Privileges.
-
Click Save. In the warning that appears, click Yes.
Edit item access
The items your API key credentials are authorized to access are managed through the settings of their item page. Edit the item access of your API key credentials to enable access to a feature layer in your application.
-
Go to Settings on the item page of your API key credentials.
-
Under Application > Privileges, click the Edit item access button.
-
From the Edit item access window, select the feature layers you created in the Prerequisites:
- Trailheads
- Trails
- Parks and Open Space
This will grant your API key credentials access to the layers.
-
Click Save. In the warning that appears, click Yes.
Generate a new API key
Editing privileges and item access will invalidate all existing API keys associated with the credentials. You must generate a new API keys to use it in your application.
-
Go to Settings on the item page of your API key credentials.
-
Under Application > API keys, click Generate API key.
-
Copy the API key from the window that appears and store it in a safe location. You will not be able to see it again.
You can also generate a secondary API key using the same API key credentials. This secondary key has identical privileges and item access to the first key with a new expiration date.
What's next?
Your API key now has the correct privileges to access the geocoding service as well as your private feature layers. Use the key to complete one of the following tutorials:
Search for an address
Convert an address or place to a location with the geocoding service.
Add a feature layer
Access and display point, line, and polygon features from a feature service.