# Fix common API errors

> The usual causes of 401, 402, 403, 400 and 429, and of answers that look wrong.

Start with the HTTP status and the `error` code in the body. The full list is in [Errors, credits and rate limits](https://support.phone-check.app/api-reference/errors-credits-and-rate-limits).

## 401 AUTHENTICATION_FAILED

A key was sent but doesn't work.

- Check the header name is exactly `x-api-key`.
- Check the key under **API keys**: it may be deleted, switched off (**Enabled**) or past its **Expiration**.
- Check for spaces or line breaks copied with the key.

## 403 with no key in your code

A request without an `x-api-key` header is treated as the website's free try and is refused. Make sure your HTTP client actually sends the header; some proxies and clients drop custom headers.

## 403 from a key

The key's permission doesn't allow the request. Lookups need at least `read`; see [Create and manage API keys](https://support.phone-check.app/getting-started/create-and-manage-api-keys).

## 402 INSUFFICIENT_CREDITS

The workspace is out of credits. Add credits or a plan under **Plans & credits**, or turn on auto top-up. Retry the lookups that got `402`: they weren't verdicts on the numbers.

## 400 VALIDATION_ERROR

Usually the `phone` parameter: it must be 6 to 20 characters, in international format (`+` and the country code) or a 10-digit NANP number.

## 429

You went past the rate limit. Wait the `Retry-After` seconds, then retry. For big lists, use the [Bulk Checker](https://support.phone-check.app/bulk-validation/validate-a-csv-list).

## The answer looks wrong

- **A valid number comes back invalid**: check you URL-encoded the `+`. In a query string a raw `+` becomes a space, so send `%2B` (curl `--data-urlencode`, or `encodeURIComponent` in JavaScript).
- **A number without a country code reads as US**: a 10-digit number is read as NANP. Always send other countries with `+` and their code.
- **extra-details or full-details has no carrier block fields**: the number isn't a NANP number in the NPA-NXX registry, so you get the standard fields and are charged 1 credit.
- **The carrier differs from what the person says**: block data describes the original assignment, and numbers can be ported. Check `portable`.

Still stuck? Send the endpoint, the number's country, the time of the request and the full error body (never your API key) through the [contact form](https://phone-check.app/contact-us).
