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

# Autenticação

> Como autenticar nas rotas privadas da API ClubeB2B.

# Autenticação

As rotas privadas usam o header `Authorization` no formato Bearer Token.

## Header esperado

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

## Regras de autenticação

* Se o header `Authorization` não for enviado, a API retorna `401`.
* Se o header vier em formato inválido, a API retorna `401`.
* Se o token estiver vazio, a API retorna `401`.
* Se o token não existir ou não estiver vinculado a um cliente válido, a API retorna `403`.

## Exemplo

```bash theme={null}
curl -X GET "https://clubeb2b.com.br/_API/getProdutos.php?limit=10&offset=0" \
  -H "Authorization: Bearer SEU_TOKEN" \
  -H "Accept: application/json"
```

## Erros comuns

### 401 - header ausente

```json theme={null}
{
  "ok": false,
  "erro": "authorization_header_ausente",
  "mensagem": "Header Authorization não informado. Use: Bearer SEU_TOKEN"
}
```

### 401 - formato inválido

```json theme={null}
{
  "ok": false,
  "erro": "authorization_header_formato_invalido",
  "mensagem": "Formato inválido. Use: Bearer SEU_TOKEN"
}
```

### 403 - token inválido

```json theme={null}
{
  "ok": false,
  "erro": "token_invalido",
  "mensagem": "Token inválido ou cliente não encontrado"
}
```
