Skip to main contentSkip to FAQSkip to contact
HTTP 401Authentication

invalid_key

API key is invalid, revoked, or from the wrong environment.

Back to all errors

What this means

The API key was parsed but rejected - either it has been revoked, never existed, or belongs to a different environment (e.g. test key on live endpoint).

How to recover

Rotate your key via the dashboard and confirm the environment prefix (tk_live_ vs tk_test_).

Example response

All TetraFi errors include a stable code, a human-readable message, and a docs_url pointing to this page.

JSON
1{
2 "error": {
3 "code": "invalid_key",
4 "message": "API key is invalid, revoked, or from the wrong environment.",
5 "docs_url": "https://tetrafi.io/docs/integration/errors/invalid_key/"
6 }
7}
7 linesjson

Match in code

TypeScript
1try {
2 await tetrafi.rfq.create({ /* ... */ });
3} catch (err) {
4 if (err.code === "invalid_key") {
5 // Rotate your key via the dashboard and confirm the environment prefix (tk_live_ vs tk_test_).
6 }
7 throw err;
8}
8 linestypescript

Related authentication errors