Error 403 — Collections
Problem summary
A call to the Collections API that contains a payload similar to the one below indicates that the token itself was formed correctly and reached our server. However,
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.3",
"title": "Forbidden",
"status": 403,
"traceId": "00-4bcbceb92f9ae14918978f0c8babda94-7a86858ef4784b8f-01"
}
Common causes
Operating on a collection of another company
The API validates that the companyId provided in the route corresponds to the company in the token. Trying to operate on collections of a CNPJ different from the one consented will return 403.
Confirm that the companyId used in the URL (/{companyId}/banking/collections/...) is the same CNPJ of the company authenticated in the token.
Incorrect data in the account field
The API checks the data provided in account.number and account.branch to validate whether it matches what is in the banking system. If incorrect data or data from other accounts is provided, the response will be 403.
It is important that the data provided matches what is in Retrieve account data, that is, with leading zeros, with the check digit, and without a hyphen.
Quick diagnosis
- Decode the token at jwt.io
- Check that the
scopefield containsbrn:btg:empresas:banking:collections - Check that the
audclaim is filled with the company's CNPJ - Confirm that the
companyIdin the URL matches the CNPJ in the token - Confirm that the
account.numberandaccount.branchdata match what is available via Retrieve account data
If the problem persists after these steps, contact the support team by email at ImplantacaoEmpresas@btgpactual.com.