# Authentication (/docs/authentication)

## Free Tier

We offer a generous free tier so you can start using the API immediately. With 1,000 credits a month, it's perfect for testing and light usage.

> [Create an account](/signup) to get an API key and use the free tier — no credit card required.

## API Key Authentication

Every request must be authenticated with your API key. We support three methods of providing it:

**Authentication Methods**

- `X-API-Key: YOUR-API-KEY` (header): 
  Provide your API key in an HTTP request header.
- `Authorization: Bearer YOUR-API-KEY` (header): 
  Authenticate using standard Bearer token format.
- `?key=YOUR-API-KEY` (querystring): 
  Provide your API key as a URL query parameter.

## Example Authenticated Requests

```bash title="Authentication Examples"
# Using X-API-Key Header
curl -X GET "https://api.dns.tools/v1/domain?domain=google.com" \
  -H "X-API-Key: YOUR-API-KEY"

# Using Authorization Bearer Token
curl -X GET "https://api.dns.tools/v1/domain?domain=google.com" \
  -H "Authorization: Bearer YOUR-API-KEY"

# Using Query Parameter
curl -X GET "https://api.dns.tools/v1/domain?domain=google.com&key=YOUR-API-KEY"
```

```javascript title="JavaScript Fetch Example"
const response = await fetch('https://api.dns.tools/v1/domain?domain=google.com', {
  method: 'GET',
  headers: {
    'X-API-Key': 'YOUR-API-KEY'
    // or with Authorization Bearer Token (don't need both)
    // 'Authorization: Bearer YOUR-API-KEY'
  }
});

const data = await response.json();
```