Genace

MISSING_API_KEY: Authorization header must be: Bearer <api_key>

HTTP 401 MISSING_API_KEY
{
  "error": {
    "type": "unauthorized",
    "code": "MISSING_API_KEY",
    "message": "Authorization header must be: Bearer <api_key>"
  }
}

This is a request shape problem, not a credential problem. The gateway never got as far as checking whether your key is valid.

Three ways to trigger it

  1. No Authorization header at all. Most common when a proxy or SDK strips unknown headers, or when the header was set on the wrong request object.

  2. A header that is not Bearer <something>. Authorization: sk-abc… without the Bearer prefix fails here. So does Basic.

  3. Bearer with nothing after it. This one has its own message — “Authorization header is empty after Bearer” — and usually means a template rendered an empty variable:

    # $GENACE_API_KEY was unset
    curl -H "Authorization: Bearer $GENACE_API_KEY"

    Worth checking first, because it looks identical to a correct request in most logs.

The correct shape

curl https://genace.ai/api/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Not the same as INVALID_API_KEY

MISSING_API_KEYINVALID_API_KEY
Header present and well-formednoyes
What to checkhow you are sending itthe key itself

If you are getting INVALID_API_KEY, the header is fine and the key is the problem — see INVALID_API_KEY.

Where these facts come from

  • codebase: src/ai/api/auth.ts — header parsing and the two MISSING_API_KEY throws