Skip to content
Control Plane Labs

498 Invalid Token (Esri ArcGIS)

Client error response defined by developers.arcgis.com.

Written and maintained by Ben Ennis

Last reviewed November 23, 2026 · How we verify this

Common causes at a glance

  • An access token that passed its expires_in lifetime
  • A token generated with client=referer used from a different origin
  • A token from one portal or ArcGIS Server sent to another
  • A token revoked after a password change or app credential rotation

Reproduce it

curl -s 'https://services.arcgis.com/ORG/arcgis/rest/services/Layer/FeatureServer/0/query?where=1=1&f=json&token=expired'

What 498 Invalid Token (Esri ArcGIS) means

In ArcGIS, 498 is the “get a new token and try again” signal. The service recognized that you tried to authenticate, but the token is past its expiry, was revoked, was generated for a different referrer or IP, or belongs to another portal. Esri’s platform error codes list 498 as an invalid or expired access token and 499 as a required token that was missing. On nginx, 499 means something unrelated: the client closed the connection.

There is no RFC

498 is unassigned in the IANA registry. Esri documents it in the ArcGIS SDK platform error codes and in the REST authentication operations reference, which shows the JSON body {"error": {"code": 498, "message": "Invalid Token"}} and says a refresh token can be exchanged for a new access token. Watch for the transport detail: ArcGIS REST endpoints often return HTTP 200 with the error code inside the JSON body, so check both the status line and error.code. Service type definitions such as the elevation service list 498 and 499 as error codes.

What actually causes it

Expiry is the common case, and it shows up on a timer: a long-running dashboard or ETL job works for an hour and then fails every request. Track expires_in and refresh before it runs out instead of waiting for 498. Referer-bound tokens produce a nastier pattern, working in the browser and failing from a server or a different hostname, because the token is tied to the referrer it was generated for.

How to debug it

Decide whether the token is expired or mismatched. Regenerate one and repeat the exact request. If a fresh token works, it was expiry. If it still fails, compare the token’s client binding (referer, ip or requestip) with where the request is coming from:

curl -s "$LAYER/query?where=1=1&returnCountOnly=true&f=json" -H "Authorization: Bearer $TOKEN"

Working examples

curl

# Esri often answers 200 with the code in the body, so print both.
curl -s -w '\nHTTP %{http_code}\n' \
  -H "Authorization: Bearer $TOKEN" \
  "$LAYER/query?where=1=1&returnCountOnly=true&f=json"

Python (requests)

import requests

r = requests.get(f"{layer}/query", params={"where": "1=1", "f": "json"},
                 headers={"Authorization": f"Bearer {token}"}, timeout=15)
code = r.json().get("error", {}).get("code", r.status_code)
if code in (498, 499):
    token = refresh_token()  # then retry once

Node (fetch)

const res = await fetch(`${layer}/query?where=1=1&f=json`, {
  headers: { Authorization: `Bearer ${token}` },
});
const body = await res.json();
const code = body.error?.code ?? res.status;
if (code === 498 || code === 499) console.log("refresh the ArcGIS token and retry");

Reference and tooling

The authoritative list of assigned status codes is theIANA HTTP Status Code Registry. For a searchable copy with the semantics summarised, use theHTTP status code reference on this site. To see exactly what a server is sending, theheader inspector shows the raw status line and response headers, and thecurl builder assembles the request flags for you.

Other 4xx codes