Skip to main content

What does invalid_api_key mean?

invalid_api_key is returned with HTTP 401 when the request used a key the API does not accept. Create or copy a valid key from the Developer Portal.

J
Written by Javier Diaz

invalid_api_key is returned with HTTP 401 Unauthorized when the request used a key the API does not accept. Create or copy a valid key from the Developer Portal and authenticate with it.

Definition

This error means authentication failed because the key is missing, malformed, or not a current Enso API key. The request never reached routing.

How it works

  • Check that you send the key as Authorization: Bearer or as the apikey query parameter (the main API uses apikey, not api_key).

  • Create or copy a key in the Developer Portal and store it privately.

  • Verify it with GET https://api.enso.build/api/v1/account/accountId before you build routes.

  • The 401 response can include a portalUrl so you can send the user to create or recover a key.

How Enso does this

Authentication documents 401 with error: "invalid_api_key" separately from legacy_key_retired (also 401) and account_blocked (403). See Why did the Enso API return 401?

FAQ

Is this the same as a retired legacy key?

No. A retired legacy key returns legacy_key_retired. Both are 401 and both include a portalUrl, but the error field tells them apart.

Will I be charged credits for this 401?

Requests rejected before they are processed, including an invalid key, are not charged and do not include x-enso-credits-request.

Related articles

  • Why did the Enso API return 401?

  • What does legacy_key_retired mean?

  • Why is there a portalUrl in an Enso error?

  • How do I authenticate Enso API requests?

  • How do I get an Enso API key?

Sources

Did this answer your question?