cURL
curl --request GET \
--url https://www.pierre.finance/tools/api/get-spending-limit-transactions \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.pierre.finance/tools/api/get-spending-limit-transactions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.pierre.finance/tools/api/get-spending-limit-transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.pierre.finance/tools/api/get-spending-limit-transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.pierre.finance/tools/api/get-spending-limit-transactions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.pierre.finance/tools/api/get-spending-limit-transactions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.pierre.finance/tools/api/get-spending-limit-transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"limit": {
"id": "sl_123abc",
"category": "Alimentação",
"limitAmount": 500.00,
"period": "monthly",
"periodText": "neste mês",
"isActive": true,
"createdAt": "2024-10-15T10:30:00Z",
"periodStart": "2024-11-01T00:00:00.000Z"
},
"spending": {
"currentSpent": 325.50,
"percentage": 65.1,
"remaining": 174.50,
"transactionCount": 12
},
"status": {
"level": "warning",
"nextAlert": "75%",
"alerts": {
"alertHistory": [
{
"alertType": "50%",
"sentAt": "2024-11-15T08:30:00Z",
"amount": 250.00
}
]
}
}
},
"timestamp": "2024-11-04T15:30:00Z"
}
Spending Limits
Get Spending Limit Transactions
Retorna o status detalhado de um limite de gastos específico, incluindo valor gasto atual, porcentagem do limite, próximos alertas e histórico de transações. Calcula automaticamente o período baseado na configuração do limite. Requer API key para autenticação e assinatura ativa.
GET
/
tools
/
api
/
get-spending-limit-transactions
cURL
curl --request GET \
--url https://www.pierre.finance/tools/api/get-spending-limit-transactions \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.pierre.finance/tools/api/get-spending-limit-transactions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.pierre.finance/tools/api/get-spending-limit-transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.pierre.finance/tools/api/get-spending-limit-transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.pierre.finance/tools/api/get-spending-limit-transactions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.pierre.finance/tools/api/get-spending-limit-transactions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.pierre.finance/tools/api/get-spending-limit-transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"limit": {
"id": "sl_123abc",
"category": "Alimentação",
"limitAmount": 500.00,
"period": "monthly",
"periodText": "neste mês",
"isActive": true,
"createdAt": "2024-10-15T10:30:00Z",
"periodStart": "2024-11-01T00:00:00.000Z"
},
"spending": {
"currentSpent": 325.50,
"percentage": 65.1,
"remaining": 174.50,
"transactionCount": 12
},
"status": {
"level": "warning",
"nextAlert": "75%",
"alerts": {
"alertHistory": [
{
"alertType": "50%",
"sentAt": "2024-11-15T08:30:00Z",
"amount": 250.00
}
]
}
}
},
"timestamp": "2024-11-04T15:30:00Z"
}
Retorna o status detalhado de um limite de gastos específico, incluindo valor gasto atual, porcentagem do limite, próximos alertas e histórico de transações.
Descrição
O endpointGET /tools/api/get-spending-limit-transactions fornece informações detalhadas sobre um limite específico, calculando automaticamente:
- Período atual baseado na configuração do limite
- Valor gasto e porcentagem de uso
- Próximos alertas (50%, 75%, 100%)
- Histórico de alertas enviados
- Número de transações no período
Autenticação
Este endpoint requer autenticação via Bearer token e assinatura ativa.string
required
Bearer token com a API key do usuário. Formato:
Bearer sk-your-api-key-hereParâmetros de Query
string
required
ID do limite de gastos para consultar o status
Resposta
Sucesso (200)
{
"success": true,
"data": {
"limit": {
"id": "sl_123abc",
"category": "Alimentação",
"limitAmount": 500.00,
"period": "monthly",
"periodText": "neste mês",
"isActive": true,
"createdAt": "2024-10-15T10:30:00Z",
"periodStart": "2024-11-01T00:00:00.000Z"
},
"spending": {
"currentSpent": 325.50,
"percentage": 65.1,
"remaining": 174.50,
"transactionCount": 12
},
"status": {
"level": "warning",
"nextAlert": "75%",
"alerts": {
"alertHistory": [
{
"alertType": "50%",
"sentAt": "2024-11-15T08:30:00Z",
"amount": 250.00
}
]
}
}
},
"timestamp": "2024-11-04T15:30:00Z"
}
Limite Não Encontrado (404)
{
"error": "Spending limit not found",
"message": "No spending limit found with ID: sl_123abc"
}
Acesso Negado (403)
{
"error": "Access denied",
"message": "You can only view your own spending limits"
}
Níveis de Status
O campostatus.level indica a situação atual:
ok: Abaixo de 50% do limitewarning: Entre 50% e 99% do limitedanger: 100% ou mais do limite
Próximos Alertas
O campostatus.nextAlert mostra qual será o próximo alerta:
"50%": Quando atingir 50% do limite"75%": Quando atingir 75% do limite"100%": Quando atingir 100% do limitenull: Já excedeu 100% (sem próximos alertas)
Exemplos de Uso
curl -X GET "https://www.pierre.finance/tools/api/get-spending-limit-transactions?limitId=sl_123abc" \
-H "Authorization: Bearer sk-your-api-key-here"
const limitId = 'sl_123abc';
const response = await fetch(`https://www.pierre.finance/tools/api/get-spending-limit-transactions?limitId=${limitId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer sk-your-api-key-here'
}
});
const data = await response.json();
const { limit, spending, status } = data.data;
console.log(`${limit.category}: R$ ${spending.currentSpent.toFixed(2)} / R$ ${limit.limitAmount.toFixed(2)}`);
console.log(`Progresso: ${spending.percentage.toFixed(1)}%`);
console.log(`Restante: R$ ${spending.remaining.toFixed(2)}`);
if (status.nextAlert) {
console.log(`Próximo alerta: ${status.nextAlert}`);
} else {
console.log('Limite já excedido');
}
import requests
limit_id = "sl_123abc"
url = f"https://www.pierre.finance/tools/api/get-spending-limit-transactions"
headers = {
"Authorization": "Bearer sk-your-api-key-here"
}
params = {"limitId": limit_id}
response = requests.get(url, headers=headers, params=params)
data = response.json()
if response.status_code == 200:
limit = data['data']['limit']
spending = data['data']['spending']
status = data['data']['status']
print(f"📊 {limit['category']} ({limit['periodText']})")
print(f"💰 Gasto: R$ {spending['currentSpent']:.2f} / R$ {limit['limitAmount']:.2f}")
print(f"📈 Progresso: {spending['percentage']:.1f}%")
print(f"💳 Transações: {spending['transactionCount']}")
if status['nextAlert']:
print(f"⚠️ Próximo alerta: {status['nextAlert']}")
# Status com emoji
status_emoji = {
'ok': '🟢',
'warning': '🟡',
'danger': '🔴'
}
print(f"{status_emoji.get(status['level'], '⚪')} Status: {status['level']}")
else:
print(f"Erro: {data.get('message', 'Limite não encontrado')}")
Authorizations
API key in Bearer token format. Example: Bearer sk-your-api-key-here
Query Parameters
ID do limite de gastos para consultar o status

