API Reference
OAuth

Get a token

POST/oauth/token
Base URL: https://oauth.bb.mimicr.dev · provider: https://oauth.hm.bb.com.br

Issues an access token through the client_credentials flow. Send client_id:client_secret in Base64 in the Authorization: Basic header and, in the application/x-www-form-urlencoded body, grant_type=client_credentials and scope with the scopes the application will use, separated by one space (commas are rejected).

The token is opaque (not a JWT) and lasts 600 seconds. Reuse it until it expires: in homologação BB accepts at most 10 token requests every 10 minutes. The returned scope does not follow the request order.

The token does not replace the application key: every API call also carries ?gw-dev-app-key=<app-key>.

In Mimicr, the 10-tokens-per-10-minutes limit only applies with the tokenRateLimit homologation toggle on; the 11th request answers 429 too_many_requests.

Authorization

Public route, no token.

Body

application/x-www-form-urlencoded
grant_typestringrequired

Always client_credentials.

client_credentials
scopestringrequired

Scopes separated by one space, case-sensitive. Required. Use only scopes granted to the application.

50 values
cob.readcob.writecobv.readcobv.writelotecobv.readlotecobv.writepayloadlocation.readpayloadlocation.writepix.readpix.writepix-bb.readwebhook.readwebhook.writerec.readrec.writesolicrec.readsolicrec.writecobr.readcobr.writepayloadlocationrec.readpayloadlocationrec.writewebhookrec.readwebhookrec.writewebhookcobr.readwebhookcobr.writewebhooksolicrec.readwebhooksolicrec.writecobrancas.boletos-infocobrancas.boletos-requisicaocobrancas.convenio-requisicaopagamentos-lote.boletos-infopagamentos-lote.boletos-requisicaopagamentos-lote.cancelar-requisicaopagamentos-lote.devolvidos-infopagamentos-lote.guias-codigo-barras-infopagamentos-lote.guias-codigo-barras-requisicaopagamentos-lote.lancamentos-infopagamentos-lote.lotes-infopagamentos-lote.lotes-requisicaopagamentos-lote.mtlspagamentos-lote.pagamentos-codigo-barras-infopagamentos-lote.pagamentos-guias-sem-codigo-barras-infopagamentos-lote.pagamentos-guias-sem-codigo-barras-requisicaopagamentos-lote.pagamentos-infopagamentos-lote.pix-infopagamentos-lote.transferencias-infopagamentos-lote.transferencias-pix-infopagamentos-lote.transferencias-pix-requisicaopagamentos-lote.transferencias-requisicaoextrato-info
Example: "cob.write cob.read pix.read"

Responses

200Token issued.
access_tokenstringrequired

Opaque token. Send it as Authorization: Bearer <token>; do not try to decode it.

token_typestringrequired
Bearer
expires_inintegerrequired

Lifetime in seconds (600).

Example: 600
scopestringrequired

Granted scopes, space-separated, in BB's own order.

Example: "pix.read cob.write cob.read"
400Invalid request: no Authorization: Basic (invalid_request), grant_type other than client_credentials (unsupported_grant_type) or a missing, unknown or comma-separated scope (invalid_scope).
errorstringrequired

OAuth error code.

invalid_requestinvalid_clientunsupported_grant_typeinvalid_scopetoo_many_requests
error_descriptionstringrequired

Error description, in Portuguese.

Example: "Identificador ou credencial inválidos"
401Invalid client_id or client_secret (invalid_client).
errorstringrequired

OAuth error code.

invalid_requestinvalid_clientunsupported_grant_typeinvalid_scopetoo_many_requests
error_descriptionstringrequired

Error description, in Portuguese.

Example: "Identificador ou credencial inválidos"
405A method other than POST: Method Not Allowed as text/html.
429More than 10 token requests in 10 minutes (homologação). In Mimicr, only with the tokenRateLimit toggle on.
errorstringrequired

OAuth error code.

invalid_requestinvalid_clientunsupported_grant_typeinvalid_scopetoo_many_requests
error_descriptionstringrequired

Error description, in Portuguese.

Example: "Identificador ou credencial inválidos"