# unauthorized Error (HTTP 401) | API Reference

URL: https://email-validation.org/docs/errors/unauthorized/
Updated: 2026-11-26

> Documentation index: https://email-validation.org/llms.txt

**HTTP 401** · no credit is used for a request that ends in an error.

No API key was sent, or the key is not valid: unknown, revoked, expired or replaced by a roll.

## What to do

Send a current key as `Authorization: Bearer <key>` (or `X-Api-Key`). Create a new key in the dashboard if needed.

## Retry

No: fix the request. When and how often to retry any error: [retrying safely](https://email-validation.org/docs/errors/#retries).

## The answer

```json
{
  "error": {
    "code": "unauthorized",
    "message": "A valid API key or session is required.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}
```

No API key sent:

```json
{
  "error": {
    "code": "unauthorized",
    "message": "Send your API key in the Authorization header: Bearer <key>.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}
```

API key not valid:

```json
{
  "error": {
    "code": "unauthorized",
    "message": "The API key is not valid.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}
```

Branch on `code`, which is stable; `message` is for people and may change. Keep `request_id` in your logs.

Headers that come with it:

- `X-Request-Id`: Our ID for the request (same as `request_id` in bodies).
- `WWW-Authenticate`: The authentication scheme and the OAuth protected resource metadata (RFC 9728; `/mcp` answers with `WwwAuthenticateMcp`). When a key or access token was sent and refused, the challenge also carries `error="invalid_token"`, as in the example.

## Endpoints that can answer it

- [`GET /v1/validate`](https://email-validation.org/docs/api-reference/validate-email-query/) (`401`)
- [`POST /v1/validate`](https://email-validation.org/docs/api-reference/validate-email/) (`401`)
- [`GET /v1/credits`](https://email-validation.org/docs/api-reference/get-credits/) (`401`)
- [`GET /v1/usage`](https://email-validation.org/docs/api-reference/get-usage/) (`401`)
- [`POST /v1/bulk`](https://email-validation.org/docs/api-reference/create-bulk-job/) (`401`)
- [`GET /v1/bulk/{id}`](https://email-validation.org/docs/api-reference/get-bulk-job/) (`401`)
- [`DELETE /v1/bulk/{id}`](https://email-validation.org/docs/api-reference/cancel-bulk-job/) (`401`)
- [`POST /v1/bulk/{id}/start`](https://email-validation.org/docs/api-reference/start-bulk-job/) (`401`)
- [`GET /v1/bulk/{id}/results`](https://email-validation.org/docs/api-reference/get-bulk-job-results/) (`401`)
- [`GET /mcp`](https://email-validation.org/docs/api-reference/#mcpstream) (`401`)
- [`POST /mcp`](https://email-validation.org/docs/api-reference/#mcprequest) (`401`)
- [`POST /a2a`](https://email-validation.org/docs/api-reference/#a2arequest) (`401`)

## More

- [Every error code](https://email-validation.org/docs/errors/#codes)
- [Retrying safely](https://email-validation.org/docs/errors/#retries)
