ACCOUNTS API

Accounts API Overview

Check the balance and statement, send Pix by key, follow each payment through to confirmation, get the receipt, transfer between accounts of the bank.

Base serverhttps://bank.granseuk.com/api/v2

API specifications

Download the specification file (OpenAPI) to import into Postman or Insomnia and test the requests.

Send a Pix: from request to confirmation

  • Create a unique x-idempotency-key for the request (for example, your own order id) and keep it.
  • POST /pix/payments/dict with the Pix key, the amount and the x-idempotency-key. The response is 202 with status PROCESSING: the amount has already left the balance.
  • Wait for the outcome. With webhooks on, it arrives in the transfer notice (status LIQUIDATED) or cashout notice (status CANCELED). Without webhooks, call GET /pix/payments/idempotencyKey/{key} every few seconds until the status is no longer PROCESSING.
  • LIQUIDATED: done. The endToEndId is filled in and the receipt is at GET /pix/payments/receipt/{endToEndId}.
  • CANCELED: the Pix did not go out and the amount returns to the balance by itself. You may try again with a NEW key.
  • If the connection drops or times out, do NOT create another key: repeat the POST with the SAME x-idempotency-key (it returns the same payment, never paying twice) or look it up by key.
statusMeaning
PROCESSINGAccepted, on its way to the destination bank. Not final yet.
LIQUIDATEDDone: the money arrived.
CANCELEDIt did not go out; the amount returned to the balance.

Sandbox (test environment)

