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

# POST /jwt-decoder

> Decodifique e inspecione tokens JWT. Retorna cabeçalho, payload e metadados de expiração sem verificação de assinatura.

## Endpoint

```
POST https://api.bunny.build/api/v1/jwt-decoder
```

## Autenticação

| Header         | Obrigatório | Valor                        |
| -------------- | ----------- | ---------------------------- |
| `X-API-Key`    | Sim         | Sua chave de API (`bun_...`) |
| `Content-Type` | Sim         | `application/json`           |

## Visão geral

Decodifique qualquer JSON Web Token (JWT) e inspecione seu cabeçalho, claims do payload e metadados de expiração. Este endpoint não verifica a assinatura; decodifica a estrutura do token para fins de depuração, registro e exibição.

## Casos de uso

* Depurar claims de tokens durante o desenvolvimento e testes de integração
* Exibir metadados do usuário a partir de um JWT em um painel administrativo
* Registrar detalhes do token em trilhas de auditoria sem armazenar tokens brutos
* Inspecionar tokens de terceiros para entender sua estrutura

## Detalhes

Decodifica JWTs padrão com três partes (cabeçalho.payload.assinatura). A verificação de assinatura não é realizada. Timestamps legíveis por humanos `issued_at` e `expires_at` são derivados dos claims `iat` e `exp` quando presentes.

## Corpo da requisição

| Campo   | Tipo   | Obrigatório | Descrição                |
| ------- | ------ | ----------- | ------------------------ |
| `token` | string | Sim         | String JWT a decodificar |

### Exemplo

```json theme={null}
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
```

## Resposta

### 200 OK

| Campo        | Tipo    | Descrição                                        |
| ------------ | ------- | ------------------------------------------------ |
| `header`     | object  | Cabeçalho JWT decodificado (algoritmo, tipo)     |
| `payload`    | object  | Claims do payload JWT decodificado               |
| `expires_at` | string  | Timestamp de expiração ISO 8601 (do claim `exp`) |
| `issued_at`  | string  | Timestamp de emissão ISO 8601 (do claim `iat`)   |
| `expired`    | boolean | Se o token está atualmente expirado              |

**Exemplo**

```json theme={null}
{
  "header": { "alg": "HS256", "typ": "JWT" },
  "payload": { "sub": "1234567890", "name": "John Doe", "iat": 1516239022 },
  "issued_at": "2018-01-18T01:30:22Z",
  "expires_at": null,
  "expired": false
}
```

### 401 Unauthorized

```json theme={null}
{
  "detail": "Missing API key. Include X-API-Key header."
}
```

### 402 Payment Required

```json theme={null}
{
  "detail": "Monthly quota exceeded. Upgrade your plan."
}
```

### 422 Unprocessable Entity

```json theme={null}
{
  "detail": "Invalid JWT format"
}
```

### 429 Too Many Requests

```json theme={null}
{
  "detail": "Rate limit exceeded. Try again in 60 seconds."
}
```

## Exemplo cURL

```bash theme={null}
curl -X POST https://api.bunny.build/api/v1/jwt-decoder \
  -H "X-API-Key: bun_sua_chave_api" \
  -H "Content-Type: application/json" \
  -d '{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}'
```
