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

# Autenticação

> Como autenticar suas requisições na API da VisePag

## Bearer Token

Todas as requisições à API da VisePag 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.

## Obtendo sua API Key

Acesse o [Dashboard da VisePag](https://dash.visepag.com/login) e abra o menu **API** para gerar sua chave. A chave secreta aparece uma vez só, na criação.

## Exemplo de Requisição

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

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

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

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

## 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_revoked` | Chave revogada |
| `403` | `account_not_fully_verified` | Conta sem cadastro completo ou sem KYC aprovado |
| `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.

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.