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.
Related reading
- Every HTTP status code, and when it shows up
The wider map: which codes you actually meet in production, and the pairs everyone confuses.
Other 4xx codes
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Content Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 (Unused)
- 419 Page Expired
- 421 Misdirected Request
- 422 Unprocessable Content
- 423 Locked
- 424 Failed Dependency
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 430 Shopify Security Rejection
- 431 Request Header Fields Too Large
- 440 Login Time-out (Microsoft)
- 444 No Response
- 449 Retry With (Exchange ActiveSync)
- 451 Unavailable For Legal Reasons
- 460 Client Closed Connection (AWS ALB)
- 463 Too Many Forwarded IPs (AWS ALB)
- 464 Incompatible Protocol Version (ALB)
- 494 Request Header Too Large
- 495 SSL Certificate Error
- 496 SSL Certificate Required
- 497 HTTP Request Sent to HTTPS Port
- 499 Client Closed Request