Get Started with Node.js

Make sure you have polyfills for fetch and FormData installed before using any ArcGIS REST JS library. You can find npm install commands for all packages in the API reference.

npm install @esri/arcgis-rest-request @esri/arcgis-rest-auth isomorphic-fetch isomorphic-form-data

Require the isomorphic-fetch and isomorphic-form-data modules before using any of the ArcGIS REST JS methods.


const { request } = require("@esri/arcgis-rest-request");


Demo - Express Application


To access premium content and services without asking for user credentials, using a Proxy Service or App Login is typically the best approach.

Proxy Service

// no auth required

App Login

const { ApplicationSession } = require("@esri/arcgis-rest-auth");

const authentication = new ApplicationSession({
  clientId: "public",
  clientSecret: "secret"

// url not accessible to anonymous users
const url = ``

// token will be appended by rest-js
request(url, {

Demo - batch geocoding

Applications cannot create, share, access or modify items in ArcGIS Online or ArcGIS Enterprise. For this, a UserSession is more appropriate.

const { UserSession } = require("@esri/arcgis-rest-auth");

// hardcoded username / password
const authentication = new UserSession({
  username: "jsmith",
  password: "123456"

See the Browser Authentication for more information about implementing OAuth 2.0.