# Authentication

Every request carries your API key as a Bearer token.

## Get your API key

1. [Sign up](https://app.foxentry.com/registration) in the Foxentry app. New projects get a free trial.
2. Create a project of the type **Application / API**.
3. Open **Settings**, **API keys**, **Create API key**. Copy the key right away, it is shown only once.

A new key needs about a minute to start working. A `401` right after you created it usually means it is not active yet.

## Send your first request

Send the key in the `Authorization` header and the version in `Api-Version`.

**Request**

```curl
curl --request POST \
  --url https://api.foxentry.com/email/validate \
  --header 'Api-Version: 2.1' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "request": { "query": { "email": "p.novak@gmail.com" } } }'
```

`200` means the key works. `401` means the key is wrong, the `Bearer` prefix is missing, or the key does not allow your IP address.

## Keep the key safe

- Call the API from your server. Never put the key in frontend code, a mobile app or a public repository.
- Restrict the key to your server IP addresses in the project settings.
- Use a separate key for production and for testing.
