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

# Autenticação

> Como autenticar suas requisições na API da Flare Payments

## Bearer Token

Todas as requisições à API da Flare Payments devem ser autenticadas com um **Bearer Token** no header `Authorization`.

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

<Note>
  Todas as chaves secretas usadas para autenticar a API começam obrigatoriamente com o prefixo `sk_live_`. A chave pública `pk_live_` é apenas identificador e não autentica requisições.
</Note>

## Obtendo sua API Key

Acesse o [Dashboard da Flare](https://flarepayments.com/login) e navegue até **Configurações → API Keys** para gerar sua chave.

## Exemplo de Requisição

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.flarepayments.com/v1/balance \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.flarepayments.com/v1/balance', {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });
  ```

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

  response = requests.get(
      'https://api.flarepayments.com/v1/balance',
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )
  ```
</CodeGroup>

## Erros de Autenticação

| Status | Código                  | Descrição                                                 |
| ------ | ----------------------- | --------------------------------------------------------- |
| `401`  | `missing_authorization` | Header `Authorization` ausente                            |
| `401`  | `invalid_authorization` | Header inválido; use `Authorization: Bearer YOUR_API_KEY` |
| `401`  | `invalid_api_key`       | Chave não encontrada                                      |
| `403`  | `api_key_disabled`      | Chave desativada                                          |
| `403`  | `api_key_revoked`       | Chave revogada                                            |
| `429`  | `rate_limit_exceeded`   | Limite de requisições excedido                            |

## Segurança

<Warning>
  Nunca exponha sua API Key em código client-side, repositórios públicos ou logs. Trate-a como uma senha.
</Warning>

* Armazene a chave em variáveis de ambiente
* Use HTTPS em todas as requisições (obrigatório)
* Rotacione a chave periodicamente pelo Dashboard
