invalid_api_key
HTTP status: 401 · Code: invalid_api_key
The API key is unknown, expired, or belongs to another project.
Why it happens
Section titled “Why it happens”The API key is unknown, expired, revoked, or belongs to another project.
How to fix
Section titled “How to fix”Create a new key in the console under the project’s API keys and set it in your server’s environment (for example ORVANO_API_KEY). Check that the endpoint and project match the install that issued the key.
Catch it in your code
Section titled “Catch it in your code”Every SDK throws one error type for a failed call. Match on its code, which is always invalid_api_key for this error, never on the message.
import { ErrorCode, OrvanoError } from '@orvano/js'
try { // your Orvano call} catch (error) { if (error instanceof OrvanoError && error.code === ErrorCode.invalidApiKey) { // handle invalid_api_key } else { throw error }}import 'package:orvano_flutter/orvano_flutter.dart'; // or orvano_dart on a server
try { // your Orvano call} on OrvanoException catch (error) { if (error.code != ErrorCode.invalidApiKey) rethrow; // handle invalid_api_key}using Orvano;
try{ // your Orvano call}catch (OrvanoException error) when (error.Code == ErrorCode.InvalidApiKey){ // handle invalid_api_key}The error also carries the HTTP status (401), a message, and a request ID. Quote the request ID when you report a problem: the server logs it with the failure. See Errors for how errors work in every SDK, or every error code.