---
title: "Authentication"
description: "Learn how to authenticate with the Quote Gallery API using API keys."
canonical_url: "https://docs.quotegallery.nl/docs/getting-started/authentication"
---
# Authentication

> Learn how to authenticate with the Quote Gallery API using API keys.

Every request to the Quote Gallery API must include a valid API key. Authentication is done with a single `X-API-Key` header - no OAuth flows, no token exchange.

## Getting your API key

1. Sign in to your [Quote Gallery account](https://quotegallery.nl/auth/login)
2. Open **API keys** in your dashboard
3. Click **Create API key**, give it a name, and optionally choose when it expires (7 days up to 1 year, or never)
4. Copy the key somewhere safe

<callout icon="i-lucide-triangle-alert">

Your API key is only shown once. If you lose it, generate a new one from the dashboard.

</callout>

## Making authenticated requests

Pass the key in the `X-API-Key` header on every request. The API also accepts it as `Authorization: Bearer <key>` if your HTTP client makes that easier.

<tabs>
<tabs-item label="cURL">

```bash
curl -H "X-API-Key: your_api_key_here" \
  https://quotegallery.nl/api/v1/quotes
```

</tabs-item>

<tabs-item label="JavaScript">

```js
const response = await fetch('https://quotegallery.nl/api/v1/quotes', {
  headers: {
    'X-API-Key': process.env.QUOTE_GALLERY_API_KEY,
  },
})

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

</tabs-item>

<tabs-item label="Python">

```python
import requests, os

response = requests.get(
    'https://quotegallery.nl/api/v1/quotes',
    headers={'X-API-Key': os.environ['QUOTE_GALLERY_API_KEY']}
)

data = response.json()
```

</tabs-item>
</tabs>

## Security

Keep your API key out of client-side code. Store it as an environment variable and only use it in server-side requests. If you need to show quotes on a public page without exposing the key, use the [Iframe Embed](https://docs.quotegallery.nl/docs/guides/iframe) instead - it needs no API key.

Rotate your keys periodically. You can generate a new key and revoke the old one from the dashboard at any time.

## Tiers and rate limits

Your account has an API tier, which sets your hourly request limit. All the keys on an account share that limit.

<table>
<thead>
  <tr>
    <th>
      Tier
    </th>
    
    <th>
      Requests per hour
    </th>
    
    <th>
      Price
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Free
      </strong>
    </td>
    
    <td>
      100
    </td>
    
    <td>
      Free
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Hobby
      </strong>
    </td>
    
    <td>
      500
    </td>
    
    <td>
      €7.99/mo
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Premium
      </strong>
    </td>
    
    <td>
      2,000
    </td>
    
    <td>
      €19.99/mo
    </td>
  </tr>
</tbody>
</table>

<callout type="tip">

Active Supporter subscribers on the Quote Gallery website receive a **25% discount** on all paid API tiers.

</callout>

## Authentication errors

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Code
    </th>
    
    <th>
      Cause
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        401
      </code>
    </td>
    
    <td>
      <code>
        UNAUTHORIZED
      </code>
    </td>
    
    <td>
      No API key was sent
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        401
      </code>
    </td>
    
    <td>
      <code>
        INVALID_API_KEY
      </code>
    </td>
    
    <td>
      The key is malformed, unknown, revoked, or expired
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        429
      </code>
    </td>
    
    <td>
      <code>
        RATE_LIMIT_EXCEEDED
      </code>
    </td>
    
    <td>
      You’ve used up your hourly quota
    </td>
  </tr>
</tbody>
</table>

```json
{
  "error": "Invalid API key",
  "code": "INVALID_API_KEY",
  "status": 401
}
```

For more on rate limits and how to handle them, see [Rate Limits & Pricing](https://docs.quotegallery.nl/docs/guides/rate-limits).

<card-group>
<card icon="i-lucide-zap" title="Quick Start" to="https://docs.quotegallery.nl/docs/getting-started/quickstart">

Make your first API call in under five minutes.

</card>

<card icon="i-lucide-code" title="API Reference" to="https://docs.quotegallery.nl/docs/api/overview">

Explore all available endpoints.

</card>
</card-group>


## Sitemap

See the full [sitemap](https://docs.quotegallery.nl/sitemap.md) for all pages.
