Este endpoint obtém o saldo e detalhes de uma conta bancária específica pelo seu ID.
Endpoint
GET /tools/api/get-balance-by-account
Authentication
Token Bearer (API key) obrigatório
Parâmetros de Query
Response
{
"success" : true ,
"data" : {
"name" : "Conta Principal" ,
"balance" : 1000.00 ,
"account_type" : "BANK" ,
"account_subtype" : "CHECKING_ACCOUNT"
},
"timestamp" : "2024-01-01T00:00:00.000Z"
}
Response Fields
Respostas de Erro
{
"error" : "Account ID is required"
}
{
"error" : "Account is not a bank account"
}
{
"error" : "Invalid or inactive API key" ,
"message" : "Invalid or inactive API key" ,
"type" : "invalid_api_key" ,
"nextSteps" : [
"Visit https://pierre.finance/api-key to generate a new API key" ,
"Make sure the API key is active and not expired"
]
}
{
"error" : "Account not found"
}
500 Internal Server Error
{
"error" : "Failed to get balance by account id from database"
}
Exemplos de Uso
cURL
curl -X GET "https://www.pierre.finance/tools/api/get-balance-by-account?accountId=123456" \
-H "Authorization: Bearer sk-your-api-key-here" \
-H "Content-Type: application/json"
JavaScript
const accountId = '123456' ;
const response = await fetch ( `https://www.pierre.finance/tools/api/get-balance-by-account?accountId= ${ accountId } ` , {
headers: {
'Authorization' : 'Bearer sk-your-api-key-here' ,
'Content-Type' : 'application/json'
}
});
const data = await response . json ();
console . log ( 'Nome da conta:' , data . data . name );
console . log ( 'Saldo:' , data . data . balance );
Python
import requests
account_id = '123456'
headers = {
'Authorization' : 'Bearer sk-your-api-key-here' ,
'Content-Type' : 'application/json'
}
response = requests.get(
f 'https://www.pierre.finance/tools/api/get-balance-by-account?accountId= { account_id } ' ,
headers = headers
)
data = response.json()
print ( f "Nome da conta: { data[ 'data' ][ 'name' ] } " )
print ( f "Saldo: { data[ 'data' ][ 'balance' ] } " )
Observações
Apenas contas bancárias são suportadas por este endpoint
Contas de cartão de crédito retornarão um erro 400
O accountId pode ser obtido do endpoint /tools/api/get-accounts
Os saldos das contas são em tempo real e refletem o estado atual da conta conectada
Se a conta não for encontrada ou não pertencer ao usuário autenticado, um erro 404 será retornado
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
The response is of type object
.