Endpoints
Check Balance
Overview
The GET /accounts/balances endpoint returns the balance of the authenticated account in a format compatible with the Central Bank specification.
Endpoint
GET /accounts/balancesAuthentication
stringobrigatorioBearer token obtained via /oauth/token.
Request
curl -X GET https://api.gateway.goforge.com.br/accounts/balances \
-H "Authorization: Bearer <token>"const response = await fetch('https://api.gateway.goforge.com.br/accounts/balances', {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
},
});
const balance = await response.json();import requests
response = requests.get(
'https://api.gateway.goforge.com.br/accounts/balances',
headers={
'Authorization': f'Bearer {token}',
}
)
balance = response.json()Response
{
"data": [
{
"eventDate": "2025-01-15T10:30:00.000Z",
"balanceAmount": {
"available": 48734.90,
"blocked": 1500.00,
"overdraft": 0
}
}
]
}Response Fields
dataarrayList of balances. Currently returns only one item.
Balance Types
| Type | Description |
|---|---|
| available | Balance that can be used immediately for transfers |
| blocked | Amounts reserved for operations being processed |
| overdraft | Additional credit limit (not implemented) |
Total Balance Calculation
totalBalance = available + blockedThe available balance already deducts blocked amounts.
Comparison with Standard API
Standard API (GET /balance) | BACEN API (GET /accounts/balances) |
|---|---|
grossBalance | available + blocked |
blockedBalance | blocked |
netBalance | available |
consultedAt | eventDate |
Equivalence Example
// Standard API
{
"grossBalance": 50234.90,
"blockedBalance": 1500.00,
"netBalance": 48734.90,
"consultedAt": "2025-01-15T10:30:00.000Z"
}
// BACEN API (equivalent)
{
"data": [{
"eventDate": "2025-01-15T10:30:00.000Z",
"balanceAmount": {
"available": 48734.90,
"blocked": 1500.00,
"overdraft": 0
}
}]
}Balance Flow in Operations
PIX Out (Transfer)
sequenceDiagram
participant App
participant API
participant Bank
Note over App,Bank: Initial state: available=1000, blocked=0
App->>API: POST /dict/pix (R$ 100)
API-->>App: { type: "PENDING" }
Note over App,Bank: State: available=900, blocked=100
Bank->>API: Confirmation
API->>App: Webhook TRANSFER (LIQUIDATED)
Note over App,Bank: Final state: available=900, blocked=0PIX In (Receipt)
sequenceDiagram
participant Payer
participant API
participant App
Note over Payer,App: Initial state: available=1000
Payer->>API: Pays QR Code
API->>App: Webhook RECEIVE (LIQUIDATED)
Note over Payer,App: Final state: available=1100Best Practices
Common Errors
| Code | Error | Solution |
|---|---|---|
| 401 | Token not provided | Include the Authorization: Bearer <token> header |
| 401 | Invalid token | Verify that the token is correct |
| 401 | Expired token | Obtain a new token via /oauth/token |