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

# Authentication

> Learn how to authenticate with the Rightfoot API

# Authentication

## BearerAuth

**HTTP: BearerAuth**

Authentication to the API is performed via Bearer Token Authentication. Provide your API key as the bearer token in the Authorization header.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

**HTTP Authorization Scheme:** bearer

## Making Authenticated Requests

Include your API key as a Bearer token in the Authorization header:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.rightfoot.com/v1/balance_requests \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "authorizers": [...]
    }'
  ```

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

  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  response = requests.post(
      "https://api.rightfoot.com/v1/balance_requests",
      headers=headers,
      json={"authorizers": [...]}
  )
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.rightfoot.com/v1/balance_requests', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      authorizers: [...]
    })
  });
  ```
</CodeGroup>

## Error Responses

If authentication fails, you'll receive a 401 response:

```json theme={null}
{
  "status": "error",
  "status_code": 401,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid API key provided.",
    "timestamp": "2024-09-16T12:01:00Z",
    "suggestion": "Please check your API key."
  },
  "batch_id": null,
  "documentation_url": "https://api.rightfoot.com/docs"
}
```
