# invalid_request Error (HTTP 400 or 405) | API Reference

URL: https://email-validation.org/docs/errors/invalid-request/
Updated: 2026-11-27

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

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

A parameter is missing, has the wrong type or is out of range, the `Authorization` header is not `Bearer <key>`, or the API key was sent in the URL (a query parameter named `api_key` in any spelling, such as `apiKey` or `API-KEY`, or any query value that looks like a key). The message names the fields at fault. A method the path does not take (such as `GET /v1/bulk`) is a `405` with an `Allow` header that lists the methods it does take, sent before the key is checked; `/a2a` does the same with `Allow: POST`. `/mcp` checks the key first: with a valid key, any method but `POST` gets its `405` with `Allow: POST` and a JSON-RPC body instead.

## What to do

Correct the request. Send the key in the Authorization header, never in the query string. On a `405`, use a method from `Allow`.

## 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": "invalid_request",
    "message": "The request is invalid.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}
```

API key sent in the URL:

```json
{
  "error": {
    "code": "invalid_request",
    "message": "Send the key in the Authorization header, not in the URL. See https://email-validation.org/docs/authentication/",
    "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).
- `Allow`: The method the path takes.

## Endpoints that can answer it

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

## More

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