Use the portal to create an API key credential and access token to access your custom basemap style.

Prerequisites
-
You need an ArcGIS Location Platform or ArcGIS Online account.
-
You need to complete Step 1. Create a custom style.
Steps
Create an API key credential
You need to create an API key credential in your portal to generate an access token that you can use in requests to ArcGIS services. The privileges you set for the credential determine the capabilities of the token.
The expiration date and referrer URLs to restrict how long the access token can be used and the domain where it can be used.
-
Sign in to your portal.
- ArcGIS Location Platform: Go to https://location.arcgis.com and sign in. In the dashboard, click My portal to go to your portal.
- ArcGIS Online: Go to https://arcgis.com and sign in.
-
In your portal, click Content > My content > New item.
-
Click Content > My content > New item.
-
Click Developer credentials > API key credentials and click Next.
-
In the Create developer credentials window, click on the Expiration date field. Set the expiration date to one month from today's date.
-
Set the Referrers field to include only the web domains you would like your access token to be used from.
-
Click Next.
Need troubleshooting help?
If the Developer credentials option is not visible when creating a new item, your ArcGIS Online account does not have the correct permissions. You need an ArcGIS account with a user type of Creator or higher. Learn more about user types in the ArcGIS Online documentation.
If the API key credentials option is not visible when creating developer credentials, your ArcGIS Online account does not have the correct permissions. You need an ArcGIS account with a user type of Creator or higher. Your account must also have these additional privileges:
- General privileges > Content > Generate API keys
- General privileges > Content > Assign privileges to OAuth 2.0 applications
Your organization administrator can grant you these privileges using a custom role. To learn how, go to the ArcGIS Online documentation.
Still need help? Go to the Security and authentication guide.
Select location services privileges
Set the correct privileges so the access token can access services required in your app.
- In the Privileges window, check the following privilege(s).
- Location services > Basemaps
- Click Next.
Grant item access
Grant item access so that the token can access private items in your portal.
-
In the Grant item access window, select the custom basemap item you just created.
-
Click Add items.
Copy the access token
After configuring the properties of your API key credential, you can save it as a new item and generate an access token.
-
In the Create developer credentials window, set the following properties:
- Title:
My AP
I key credential - Folder:
Developer credentials
(Create a new folder)
Click Next.
- Title:
-
In the Summary window, review the properties, privileges, and item access you have set. Then, click Next.
-
To get your access token, select Generate the API key and go to item details page. I am ready to copy and save the key.
-
Click Next.
-
Copy the access token from the window that appears and store it in a safe location.
Now you have an API key credential and access token that allows your application to access ArcGIS services and content.