What you will build

A script that turns an address into coordinates with the ArcGIS Geocoding service. Pick cURL, Python or JavaScript (Node.js 18+) in the code header: every step follows along in the language you chose.

You will need an API key with the Geocoding privilege from an ArcGIS Location Platform or ArcGIS Online account.

Each step with a request has a Run request button in the Result pane: it sends the request from your browser with the access token you enter below. Without a token, the pane shows a response captured earlier.

Set your access token

The service URL points at the World geocode service, and the access token authorizes every request. Paste your API key here; it fills the code, the downloads and the requests you run from this page, and stays in this browser.

Find address candidates

findAddressCandidates takes the whole address in singleLine. outFields picks the attributes each candidate returns and f=json asks for JSON.

Press Run request to send the same request from this page. It uses the access token you entered above; with the YOUR_ACCESS_TOKEN placeholder the service answers with error 498.

Each candidate has an address, a location and a score from 0 to 100. ArcGIS REST services report most errors inside an HTTP 200 response ({ "error": { "code": 498, … } }), so check for error before reading candidates.

When a request fails

Change a character of the access token above and run the request again. The service still answers 200 OK, but the body holds error 498: the Result pane marks it as a failure and explains it, because this tutorial describes the ArcGIS error format in requests/errors.json.