> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.usglobalmail.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.usglobalmail.com/_mcp/server.

# Unauthorized

Returned as `application/problem+json` with `code` `unauthorized` and HTTP status `401`.

Authentication failed. The API key is missing, malformed, revoked, or does not match the environment.

## Common causes

* No `Authorization` header was sent.
* The header is not in the form `Bearer usgmk_…`.
* The key was rotated, revoked, or expired.
* Environment mismatch — a `usgmk_test_…` key against production, or a `usgmk_live_…` key against the sandbox.

## How to resolve

* Send `Authorization: Bearer usgmk_live_…` (or `usgmk_test_…` against the sandbox).
* Confirm the key is active in your [dashboard](https://inbox.usglobalmail.com/app/settings/developer/api-keys); rotate it if needed.
* Use the key that matches the environment you are calling.

## Example

```json
{
  "type": "https://docs.usglobalmail.com/api/problems/unauthorized",
  "title": "Authentication is required or the API key is invalid.",
  "status": 401,
  "code": "unauthorized",
  "request_id": "req_8f3c2a1b9d",
  "instance": "/v1/mails"
}
```

> **Note**
>
> Retrying without changing the request will not help — fix the request first.

See also: [Authentication](/guides/core-concepts/authentication).