{
  "openapi": "3.0.0",
  "paths": {
    "/v1/account": {
      "get": {
        "description": "Cliente vinculado à chave, o que está habilitado e os limites. Scope: `read`.",
        "operationId": "V1AccountController_account",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Dados da conta",
        "tags": [
          "Conta"
        ]
      }
    },
    "/v1/balances": {
      "get": {
        "description": "Saldo atual em BRL e USDT (soma do extrato). Saques em `processando` ainda não foram debitados (os de USDT em `enviando` já foram) — o disponível para novo saque está em GET /v1/withdrawals/fee-preview. Scope: `read`.",
        "operationId": "V1AccountController_balances",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalancesDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Saldos",
        "tags": [
          "Conta"
        ]
      }
    },
    "/v1/statement": {
      "get": {
        "description": "Lançamentos do período (mais recentes primeiro) e o saldo de abertura antes de `from`. Scope: `read`.",
        "operationId": "V1AccountController_statement",
        "parameters": [
          {
            "name": "from",
            "required": true,
            "in": "query",
            "description": "Início do período (ISO 8601)",
            "schema": {
              "example": "2026-11-01T00:00:00-03:00",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "description": "Fim do período (ISO 8601)",
            "schema": {
              "example": "2026-11-30T23:59:59-03:00",
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "default": 1,
              "type": "number"
            }
          },
          {
            "name": "page_size",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 500,
              "default": 100,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Extrato",
        "tags": [
          "Conta"
        ]
      }
    },
    "/v1/conversions/time-window": {
      "get": {
        "description": "Se as conversões estão abertas agora. Scope: `read`.",
        "operationId": "V1ConversionsController_timeWindow",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeWindowDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Janela de horário",
        "tags": [
          "Conversões"
        ]
      }
    },
    "/v1/conversions/rate": {
      "get": {
        "description": "Preço de referência com o seu spread, atualizado a cada poucos segundos. Não reserva preço. Scope: `read`.",
        "operationId": "V1ConversionsController_rate",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndicativeRateDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Cotação indicativa",
        "tags": [
          "Conversões"
        ]
      }
    },
    "/v1/conversions/quotes": {
      "post": {
        "description": "Consulta o melhor preço e reserva por ~15s (`expires_at`). Para executar, chame POST /v1/conversions com o `id` antes de expirar. Scope: `trade`. Limite: 20/min.",
        "operationId": "V1ConversionsController_quote",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQuoteRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "502": {
            "description": "`quote_unavailable` — sem cotação no momento; tente de novo em instantes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Criar cotação firme",
        "tags": [
          "Conversões"
        ]
      }
    },
    "/v1/conversions": {
      "post": {
        "description": "Executa a cotação. Debita/credita o saldo na hora quando `status = concluido`; `pendente` = aguardando confirmação (acompanhe por GET /v1/conversions/{id} ou webhook). Uma cotação só executa uma vez. **502 `execution_uncertain`: NÃO repita** — consulte GET /v1/conversions?quote_id=… Scope: `trade`.",
        "operationId": "V1ConversionsController_execute",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Identificador único da operação (UUID v4). Repetir com a mesma chave devolve a mesma resposta sem executar de novo (24h).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecuteConversionRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversionDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "502": {
            "description": "`execution_uncertain` — resultado não confirmado; não repita",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Executar conversão",
        "tags": [
          "Conversões"
        ]
      },
      "get": {
        "description": "Mais recentes primeiro, paginado por cursor. Scope: `read`.",
        "operationId": "V1ConversionsController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Cursor opaco: o `next_cursor` da página anterior",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Criados a partir de (ISO 8601)",
            "schema": {
              "example": "2026-11-01T00:00:00-03:00",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Criados até (ISO 8601)",
            "schema": {
              "example": "2026-11-30T23:59:59-03:00",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pendente",
                "concluido",
                "cancelado",
                "falhou"
              ]
            }
          },
          {
            "name": "quote_id",
            "required": false,
            "in": "query",
            "description": "Filtra pela cotação de origem — use após um `execution_uncertain`",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversionListDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Listar conversões",
        "tags": [
          "Conversões"
        ]
      }
    },
    "/v1/conversions/{id}": {
      "get": {
        "description": "Scope: `read`.",
        "operationId": "V1ConversionsController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversionDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar conversão",
        "tags": [
          "Conversões"
        ]
      }
    },
    "/v1/withdrawals/fee-preview": {
      "get": {
        "description": "Taxa, total debitado, mínimo, máximo e saldo disponível para um saque — mesma regra do POST. Scope: `read`.",
        "operationId": "V1WithdrawalsController_feePreview",
        "parameters": [
          {
            "name": "kind",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "brl_pix",
                "usdt_trc20"
              ]
            }
          },
          {
            "name": "amount",
            "required": true,
            "in": "query",
            "description": "Valor bruto; 0 devolve só mínimo/saldo",
            "schema": {
              "minimum": 0,
              "example": 1500,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeePreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Prévia de taxa",
        "tags": [
          "Saques"
        ]
      }
    },
    "/v1/withdrawals": {
      "post": {
        "description": "Cria o pedido em `processando`. Pix: o saldo é debitado quando a equipe Rivus conclui (webhook `withdrawal.completed`). USDT: o envio pode ser automático — o saldo é debitado quando o pedido passa a `enviando` (webhook `withdrawal.sent`) e o pedido vira `concluido` com a transferência confirmada na rede; se o envio falhar, o valor volta ao saldo e o pedido fica `falhou` (webhook `withdrawal.failed`) até a equipe Rivus reenviar ou cancelar. Com o envio automático, um saque de USDT por vez: com outro de USDT em `processando`/`enviando`, responde 409. Pix (`brl_pix`): `pix_key`, `pix_key_type` e `pix_recipient_name`. USDT (`usdt_trc20`): `wallet_address`. Scope: `withdraw` (exige allowlist de IP na chave).",
        "operationId": "V1WithdrawalsController_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Identificador único do saque (UUID v4). Repetir com a mesma chave não cria outro saque (24h).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWithdrawalRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WithdrawalDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Solicitar saque",
        "tags": [
          "Saques"
        ]
      },
      "get": {
        "description": "Mais recentes primeiro, paginado por cursor. Scope: `read`.",
        "operationId": "V1WithdrawalsController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Cursor opaco: o `next_cursor` da página anterior",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Criados a partir de (ISO 8601)",
            "schema": {
              "example": "2026-11-01T00:00:00-03:00",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Criados até (ISO 8601)",
            "schema": {
              "example": "2026-11-30T23:59:59-03:00",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "processando",
                "enviando",
                "concluido",
                "falhou",
                "cancelado"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WithdrawalListDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Listar saques",
        "tags": [
          "Saques"
        ]
      }
    },
    "/v1/withdrawals/{id}": {
      "get": {
        "description": "Scope: `read`.",
        "operationId": "V1WithdrawalsController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WithdrawalDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar saque",
        "tags": [
          "Saques"
        ]
      }
    },
    "/v1/transfers/my-code": {
      "get": {
        "description": "Código que outros clientes usam para enviar valores a você. Scope: `read`.",
        "operationId": "V1TransfersController_myCode",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferCodeDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Meu código de recebimento",
        "tags": [
          "Transferências"
        ]
      }
    },
    "/v1/transfers/recipients/{code}": {
      "get": {
        "description": "Confere um código de recebimento e devolve o destinatário com o nome mascarado. Limite de consultas por minuto. Scope: `read`.",
        "operationId": "V1TransfersController_recipient",
        "parameters": [
          {
            "name": "code",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferRecipientDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Conferir destinatário",
        "tags": [
          "Transferências"
        ]
      }
    },
    "/v1/transfers/preview": {
      "get": {
        "description": "Disponível, teto por transferência e se o valor vai precisar de aprovação — mesma regra do POST. Scope: `read`.",
        "operationId": "V1TransfersController_preview",
        "parameters": [
          {
            "name": "currency",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "BRL",
                "USDT"
              ]
            }
          },
          {
            "name": "amount",
            "required": true,
            "in": "query",
            "description": "0 para só consultar disponível e limites",
            "schema": {
              "minimum": 0,
              "example": 1500,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferPreviewDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Prévia de transferência",
        "tags": [
          "Transferências"
        ]
      }
    },
    "/v1/transfers": {
      "post": {
        "description": "Envia BRL ou USDT para outro cliente Rivus pelo código de recebimento dele. Até o teto de aprovação, a transferência já volta `concluida` (webhooks `transfer.sent` para você e `transfer.received` para o destinatário). Acima do teto, volta `pendente` (webhook `transfer.pending`) com o valor reservado no saldo até a equipe Rivus aprovar ou rejeitar. Sem taxa. Scope: `withdraw` (exige allowlist de IP na chave).",
        "operationId": "V1TransfersController_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Identificador único da transferência (UUID v4). Repetir com a mesma chave não cria outra transferência (24h).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTransferRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Enviar transferência",
        "tags": [
          "Transferências"
        ]
      },
      "get": {
        "description": "Enviadas (todos os status) e recebidas (concluídas), mais recentes primeiro, paginado por cursor. Scope: `read`.",
        "operationId": "V1TransfersController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Cursor opaco: o `next_cursor` da página anterior",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Criados a partir de (ISO 8601)",
            "schema": {
              "example": "2026-11-01T00:00:00-03:00",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Criados até (ISO 8601)",
            "schema": {
              "example": "2026-11-30T23:59:59-03:00",
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pendente",
                "concluida",
                "rejeitada",
                "cancelada"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferListDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Listar transferências",
        "tags": [
          "Transferências"
        ]
      }
    },
    "/v1/transfers/{id}": {
      "get": {
        "description": "Scope: `read`.",
        "operationId": "V1TransfersController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar transferência",
        "tags": [
          "Transferências"
        ]
      }
    },
    "/v1/deposits/config": {
      "get": {
        "description": "Valor mínimo/máximo da cobrança e validade. Scope: `read`.",
        "operationId": "V1DepositsController_config",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositConfigDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Limites de depósito",
        "tags": [
          "Depósitos"
        ]
      }
    },
    "/v1/deposits/static-code": {
      "get": {
        "description": "Código Pix fixo (sem valor) da conta: qualquer Pix recebido credita o saldo (webhook `balance.credited`). Scope: `read`.",
        "operationId": "V1DepositsController_staticCode",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaticCodeDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Pix permanente",
        "tags": [
          "Depósitos"
        ]
      }
    },
    "/v1/deposits": {
      "post": {
        "description": "Gera uma cobrança Pix com valor (validade de 30 min). Quando paga com o valor exato, o saldo é creditado e o status vira `pago` (webhook `deposit.paid`). Scope: `trade`.",
        "operationId": "V1DepositsController_create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Identificador único da cobrança (UUID v4). Repetir com a mesma chave devolve a mesma cobrança (24h).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDepositRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Criar cobrança Pix",
        "tags": [
          "Depósitos"
        ]
      },
      "get": {
        "description": "As 50 cobranças mais recentes. Scope: `read`.",
        "operationId": "V1DepositsController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DepositDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Listar depósitos",
        "tags": [
          "Depósitos"
        ]
      }
    },
    "/v1/deposits/{id}": {
      "get": {
        "description": "Scope: `read`.",
        "operationId": "V1DepositsController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar depósito",
        "tags": [
          "Depósitos"
        ]
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "V1WebhooksController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpointDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Listar webhooks",
        "tags": [
          "Webhooks"
        ]
      },
      "post": {
        "description": "Máximo de 5 por cliente. A resposta traz o `secret` de assinatura **uma única vez**.",
        "operationId": "V1WebhooksController_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecretDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Cadastrar webhook",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "operationId": "V1WebhooksController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar webhook",
        "tags": [
          "Webhooks"
        ]
      },
      "patch": {
        "description": "URL, eventos, descrição ou ativar/desativar.",
        "operationId": "V1WebhooksController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Alterar webhook",
        "tags": [
          "Webhooks"
        ]
      },
      "delete": {
        "operationId": "V1WebhooksController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Remover webhook",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}/rotate-secret": {
      "post": {
        "description": "Gera um novo segredo de assinatura; o anterior deixa de valer na hora.",
        "operationId": "V1WebhooksController_rotate",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecretDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Trocar segredo",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "description": "Envia agora um evento `ping` assinado e devolve o resultado (sem retentativa).",
        "operationId": "V1WebhooksController_test",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTestResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Testar webhook",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "description": "Últimas entregas deste webhook (30 dias).",
        "operationId": "V1WebhooksController_deliveries",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 50,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookDeliveryDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Requisição inválida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, inválida, revogada ou expirada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Sem scope, IP fora da allowlist, ou operação não habilitada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições excedido (veja Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Histórico de entregas",
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "info": {
    "title": "Rivus API",
    "version": "1.0.0",
    "contact": {
      "name": "Rivus",
      "url": "https://rivusfinance.com",
      "email": ""
    },
    "description": "Referência de todos os endpoints da API v1 da Rivus.\n\nOs **guias** (autenticação, idempotência, fluxos e webhooks) estão em [docs.rivusfinance.com/docs](https://docs.rivusfinance.com/docs/primeiros-passos).\n\nO botão **Testar** envia requisições reais para o **sandbox** (`https://api-sandbox.rivusfinance.com`), onde corretoras e bancos são simulados. Use uma chave `rvs_test_…`. Nunca cole aqui uma chave de produção (`rvs_live_…`)."
  },
  "tags": [
    {
      "name": "Conta"
    },
    {
      "name": "Conversões"
    },
    {
      "name": "Depósitos"
    },
    {
      "name": "Saques"
    },
    {
      "name": "Webhooks"
    }
  ],
  "servers": [
    {
      "url": "https://api-sandbox.rivusfinance.com",
      "description": "Sandbox — sem dinheiro real"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "scheme": "bearer",
        "bearerFormat": "rvs_<env>_<prefix>_<segredo>",
        "type": "http",
        "description": "Chave de API"
      }
    },
    "schemas": {
      "ErrorDetailDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "example": "invalid_request",
            "description": "Código estável: invalid_request, unauthorized, forbidden, not_found, conflict, unprocessable, rate_limited, quote_unavailable, execution_uncertain, idempotency_key_reused, idempotency_in_progress, upstream_error, internal_error"
          },
          "message": {
            "type": "string",
            "example": "Saldo BRL insuficiente. Disponível: R$ 1.234,56"
          },
          "request_id": {
            "type": "string",
            "nullable": true,
            "example": "req_3f2c9b1e8d7a4c6b9e0f1a2b3c4d5e6f"
          },
          "details": {
            "description": "Todas as mensagens de validação, quando houver mais de uma",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "code",
          "message",
          "request_id"
        ]
      },
      "ErrorResponseDto": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorDetailDto"
          }
        },
        "required": [
          "error"
        ]
      },
      "AccountDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "Empresa Exemplo Ltda"
          },
          "is_active": {
            "type": "boolean"
          },
          "conversion_enabled": {
            "type": "boolean",
            "description": "Pode comprar USDT"
          },
          "conversion_sell_enabled": {
            "type": "boolean",
            "description": "Pode vender USDT"
          },
          "conversion_max_per_tx_brl": {
            "type": "number",
            "nullable": true,
            "description": "Limite por conversão, em BRL"
          },
          "conversion_daily_limit_brl": {
            "type": "number",
            "nullable": true,
            "description": "Limite diário de conversões, em BRL"
          },
          "withdrawal_enabled": {
            "type": "boolean"
          },
          "withdrawal_max_per_tx_brl": {
            "type": "number",
            "nullable": true
          },
          "withdrawal_max_per_tx_usdt": {
            "type": "number",
            "nullable": true
          },
          "scopes": {
            "type": "array",
            "description": "Scopes da chave usada",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "trade",
                "withdraw"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "is_active",
          "conversion_enabled",
          "conversion_sell_enabled",
          "conversion_max_per_tx_brl",
          "conversion_daily_limit_brl",
          "withdrawal_enabled",
          "withdrawal_max_per_tx_brl",
          "withdrawal_max_per_tx_usdt",
          "scopes"
        ]
      },
      "BalancesDto": {
        "type": "object",
        "properties": {
          "brl": {
            "type": "number",
            "example": 15230.45
          },
          "usdt": {
            "type": "number",
            "example": 2500.12345678
          },
          "as_of": {
            "type": "string",
            "example": "2026-11-09T14:03:11.000Z"
          }
        },
        "required": [
          "brl",
          "usdt",
          "as_of"
        ]
      },
      "StatementEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "example": "credito_brl",
            "description": "credito_brl, debito_brl, saque_brl, credito_usdt, debito_usdt, saque_usdt, transferencia_interna_*, ajuste"
          },
          "amount_brl": {
            "type": "number",
            "example": 250,
            "description": "Positivo = entrada; negativo = saída"
          },
          "amount_usdt": {
            "type": "number",
            "example": 0
          },
          "rate": {
            "type": "number",
            "nullable": true,
            "description": "Cotação BRL/USDT (lançamentos de conversão)"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "e2e": {
            "type": "string",
            "nullable": true,
            "description": "End-to-end do Pix, quando houver"
          },
          "occurred_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "amount_brl",
          "amount_usdt",
          "rate",
          "description",
          "e2e",
          "occurred_at"
        ]
      },
      "StatementDto": {
        "type": "object",
        "properties": {
          "opening_balance": {
            "description": "Saldo antes de `from`",
            "allOf": [
              {
                "$ref": "#/components/schemas/BalancesDto"
              }
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatementEntryDto"
            }
          },
          "page": {
            "type": "number",
            "example": 1
          },
          "page_size": {
            "type": "number",
            "example": 100
          },
          "total": {
            "type": "number",
            "example": 37
          }
        },
        "required": [
          "opening_balance",
          "data",
          "page",
          "page_size",
          "total"
        ]
      },
      "TimeWindowDto": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Há restrição de horário configurada"
          },
          "open": {
            "type": "boolean",
            "description": "Conversões abertas agora"
          },
          "message": {
            "type": "string",
            "nullable": true,
            "example": "Conversões disponíveis de segunda a sexta, das 09:00 às 17:00"
          }
        },
        "required": [
          "enabled",
          "open",
          "message"
        ]
      },
      "IndicativeRateDto": {
        "type": "object",
        "properties": {
          "buy_rate": {
            "type": "number",
            "nullable": true,
            "example": 5.4321,
            "description": "Indicativo de compra de USDT (BRL por USDT), já com o seu spread; null se compra não habilitada. Não é cotação firme — use POST /v1/conversions/quotes"
          },
          "sell_rate": {
            "type": "number",
            "nullable": true,
            "example": 5.3987
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "buy_rate",
          "sell_rate",
          "updated_at"
        ]
      },
      "CreateQuoteRequestDto": {
        "type": "object",
        "properties": {
          "side": {
            "enum": [
              "buy_usdt",
              "sell_usdt"
            ],
            "type": "string",
            "description": "`buy_usdt`: paga BRL e recebe USDT; `sell_usdt`: paga USDT e recebe BRL"
          },
          "amount": {
            "type": "number",
            "minimum": 0,
            "example": 10000,
            "exclusiveMinimum": true,
            "description": "Valor, na moeda de `amount_currency`"
          },
          "amount_currency": {
            "enum": [
              "brl",
              "usdt"
            ],
            "type": "string",
            "example": "brl"
          }
        },
        "required": [
          "side",
          "amount",
          "amount_currency"
        ]
      },
      "QuoteDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Use em POST /v1/conversions"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy_usdt",
              "sell_usdt"
            ]
          },
          "rate": {
            "type": "number",
            "example": 5.4321,
            "description": "BRL por USDT, já com spread"
          },
          "brl_amount": {
            "type": "number",
            "example": 10000
          },
          "usdt_amount": {
            "type": "number",
            "example": 1840.9
          },
          "expires_at": {
            "type": "string"
          },
          "ttl_seconds": {
            "type": "number",
            "example": 14
          }
        },
        "required": [
          "id",
          "side",
          "rate",
          "brl_amount",
          "usdt_amount",
          "expires_at",
          "ttl_seconds"
        ]
      },
      "ExecuteConversionRequestDto": {
        "type": "object",
        "properties": {
          "quote_id": {
            "type": "string",
            "format": "uuid",
            "description": "`id` da cotação (válida por ~15s)"
          }
        },
        "required": [
          "quote_id"
        ]
      },
      "ConversionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "quote_id": {
            "type": "string",
            "nullable": true,
            "format": "uuid"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy_usdt",
              "sell_usdt"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pendente",
              "concluido",
              "cancelado",
              "falhou"
            ],
            "description": "`pendente` = aguardando confirmação da liquidação; acompanhe por GET ou webhook"
          },
          "brl_amount": {
            "type": "number",
            "example": 10000
          },
          "usdt_amount": {
            "type": "number",
            "example": 1840.9
          },
          "rate": {
            "type": "number",
            "example": 5.4321
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "quote_id",
          "side",
          "status",
          "brl_amount",
          "usdt_amount",
          "rate",
          "created_at"
        ]
      },
      "ConversionListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversionDto"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "next_cursor"
        ]
      },
      "FeePreviewDto": {
        "type": "object",
        "properties": {
          "min_amount": {
            "type": "number",
            "example": 10
          },
          "max_per_tx": {
            "type": "number",
            "nullable": true
          },
          "available_balance": {
            "type": "number",
            "example": 15230.45
          },
          "max_amount": {
            "type": "number",
            "nullable": true
          },
          "valid": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "fee_amount": {
            "type": "number",
            "example": 2.5
          },
          "total_debit": {
            "type": "number",
            "example": 1502.5
          },
          "fee_label": {
            "type": "string",
            "nullable": true,
            "example": "R$ 2,50"
          },
          "usdt_in_progress": {
            "type": "boolean",
            "description": "USDT com envio automático: já existe um saque de USDT em andamento, e um novo pedido de USDT responde 409"
          }
        },
        "required": [
          "min_amount",
          "max_per_tx",
          "available_balance",
          "max_amount",
          "valid",
          "message",
          "fee_amount",
          "total_debit",
          "fee_label",
          "usdt_in_progress"
        ]
      },
      "CreateWithdrawalRequestDto": {
        "type": "object",
        "properties": {
          "kind": {
            "enum": [
              "brl_pix",
              "usdt_trc20"
            ],
            "type": "string"
          },
          "gross_amount": {
            "type": "number",
            "minimum": 0,
            "example": 1500,
            "exclusiveMinimum": true,
            "description": "Valor bruto (a taxa é calculada no servidor e somada no débito)"
          },
          "pix_key": {
            "type": "string",
            "description": "Obrigatório em `brl_pix`",
            "example": "12345678000199"
          },
          "pix_key_type": {
            "type": "string",
            "enum": [
              "cpf",
              "cnpj",
              "email",
              "telefone",
              "aleatoria"
            ],
            "description": "Obrigatório em `brl_pix`"
          },
          "pix_recipient_name": {
            "type": "string",
            "maxLength": 200,
            "description": "Nome completo do recebedor — obrigatório em `brl_pix`",
            "example": "Empresa Exemplo Ltda"
          },
          "wallet_address": {
            "type": "string",
            "description": "Carteira TRC-20 — obrigatório em `usdt_trc20`",
            "example": "TXYZ1234567890abcdefghijklmnopqrst"
          },
          "expected_fee_amount": {
            "type": "number",
            "minimum": 0,
            "description": "Taxa mostrada ao usuário (do fee-preview). Se a regra mudou, a API responde 409 em vez de cobrar outra taxa."
          }
        },
        "required": [
          "kind",
          "gross_amount"
        ]
      },
      "WithdrawalDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "brl_pix",
              "usdt_trc20"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "processando",
              "enviando",
              "concluido",
              "falhou",
              "cancelado"
            ],
            "description": "`processando`: aguardando envio. `enviando`: saldo já debitado, envio de USDT em curso. `concluido`: pago (USDT: confirmado na rede). `falhou`: o envio de USDT falhou e o valor voltou ao saldo — a equipe Rivus reenvia ou cancela. `cancelado`: não será pago. Novos status podem ser adicionados: trate valores desconhecidos como \"em andamento\"."
          },
          "gross_amount": {
            "type": "number",
            "example": 1500
          },
          "fee_amount": {
            "type": "number",
            "example": 2.5
          },
          "total_debit": {
            "type": "number",
            "example": 1502.5
          },
          "pix_key": {
            "type": "string",
            "nullable": true
          },
          "pix_key_type": {
            "type": "string",
            "nullable": true
          },
          "pix_recipient_name": {
            "type": "string",
            "nullable": true
          },
          "wallet_address": {
            "type": "string",
            "nullable": true
          },
          "tx_hash": {
            "type": "string",
            "nullable": true,
            "description": "Link da transação na rede (USDT). Pode vir preenchido já em `enviando`; só é definitivo em `concluido`"
          },
          "has_proof": {
            "type": "boolean",
            "description": "Há comprovante anexado (Pix concluído)"
          },
          "created_at": {
            "type": "string"
          },
          "processed_at": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "gross_amount",
          "fee_amount",
          "total_debit",
          "pix_key",
          "pix_key_type",
          "pix_recipient_name",
          "wallet_address",
          "tx_hash",
          "has_proof",
          "created_at",
          "processed_at"
        ]
      },
      "WithdrawalListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WithdrawalDto"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "next_cursor"
        ]
      },
      "TransferCodeDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "nullable": true,
            "example": "RV-7K3M9Q",
            "description": "Seu código de recebimento"
          }
        },
        "required": [
          "code"
        ]
      },
      "TransferRecipientDto": {
        "type": "object",
        "properties": {
          "recipient_id": {
            "type": "string",
            "format": "uuid",
            "description": "Mande em `expected_recipient_id` no POST"
          },
          "code": {
            "type": "string",
            "example": "RV-7K3M9Q"
          },
          "name": {
            "type": "string",
            "example": "João d* S****"
          },
          "client_type": {
            "type": "string",
            "enum": [
              "pf",
              "pj"
            ]
          }
        },
        "required": [
          "recipient_id",
          "code",
          "name",
          "client_type"
        ]
      },
      "TransferPreviewDto": {
        "type": "object",
        "properties": {
          "max_per_tx": {
            "type": "number",
            "nullable": true,
            "description": "Teto por transferência do cliente"
          },
          "available_balance": {
            "type": "number",
            "example": 15230.45,
            "description": "Saldo menos saques e transferências pendentes"
          },
          "max_amount": {
            "type": "number",
            "nullable": true
          },
          "approval_threshold": {
            "type": "number",
            "nullable": true,
            "description": "Acima deste valor a transferência fica `pendente` de aprovação"
          },
          "needs_approval": {
            "type": "boolean"
          },
          "valid": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "max_per_tx",
          "available_balance",
          "max_amount",
          "approval_threshold",
          "needs_approval",
          "valid",
          "message"
        ]
      },
      "CreateTransferRequestDto": {
        "type": "object",
        "properties": {
          "recipient_code": {
            "type": "string",
            "maxLength": 20,
            "example": "RV-7K3M9Q",
            "description": "Código de recebimento do destinatário (com ou sem `RV-`)"
          },
          "currency": {
            "enum": [
              "BRL",
              "USDT"
            ],
            "type": "string"
          },
          "amount": {
            "type": "number",
            "minimum": 1,
            "example": 1500,
            "description": "BRL: até 2 casas. USDT: até 6 casas."
          },
          "note": {
            "type": "string",
            "maxLength": 140,
            "description": "Mensagem que aparece no extrato das duas pontas"
          },
          "expected_recipient_id": {
            "type": "string",
            "format": "uuid",
            "description": "O `recipient_id` devolvido por `GET /v1/transfers/recipients/{code}`. Se o código não for mais desse cliente, responde 409."
          }
        },
        "required": [
          "recipient_code",
          "currency",
          "amount"
        ]
      },
      "TransferCounterpartDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "nullable": true,
            "example": "RV-7K3M9Q"
          },
          "name": {
            "type": "string",
            "example": "João d* S****",
            "description": "Mascarado quando é o destinatário de uma transferência enviada"
          }
        },
        "required": [
          "code",
          "name"
        ]
      },
      "TransferDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "sent",
              "received"
            ],
            "description": "Do ponto de vista do cliente da chave"
          },
          "status": {
            "type": "string",
            "enum": [
              "pendente",
              "concluida",
              "rejeitada",
              "cancelada"
            ],
            "description": "`concluida`: valor debitado do remetente e creditado no destinatário. `pendente`: acima do teto de aprovação, aguardando a equipe Rivus — o valor fica reservado no saldo. `rejeitada` / `cancelada`: nada foi movimentado."
          },
          "currency": {
            "type": "string",
            "enum": [
              "BRL",
              "USDT"
            ]
          },
          "amount": {
            "type": "number",
            "example": 1500
          },
          "note": {
            "type": "string",
            "nullable": true
          },
          "counterpart": {
            "$ref": "#/components/schemas/TransferCounterpartDto"
          },
          "reject_reason": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string"
          },
          "decided_at": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "direction",
          "status",
          "currency",
          "amount",
          "note",
          "counterpart",
          "reject_reason",
          "created_at",
          "decided_at"
        ]
      },
      "TransferListDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransferDto"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "data",
          "next_cursor"
        ]
      },
      "DepositConfigDto": {
        "type": "object",
        "properties": {
          "min_brl": {
            "type": "number",
            "example": 10
          },
          "max_brl": {
            "type": "number",
            "example": 50000
          },
          "expires_in_seconds": {
            "type": "number",
            "example": 1800
          },
          "currencies": {
            "example": [
              "BRL"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "min_brl",
          "max_brl",
          "expires_in_seconds",
          "currencies"
        ]
      },
      "StaticPixBankDetailsDto": {
        "type": "object",
        "properties": {
          "bank_name": {
            "type": "string",
            "nullable": true
          },
          "holder_name": {
            "type": "string",
            "nullable": true
          },
          "holder_document": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "bank_name",
          "holder_name",
          "holder_document"
        ]
      },
      "StaticCodeDto": {
        "type": "object",
        "properties": {
          "txid": {
            "type": "string"
          },
          "pix_copia_e_cola": {
            "type": "string",
            "description": "Pix copia e cola permanente (sem valor fixo) — todo Pix recebido credita o saldo"
          },
          "qr_code_data_uri": {
            "type": "string"
          },
          "bank_details": {
            "$ref": "#/components/schemas/StaticPixBankDetailsDto"
          }
        },
        "required": [
          "txid",
          "pix_copia_e_cola",
          "qr_code_data_uri",
          "bank_details"
        ]
      },
      "CreateDepositRequestDto": {
        "type": "object",
        "properties": {
          "amount_brl": {
            "type": "number",
            "minimum": 0,
            "example": 250,
            "exclusiveMinimum": true,
            "description": "Valor da cobrança Pix, em BRL"
          },
          "description": {
            "type": "string",
            "maxLength": 140,
            "description": "Referência livre (aparece para o pagador)",
            "example": "Pedido 4821"
          }
        },
        "required": [
          "amount_brl"
        ]
      },
      "DepositDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pendente",
              "pago",
              "expirado",
              "divergente",
              "cancelado"
            ],
            "description": "`expirado` é calculado na leitura (30 min sem pagamento)"
          },
          "amount_brl": {
            "type": "number",
            "example": 250
          },
          "paid_amount_brl": {
            "type": "number",
            "nullable": true
          },
          "paid_at": {
            "type": "string",
            "nullable": true
          },
          "txid": {
            "type": "string"
          },
          "e2e": {
            "type": "string",
            "nullable": true
          },
          "payer_name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "pix_copia_e_cola": {
            "type": "string",
            "nullable": true,
            "description": "Pix copia e cola — só enquanto `pendente`"
          },
          "qr_code_data_uri": {
            "type": "string",
            "nullable": true,
            "description": "QR code (data URI PNG) — só enquanto `pendente`"
          },
          "expires_at": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "amount_brl",
          "paid_amount_brl",
          "paid_at",
          "txid",
          "e2e",
          "payer_name",
          "description",
          "pix_copia_e_cola",
          "qr_code_data_uri",
          "expires_at",
          "created_at"
        ]
      },
      "WebhookEndpointDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "*",
                "conversion.completed",
                "conversion.canceled",
                "conversion.failed",
                "withdrawal.created",
                "withdrawal.sent",
                "withdrawal.completed",
                "withdrawal.failed",
                "withdrawal.canceled",
                "deposit.paid",
                "deposit.divergent",
                "balance.credited",
                "transfer.pending",
                "transfer.sent",
                "transfer.received",
                "transfer.rejected",
                "transfer.canceled"
              ]
            }
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "is_active",
          "created_at",
          "updated_at"
        ]
      },
      "CreateWebhookRequestDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2000,
            "example": "https://api.suaempresa.com.br/webhooks/rivus",
            "description": "https, porta 443, host público"
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "example": [
              "deposit.paid",
              "withdrawal.completed"
            ],
            "items": {
              "type": "string",
              "enum": [
                "*",
                "conversion.completed",
                "conversion.canceled",
                "conversion.failed",
                "withdrawal.created",
                "withdrawal.sent",
                "withdrawal.completed",
                "withdrawal.failed",
                "withdrawal.canceled",
                "deposit.paid",
                "deposit.divergent",
                "balance.credited",
                "transfer.pending",
                "transfer.sent",
                "transfer.received",
                "transfer.rejected",
                "transfer.canceled"
              ]
            }
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "url",
          "events"
        ]
      },
      "WebhookEndpointWithSecretDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "*",
                "conversion.completed",
                "conversion.canceled",
                "conversion.failed",
                "withdrawal.created",
                "withdrawal.sent",
                "withdrawal.completed",
                "withdrawal.failed",
                "withdrawal.canceled",
                "deposit.paid",
                "deposit.divergent",
                "balance.credited",
                "transfer.pending",
                "transfer.sent",
                "transfer.received",
                "transfer.rejected",
                "transfer.canceled"
              ]
            }
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "secret": {
            "type": "string",
            "example": "whsec_…",
            "description": "Segredo HMAC — mostrado só agora; guarde-o"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "is_active",
          "created_at",
          "updated_at",
          "secret"
        ]
      },
      "UpdateWebhookRequestDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2000
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "enum": [
                "*",
                "conversion.completed",
                "conversion.canceled",
                "conversion.failed",
                "withdrawal.created",
                "withdrawal.sent",
                "withdrawal.completed",
                "withdrawal.failed",
                "withdrawal.canceled",
                "deposit.paid",
                "deposit.divergent",
                "balance.credited",
                "transfer.pending",
                "transfer.sent",
                "transfer.received",
                "transfer.rejected",
                "transfer.canceled"
              ]
            }
          },
          "description": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "WebhookSecretDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "secret": {
            "type": "string",
            "example": "whsec_…",
            "description": "Novo segredo — o anterior deixa de valer imediatamente"
          }
        },
        "required": [
          "id",
          "secret"
        ]
      },
      "WebhookTestResultDto": {
        "type": "object",
        "properties": {
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "success": {
            "type": "boolean"
          },
          "status_code": {
            "type": "number",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "delivery_id",
          "event_id",
          "success",
          "status_code",
          "error"
        ]
      },
      "WebhookDeliveryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_type": {
            "type": "string",
            "example": "deposit.paid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pendente",
              "entregue",
              "falhou"
            ]
          },
          "attempts": {
            "type": "number"
          },
          "last_status_code": {
            "type": "number",
            "nullable": true
          },
          "last_error": {
            "type": "string",
            "nullable": true
          },
          "next_attempt_at": {
            "type": "string"
          },
          "delivered_at": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "event_id",
          "event_type",
          "status",
          "attempts",
          "last_status_code",
          "last_error",
          "next_attempt_at",
          "delivered_at",
          "created_at"
        ]
      }
    }
  }
}