Test the whole integration without moving real money. In the panel, under API, tap New key and choose Sandbox: the key is born with the sk_sbx_ prefix and a fake account holding R$ 10,000.00. Everything else matches production: the same base URL, the same token (POST /oauth/token with the sandbox key's Client ID and Client Secret), the same routes, the same fields and the same errors. Only the money is fake.

  • Sent Pix (POST /pix/payments/dict and /qrc): answers 202 already with the endToEndId and completes by itself in about 4 seconds (LIQUIDATED), with the transfer notice. The test fee is R$ 1.00.
  • Key falha@sandbox.test (EMAIL): the Pix is accepted and fails after about 4 seconds; the amount returns and the cashout notice arrives (CANCELED).
  • Key recusa@sandbox.test (EMAIL): refused immediately (400), nothing is debited.
  • Pix charge (PUT /cob/{txid}): stays ATIVA until you pay it with the sandbox command below; then it becomes CONCLUIDA, the balance goes up and the receive notice arrives. The pixCopiaECola of a sandbox charge can also be paid through POST /pix/payments/qrc.
  • Transfer between accounts (POST /internal-transfers): use document 111.444.777-35 (any name) as the test destination account.
  • Key lookup (GET /pix/keys/{key}) returns test data; naoexiste@sandbox.test answers 404.
  • Webhooks (POST /webhooks/{type}): apply only to the sandbox key and receive only test notices; they do not need to be enabled for the account.

Commands that play the part of the outside world (sandbox keys only; with a production key they answer 403):

CommandWhat it does
POST /sandbox/cob/{txid}/payPays the charge: balance goes up, status CONCLUIDA, receive notice.
POST /sandbox/pix/receiveSimulates a Pix paid straight to your key. Body: { "amount": 25.50, "payer": "Someone" }.
POST /sandbox/pix/payments/{endToEndId}/completeSpeeds up the completion of a sent Pix (transfer notice).
POST /sandbox/pix/payments/{endToEndId}/failForces a sent Pix to fail: the amount returns (cashout notice).
POST /sandbox/balance/topupAdds fake balance. Body: { "amount": 500 }.
GET /sandbox/infoLists these test keys and commands.
The sandbox is isolated: it does not use the real balance, does not go through the provider, and the endToEndIds it generates start with E99999999 (a bank that does not exist), so they are never mistaken for a real Pix. Test data is erased after 30 days. When everything works, create a production key and swap the Client ID and Client Secret: the code does not change.

API reference

Authentication

Get an access token

POST/oauth/token

Exchanges clientId and clientSecret for an access token (OAuth 2.0 client credentials). The token is valid for 1 hour; send it as Authorization: Bearer on every other route. Accepts JSON, a form body (client_id, client_secret, grant_type) or Authorization: Basic base64(clientId:clientSecret).

Request body
FieldTypeDescription
clientIdrequiredstringThe first 14 characters of your API key (e.g. sk_live_AbCdEf) or the key id.
clientSecretrequiredstringThe full API key (sk_live_…).
grantTyperequiredstringAlways client_credentials.
scopestringIgnored: the token carries all of the key's permissions.
  • expiresAt is the expiry instant in Unix seconds.
  • The token stops working the moment its key is revoked.

Account

Get the account balance

GET/accounts/balances

Balance in BRL. available is what can be spent now; blocked is what is on hold (by a bank review, for example).

Permission: account.read → balance:read

List account transactions

GET/accounts/transactions

The account statement, newest first. Dates are inclusive (Sao Paulo time zone).

Permission: transactions.read → transactions:read

Query parameters
FieldTypeDescription
event_date_startdate-timeStart date (ISO 8601; only the day is used).
event_date_enddate-timeEnd date (ISO 8601; only the day is used).
page_offsetintegerStart position (items to skip). Default 0.
page_limitintegerItems per page, up to 100. Default 25.
  • creditDebitType: CREDIT is money in, DEBIT is money out. transactionAmount.available and amount carry the same value.

List the account Pix keys

GET/accounts/keys

The Pix keys the bank generated for your account. Whoever pays a key chooses the amount in their bank app. Keys are created in the bank panel; this API is read-only.

Permission: pix.read → pix:read

Pix

Start a Pix payment by Pix key

POST/pix/payments/dict

Sends a Pix to a key (CPF, CNPJ, e-mail, phone or EVP, the random key). The amount is debited right away and the payment is accepted for processing (202). The outcome (LIQUIDATED or CANCELED) comes from the lookup by endToEndId or by idempotency key. If it is refused, the amount returns to the account.

Permission: pix.write → pix:send

Headers
FieldTypeDescription
x-idempotency-keyrequiredstringUnique request identifier (1 to 50 letters and digits). Repeating the same key returns the SAME payment, never paying twice.
Request body
FieldTypeDescription
pixKeyrequiredstringThe destination Pix key.
pixKeyTyperequiredstringCPF | CNPJ | EMAIL | PHONE | EVP
payment.amountrequirednumberAmount in BRL, up to 2 decimals.
payment.currencystringBRL.
descriptionstringPix text, up to 140 characters.
priority, paymentFlow, creditorDocument, expiration, endToEndId, ispbDeny—Accepted and ignored (the bank chooses).
  • endToEndId may be null in the 202: it appears as soon as the Pix goes on to the destination bank. Look it up by idempotency key or by transactionId.
  • id is a stable number; to look it up use endToEndId or transactionId.

Get a Pix by end-to-end id

GET/pix/payments/{endToEndId}

The full payment. Accepts the Pix endToEndId or the transactionId returned on creation. 404 if it is not a payment of your account.

Permission: pix.read → pix:read

Path parameters
FieldTypeDescription
endToEndIdrequiredstringThe Pix endToEndId (or the transactionId).
  • status: PROCESSING, LIQUIDATED, CANCELED, REFUNDED or WAITING_APPROVAL.

Get a Pix by idempotency key

GET/pix/payments/idempotencyKey/{idempotencyKey}

The same payment, found by the x-idempotency-key you sent. Use it after a timeout to find out whether the request arrived.

Permission: pix.read → pix:read

Path parameters
FieldTypeDescription
idempotencyKeyrequiredstringThe request idempotency key.

Get the Pix receipt as a PDF

GET/pix/payments/receipt/{endToEndId}

The payment receipt as a base64-encoded PDF (with the bank's branding). Accepts the endToEndId or the transactionId.

Permission: pix.read → pix:read

Path parameters
FieldTypeDescription
endToEndIdrequiredstringThe Pix endToEndId (or the transactionId).

Look up a Pix key

GET/pix/keys/{key}

What the DICT says about any Pix key: name, document (masked by the DICT itself) and bank. Use it to confirm the recipient before sending. If the bank's provider does not query the DICT, it answers 501 not_supported.

Permission: pix.read → pix:read

Path parameters
FieldTypeDescription
keyrequiredstringThe Pix key (CPF, CNPJ, e-mail, phone or random).

Transfer between accounts

Create a transfer between accounts

POST/internal-transfers

Transfers to another account at this same bank, instantly and without going through Pix. The destination account is found by the holder's document (CPF or CNPJ), and the name you send must match the account: if any check fails, nothing is transferred. Repeating the same x-idempotency-key returns the same transfer.

Permission: internal-transfer.write → transfers:write

Headers
FieldTypeDescription
x-idempotency-keyrequiredstringUnique request identifier (1 to 50 letters and digits).
Request body
FieldTypeDescription
creditorAccount.documentrequiredstringCPF or CNPJ of the destination account holder.
creditorAccount.namerequiredstringHolder name. Must match the account.
creditorAccount.numberstringOptional: the destination account id, as an extra check.
payment.amountrequirednumberAmount in BRL, up to 2 decimals.
remittanceInformationstringDescription, up to 200 characters.
creditorAccount.issuer, creditorAccount.accountType, paymentFlow—Accepted and ignored.
  • It does not go through Pix: the transfer is created already settled (LIQUIDATED) and endToEndId is null.

Get a transfer between accounts

GET/internal-transfers/{endToEndId}

The transfer by endToEndId (when there is one) or by the transactionId returned on creation.

Permission: internal-transfer.read → transactions:read

Path parameters
FieldTypeDescription
endToEndIdrequiredstringThe endToEndId or the transactionId.

Get a transfer by idempotency key

GET/internal-transfers/idempotencyKey/{idempotencyKey}

The same transfer, found by the x-idempotency-key you sent.

Permission: internal-transfer.read → transactions:read

Path parameters
FieldTypeDescription
idempotencyKeyrequiredstringThe request idempotency key.