> ## Documentation Index
> Fetch the complete documentation index at: https://developers.funos.es/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> All requests to the Funos API require authentication via API Key using a Bearer token.

## How to authenticate

The API uses **Bearer token** authentication in the `Authorization` header. Include your API Key in every request:

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

***

## Authenticated request example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://qegraxvwwikrltmtfamo.supabase.co/functions/v1/v1-quote-funeral-service?locality_id=24017" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript (fetch) theme={null}
  const response = await fetch(
    'https://qegraxvwwikrltmtfamo.supabase.co/functions/v1/v1-quote-funeral-service?locality_id=24017',
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      }
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://qegraxvwwikrltmtfamo.supabase.co/functions/v1/v1-quote-funeral-service',
      params={'locality_id': 24017},
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )
  data = response.json()
  ```
</CodeGroup>

***

## Authentication errors

| Code  | Message               | Cause                            |
| ----- | --------------------- | -------------------------------- |
| `401` | `UNAUTHORIZED`        | API Key missing or invalid       |
| `401` | `KEY_REVOKED`         | The API Key has been deactivated |
| `429` | `RATE_LIMIT_EXCEEDED` | 100 requests/hour limit exceeded |

```json 401 Response theme={null}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or not found API Key."
  }
}
```

```json 429 Response theme={null}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "You have exceeded the limit of 100 requests per hour. Please try again in a few minutes."
  }
}
```

***

## Usage limits (Rate Limiting)

| Plan | Limit        | Window                |
| ---- | ------------ | --------------------- |
| Beta | 100 requests | Per hour, per API Key |

The `Retry-After` header indicates how many seconds to wait after receiving a `429`.

***

## Security

<Warning>
  **Do not expose your API Key in the frontend.** API requests must always be made from your backend or from the MCP/GPT Action server — never from publicly accessible client-side JavaScript.
</Warning>

* API Keys are stored as SHA-256 hashes. Funos never stores the key in plain text.
* If you believe your API Key has been compromised, contact [api@funos.es](mailto:api@funos.es) immediately.
* Each API Key has an origin identifier (`name`, `origin`) for full traceability in logs.

***

## Request an API Key

The API is in private beta. To request access:

1. Write to [api@funos.es](mailto:api@funos.es) with subject: `API Key Request - Funos AI Partner`
2. Briefly describe your use case (GPT Action, MCP, web application…)
3. You will receive your API Key within 24–48 hours

<Info>
  If you are setting up a **GPT Action in ChatGPT**, the API Key is entered in GPT Builder → Configure → Actions → Authentication → API Key → Bearer.
</Info>
