Skip to content

Create an API key

Learn how to create an API key credential to get an access token.

API key credentials
The developer credentials creation interface in a portal

To access ArcGIS services and resources with an access token, you need to configure the privileges for an API key credential in your portal. In your portal, you can also restrict referrer URLs and to set the expiration date for your credential.

In this tutorial, you will create an API key credential to get an access token to use in your application.

Prerequisites

  1. You need an ArcGIS Location Platform or ArcGIS Online account.

  2. You need to know the services and content that you want to access in your application.

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.

  1. Sign in to your portal.

  2. In your portal, click Content > My content > New item.

  3. Click Content > My content > New item.

  4. Click Developer credentials > API key credentials and click Next.

  5. In the Create developer credentials window, click on the Expiration date field. Set the expiration date to one month from today's date.

  6. Set the Referrers field to include only the web domains you would like your access token to be used from.

  7. Click Next.

Select location services privileges

Your access token needs to have the correct privileges to access the content and services in your app. If you are following another ArcGIS tutorial, please refer to it to see the list of required privileges.

  1. In the Privileges window, browse the available privileges.

  2. Select the privileges required by your application and click Next.

Grant item access

The Item access menu allows you to browse your portal's content and grant your access token to specific private items.

  1. If your access token does not require item access, click Skip.

  2. Otherwise, in the Grant item access window, click Browse items.

  3. Select the items you want to grant access to. You can select up to 100 items in this menu.

  4. 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.

  1. In the Create developer credentials window, set the following properties:

    • Title: My API key credential
    • Folder: Developer credentials (Create a new folder)

    Click Next.

  2. In the Summary window, review the properties, privileges, and item access you have set. Then, click Next.

  3. 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.

  4. Click Next.

  5. 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.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.