# INVALID_API_KEY or AUTHENTICATION_REQUIRED: the API key is missing or invalid

> The request has no Authorization: Bearer header, or the key does not exist, is malformed or was revoked.

Source: https://api.sharkpos.cl/en/errors/invalid-api-key/

Checked on 2026-11-25 against the SharkPOS API code · [Markdown](/en/errors/invalid-api-key.md)
`INVALID_API_KEY` · HTTP 401
Message you may see:
- `La credencial del emisor es inválida o está inactiva. (The issuer's credential is invalid or inactive.)`
- `La credencial del emisor tiene un formato inválido. (The issuer's credential has an invalid format.)`
- `Credencial de API requerida. (API credential required.)`

## What it means
The request does not carry `Authorization: Bearer <API_KEY>` (AUTHENTICATION_REQUIRED) or the key does not exist, is malformed or was revoked (INVALID_API_KEY).

## Why it happens
- You use a sandbox key against production, or the other way around: they are different environments.
- The environment variable was not loaded and an empty value is sent.
- The word `Bearer` is missing or there is an extra space or line break from copying the key.
- The key was revoked from the dashboard.

## How to fix it
- Check the base URL: sandbox `https://sandbox.sharkpos.cl`, production `https://api.sharkpos.cl`.
- Send the exact header `Authorization: Bearer <API_KEY>`.
- If you lost it, create another: it is stored as a hash and cannot be recovered.

**Should you retry?** Not until the key is fixed.
All API errors are JSON: `{"status": "error", "code": "...", "message": "...", "solution": "..."}`. The `code` is stable; `message` and `solution` are in Spanish. Full table in the [guide for agents](/en/docs/agents.md).

## Related
- [SANDBOX_TRIAL_EXPIRED: your sandbox trial access has ended](/en/errors/sandbox-trial-expired/)

Integrating receipts or invoices? Try it in the [sandbox](/sandbox/), without touching the real SII.
