gerador-boleto Documentation

NPM package for generating FEBRABAN-compliant boletos: typeable line and barcode.

The @box4dev/gerador-boleto is a lightweight open-source library for the Node.js ecosystem, specifically designed for the dynamic generation of bank boleto data in FEBRABAN standard.

NPM versionNPM downloads

Getting Started

About the Boleto Generator

Boleto generator in the FEBRABAN standard: typeable line and barcode.

No HTML, PDF or graphic rendering — just JSON-ready data.

Ideal for mass generation for automated testing.

Installation

Install the package in your project using one of the commands below.

NPM

Shell
npm install @box4dev/gerador-boleto

Yarn

Shell
yarn add @box4dev/gerador-boleto

PNPM

Shell
pnpm add @box4dev/gerador-boleto

Import

Import the boleto generator using ESM or CommonJS syntax.

JS
import { gerarBoleto } from '@box4dev/gerador-boleto';
JS
const { gerarBoleto } = require('@box4dev/gerador-boleto');

Usage

All fields are optional. If no parameters are provided, the package chooses a random bank and valid boleto values.

Without parameters

JS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const dados = gerarBoleto();
console.log(dados.codigoBarras);
// '03396145000000996689025708991834007174230101'
console.log(dados.linhaDigitavel);
// '03399.02579 08991.834006 71742.301014 6 14500000099668'
console.log(dados);
/*
{
codigoBarras: '03396145000000996689025708991834007174230101',
linhaDigitavel: '03399.02579 08991.834006 71742.301014 6 14500000099668',
banco: 'santander',
codigoBanco: '033-7',
dataEmissao: '2026-05-13T00:00:00.000Z',
dataVencimento: '2026-05-18T00:00:00.000Z',
valorDocumento: 99668,
nossoNumero: 918340071742,
nossoNumeroDv: 3,
agencia: 1674,
codigoCedente: 257089,
carteira: '101',
localPagamento: 'Até o vencimento, preferencialmente no Banco Santander',
instrucoesPagamento: 'Sr. Caixa, cobrar multa de 2% após o vencimento. Receber até 10 dias após o vencimento.'
}
*/

Only bank parameter

JS
1
2
3
4
5
6
7
console.log(gerarBoleto({ banco: 'bradesco' }));
console.log(gerarBoleto({ banco: 'caixa' }));
console.log(gerarBoleto({ banco: 'itau' }));
console.log(gerarBoleto({ banco: 'santander' }));

Useful boleto parameters

JS
1
2
3
4
5
6
7
8
9
10
console.log(
gerarBoleto({
banco: 'bradesco',
valorDocumento: 15990,
nossoNumero: '12345678901',
agencia: '1229',
codigoCedente: '0000469',
carteira: '9',
})
);

Useful boleto parameters

JS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
console.log(
gerarBoleto({
banco: 'caixa',
dataEmissao: new Date(),
dataVencimento: vencimento,
valorDocumento: 88800,
nossoNumero: '12345678987654321',
agencia: '1234',
codigoCedente: '654321',
carteira: '14',
localPagamento: 'Local Teste',
numeroDocumento: '999888',
cedente: 'Empresa Teste LTDA',
cedenteCnpj: '54811186000198',
instrucoesPagamento: 'Instrução Teste',
identificadorEmissao: '4',
})
);

Supported Banks

Generate boletos for these supported banks and their corresponding bank codes.

Bank slugDescription
santanderSantander (033)
bradescoBradesco (237)
caixaCaixa SIGCB (104)
itauItaú (341)

Contribution

Contributions are welcome. Open issues or pull requests in the repository below.

GitHub repository

License

Distributed under the MIT license.

Security

Report security issues via the package security policy on GitHub.

Frequently Asked Questions