apyhub
Back
▣ DATA VALIDATION · FINANCE

Brazilian Boleto Validation & Bank Lookup API

What it does

Boleto Validator checks whether a Brazilian boleto is valid and extracts the payment details encoded in its barcode or digitable line. A boleto (boleto bancário) is a common payment method in Brazil, used for bills, invoices, online purchases, utility bills, taxes, fines, and other payments.

Send a code containing either a barcode or a digitable line, and the API validates its check digits using FEBRABAN algorithms. It returns whether the boleto is valid, along with the detected type,input_format, bank, segment, currency, amount, amount_cents, due_date, due_date_status, and overdue status. It also returns the barcode, digitable_line, and digitable_line_formatted when available, along with a checks object and any detected errors or warnings.

The API supports both bank_slip and collection boletos, making it suitable for validating standard bank slips, utility bills, taxes, fines, and other payment documents. You can use it to verify a payment slip before displaying it to a customer, reconcile checkout details, or process incoming bills. Since it accepts either format and can return both, it also works as a barcode-to-digitable-line and digitable-line-to-barcode converter.

The service also includes a Bank Lookup API that identifies a Brazilian bank by its 3-digit COMPE code (3-digit number used to identify a bank in Brazil.). Send a code such as 212 for Banco do Brasil or 341 for Itaú Unibanco to retrieve the corresponding bank name. COMPE codes are used in Brazilian payment systems, including boleto barcodes, bank account details, and transfers. This endpoint helps you display readable bank names instead of raw numeric codes.

Validation is performed through local calculations without contacting banks or external systems, enabling fast responses without sending payment data to external services.

▣ ENDPOINT 01 / 03
GET
Validate a boleto
https://api.eu.apyhub.com/dam4g/brazilian-boleto-validation-bank-lookup/v1/validate

QUICKSTART

GUIDE

Quickstart

Validate a boleto by its digitable line.

curl -X GET "https://api.eu.apyhub.com/dam4g/brazilian-boleto-validation-bank-lookup/v1/validate?code=21290001192110001210904475617405975870000002000" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

You will receive whether the boleto is valid, its type and input format, the issuing bank, currency, amount, due date and overdue status, the boleto as a barcode and as a digitable line, and the results of each check with any errors or warnings.

Response Example

{
  "valid": true,
  "type": "bank_slip",
  "input_format": "digitable_line",
  "barcode": "21299758700000020000001121100012100447561740",
  "digitable_line": "21290001192110001210904475617405975870000002000",
  "digitable_line_formatted": "21290.00119 21100.012109 04475.617405 9 75870000002000",
  "checks": {
    "length": true,
    "characters": true,
    "field_check_digits": true,
    "barcode_check_digit": true
  },
  "errors": [],
  "warnings": [],
  "bank": {
    "code": "212",
    "name": "Banco Original"
  },
  "currency": "BRL",
  "segment": null,
  "amount_cents": 2000,
  "amount": "20.00",
  "due_date": "2018-07-16",
  "due_date_status": "ok",
  "overdue": true
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Checks whether a Brazilian boleto is valid using the official FEBRABAN check-digit algorithms, and returns its type, issuing bank, amount, currency, due date, overdue status, and both code formats. The boleto code is sent as a query parameter.

Query Parameter(s)

AttributeTypeMandatoryDescription
codeStringYesThe boleto's barcode (44 digits), bank digitable line (47 digits), or utility/tax digitable line (48 digits). Dots, dashes, and spaces are ignored.
▣ ENDPOINT 02 / 03
POST
Validate a boleto
https://api.eu.apyhub.com/dam4g/brazilian-boleto-validation-bank-lookup/v1/validate

QUICKSTART

GUIDE

Quickstart

Validate a boleto by its digitable line.

curl -X GET "https://api.eu.apyhub.com/dam4g/brazilian-boleto-validation-bank-lookup/v1/validate" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

You will receive whether the boleto is valid, its type and input format, the issuing bank, currency, amount, due date and overdue status, the boleto as a barcode and as a digitable line, and the results of each check with any errors or warnings.

Response Example

{
  "valid": true,
  "type": "bank_slip",
  "input_format": "digitable_line",
  "barcode": "21299758700000020000001121100012100447561740",
  "digitable_line": "21290001192110001210904475617405975870000002000",
  "digitable_line_formatted": "21290.00119 21100.012109 04475.617405 9 75870000002000",
  "checks": {
    "length": true,
    "characters": true,
    "field_check_digits": true,
    "barcode_check_digit": true
  },
  "errors": [],
  "warnings": [],
  "bank": {
    "code": "212",
    "name": "Banco Original"
  },
  "currency": "BRL",
  "segment": null,
  "amount_cents": 2000,
  "amount": "20.00",
  "due_date": "2018-07-16",
  "due_date_status": "ok",
  "overdue": true
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body

About this endpoint

What it does

Performs the same validation as Validate a Boleto (GET), but accepts the boleto code in a JSON request body instead of a query parameter.

Request Body Parameter(s)

AttributeTypeMandatoryDescription
codeStringYesThe boleto's barcode (44 digits), bank digitable line (47 digits), or utility/tax digitable line (48 digits). Dots, dashes, and spaces are ignored.
▣ ENDPOINT 03 / 03
GET
Look up a bank by its 3-digit COMPE code
https://api.eu.apyhub.com/dam4g/brazilian-boleto-validation-bank-lookup/v1/banks/:code

QUICKSTART

GUIDE

Quickstart

Look up the bank with COMPE code 212.

curl -X GET "https://api.eu.apyhub.com/dam4g/brazilian-boleto-validation-bank-lookup/v1/banks/:code" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

You will receive the bank code you sent and the matching bank name.

Response Example

{
  "code": "212",
  "name": "Banco Original"
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Looks up a Brazilian bank by its 3-digit COMPE code and returns its name.

Use this when you have a bank code and need the bank's readable name.

Path Parameter(s)

AttributeTypeMandatoryDescription
codeStringYesThe bank's 3-digit COMPE code, such as 212 or 001. Must be exactly 3 digits, including any leading zeros.

Response

FieldTypeDescription
codeStringThe 3-digit COMPE code you sent.
nameString / NullThe bank's name, such as Banco Original. null if the code is recognized but has no stored name.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.