Skip to main content
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>'
{
  "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 endpoint GET /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.
Authorization
string
required
Bearer token com a API key do usuário. Formato: Bearer sk-your-api-key-here

Parâmetros de Query

limitId
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 campo status.level indica a situação atual:
  • ok: Abaixo de 50% do limite
  • warning: Entre 50% e 99% do limite
  • danger: 100% ou mais do limite

Próximos Alertas

O campo status.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 limite
  • null: 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"

Authorizations

Authorization
string
header
required

API key in Bearer token format. Example: Bearer sk-your-api-key-here

Query Parameters

limitId
string
required

ID do limite de gastos para consultar o status

Response

Status detalhado do limite de gastos

success
boolean
Example:

true

data
any
timestamp
string<date-time>