A 401 Unauthorized response means the API key is invalid, or a retired legacy key was used. Create or replace the key in the Developer Portal and authenticate with the new key.
Definition
401 is an authentication failure. The request never reached routing. It is not a “no path found” error and it is not a rate-limit error.
How it works
Typical causes:
The key is missing, mistyped, or loaded from the wrong environment.
The key was revoked or never created.
The client is still sending a retired legacy key (
error: "legacy_key_retired").An invalid key is sent as
error: "invalid_api_key".
Both of those 401 responses include a portalUrl so you can send the user to create or recover a key.
How Enso does this
Create a key in the Developer Portal. Send it as Authorization: Bearer <API_KEY> or as the apikey query parameter. Verify it with GET https://api.enso.build/api/v1/account/accountId before you build routes. See Authentication.
FAQ
Does a 401 consume API credits?
Requests rejected before they are processed, including an invalid key, are not charged and do not include x-enso-credits-request.
How is this different from 403?
403 with error: "account_blocked" means API access is disabled for the account, not that the key string is simply wrong.
Related articles
How do I get an Enso API key?
Why did the Enso API return 403?
Why did the Enso API return 429?
How do I authenticate Enso API requests?
Should I hardcode Enso contract addresses?
