Regras de Débito Automático
Gerencie as regras usadas para gerar débitos automáticos (tarifas) do parceiro BaaS.
Esta API replica a lógica do portal de parceiros (/feeRules/list), mas sob o contrato OAuth da Banking API. O tenant é sempre o baas_id da credencial BAAS autenticada.
Referência OpenAPI: API Reference.
Pré-requisitos
- mTLS e token OAuth (
POST /auth/token). Veja Authentication & mTLS. - Credencial com
credential_type = BAAS - Scopes:
fee-rules.read— listar e consultarfee-rules.write— criar, atualizar e excluir
Credenciais ACCOUNT recebem 403.
Endpoints
| Método | Path | Scope | Descrição |
|---|---|---|---|
GET | /fee-rules | fee-rules.read | Lista paginada |
GET | /fee-rules/{id} | fee-rules.read | Detalhe |
POST | /fee-rules | fee-rules.write | Criar |
PUT | /fee-rules/{id} | fee-rules.write | Atualizar |
DELETE | /fee-rules/{id} | fee-rules.write | Excluir |
Listar regras
curl -X GET "https://api.bancodigital.com/fee-rules?page=1&perPage=20&filter=pix" \
--cert client.pem --key client.key \
-H "Authorization: Bearer SEU_TOKEN"
pagecomeça em 1;perPagepadrão é 10 (máximo 100)filterbusca por nome (case-insensitive)- A listagem é ordenada por
weightdecrescente (maior peso prevalece) - Filtro por conta não é query param: use o requirement
ACCOUNT_NUMBERna regra
Resposta
{
"meta": {
"total": 1,
"perPage": 20,
"currentPage": 1,
"firstPage": 1,
"lastPage": 1,
"nextPage": null,
"prevPage": null
},
"data": [
{
"id": "c55fa769-6364-4e1c-968b-d4880aa9a952",
"baasId": "3a6965ce-c5b1-4a5b-bf60-45e05203a5f2",
"name": "Tarifa PIX crédito",
"percent": 1.5,
"fixedAmount": 0,
"minAmount": 1,
"maxAmount": 50,
"weight": 2,
"effectiveDate": null,
"requirements": [
{
"id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"type": "ACCOUNT_NUMBER",
"value": "12345"
}
],
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-02T00:00:00.000Z"
}
]
}
Consultar regra
curl -X GET "https://api.bancodigital.com/fee-rules/c55fa769-6364-4e1c-968b-d4880aa9a952" \
--cert client.pem --key client.key \
-H "Authorization: Bearer SEU_TOKEN"
Regras de outro baasId não são visíveis (404).
Criar regra
curl -X POST "https://api.bancodigital.com/fee-rules" \
--cert client.pem --key client.key \
-H "Authorization: Bearer SEU_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Tarifa PIX crédito",
"percent": 1.5,
"fixedAmount": 0,
"minAmount": 1,
"maxAmount": 50,
"effectiveDate": null,
"requirements": [
{ "type": "ACCOUNT_NUMBER", "value": "12345" },
{ "type": "MOVEMENT_TYPE", "value": "CREDIT" }
]
}'
O weight é atribuído automaticamente como max(weight do baas) + 1. Em runtime, a regra de maior weight prevalece entre as aplicáveis.
Tipos de requirement
| Tipo | Uso |
|---|---|
ACCOUNT_NUMBER | Número da conta (pagador ou recebedor, conforme movimento) |
PERSON_TYPE | Tipo de pessoa |
TRANSACTION_TYPE | Tipo de transação |
MOVEMENT_TYPE | CREDIT ou DEBIT |
Todos os requirements de uma regra são avaliados com AND.
Atualizar regra
curl -X PUT "https://api.bancodigital.com/fee-rules/c55fa769-6364-4e1c-968b-d4880aa9a952" \
--cert client.pem --key client.key \
-H "Authorization: Bearer SEU_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Tarifa PIX crédito",
"weight": 3,
"percent": 2,
"fixedAmount": 0,
"minAmount": 1,
"maxAmount": 80
}'
Não é possível alterar requirements nem effectiveDate neste endpoint (paridade com o portal). Para mudar requirements, exclua e recrie a regra.
Se o weight informado já existir para o mesmo BaaS, a API responde 409.
Excluir regra
curl -X DELETE "https://api.bancodigital.com/fee-rules/c55fa769-6364-4e1c-968b-d4880aa9a952" \
--cert client.pem --key client.key \
-H "Authorization: Bearer SEU_TOKEN"
Resposta: 204 No Content.
Isolamento
- Credenciais
ACCOUNTrecebem403 - Regras de outro
baasIdnão são visíveis (404no detalhe) - O
baasIdda resposta sempre corresponde ao token
Erros
Respostas de erro usam RFC 7807 (application/problem+json).
| HTTP | Quando |
|---|---|
400 | Payload inválido |
401 | Token ausente ou inválido |
403 | Escopo ausente ou credencial que não é BAAS |
404 | Regra inexistente no BaaS autenticado |
409 | weight duplicado no mesmo BaaS |