Skip to content

1. Sign up for an account

Create an account to generate developer credentials, access development tools, and monitor usage of ArcGIS services.

2. Get an access token

To access ArcGIS resources and services, you'll need an access token. The easiest way is to use API key authentication.

Learn more about the types of authentication and access tokens.

3. Make your first request

This example uses ArcGIS REST JS to make a request to the ArcGIS Geocoding service. For full installation instructions, including how to install the package using npm or yarn and import it as an ES module, go to Install and setup.

Install the required packages by running the following script.

Use dark colors for code blocksCopy
1
2
npm install @esri/arcgis-rest-request
npm install @esri/arcgis-rest-geocoding

In your JavaScript file, paste the following code snippet. Replace YOUR_ACCESS_TOKEN with your access token.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

import { ApiKeyManager } from "@esri/arcgis-rest-request";
import { geocode } from "@esri/arcgis-rest-geocoding";

const accessToken = "YOUR_ACCESS_TOKEN";
const authentication = ApiKeyManager.fromKey(accessToken);

geocode({
  address: "1600 Pennsylvania Ave",
  postal: 20500,
  countryCode: "USA",
  authentication
}).then((response) => {
  console.log(JSON.stringify(response, null, 2));
});

For step-by-step instructions, go to the Search for an address tutorial.

4. What's next?

Learn more about accessing additional ArcGIS services with ArcGIS REST JS.

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