Skip to main content
GET
/
api
/
transacciones
Transactions API
curl --request GET \
  --url https://api.example.com/api/transacciones
{
  "data": [
    {
      "id": "<string>",
      "tipo": "<string>",
      "monto": 123,
      "categoria": "<string>",
      "concepto": "<string>",
      "descripcion": "<string>",
      "metodo_pago": "<string>",
      "registrado_por": "<string>",
      "fecha": "<string>"
    }
  ],
  "vista": "<string>"
}

Overview

The Transactions API allows you to retrieve financial transactions (both expenses and income) with support for multiple view modes and custom date ranges.

Authentication

This endpoint uses Supabase authentication. Ensure your requests include valid authentication headers.

Endpoint

GET /api/transacciones

Query Parameters

vista
string
default:"mensual"
View mode for filtering transactions. Available options:
  • diaria: Last 7 days
  • semanal: Last 4 weeks (28 days)
  • mensual: Last 12 months
  • personalizada: Custom date range (requires fecha_inicio and fecha_fin)
fecha_inicio
string
Start date for custom range in YYYY-MM-DD format.Required when: vista=personalizadaExample: 2024-01-01
fecha_fin
string
End date for custom range in YYYY-MM-DD format.Required when: vista=personalizadaExample: 2024-12-31

Response

data
array
Array of transaction objects, ordered by date (most recent first). Limited to 500 results.
id
string
Unique transaction identifier
tipo
string
Transaction type: gasto (expense) or ingreso (income)
monto
number
Transaction amount in MXN
categoria
string
Transaction category:
  • Expenses: Alimentación, Transporte, Vivienda, Salud, Entretenimiento, Educación, Otros Gastos
  • Income: Salario, Ventas, Servicios, Inversiones, Otros Ingresos
concepto
string
Brief transaction description
descripcion
string
Detailed description
metodo_pago
string
Payment method: Efectivo, Tarjeta, or Transferencia
registrado_por
string
User who registered the transaction
fecha
string
Transaction date in ISO 8601 format
vista
string
The view mode used for filtering

Examples

const response = await fetch('/api/transacciones?vista=mensual');
const { data, vista } = await response.json();

console.log(`Retrieved ${data.length} transactions using ${vista} view`);

Response Examples

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "tipo": "gasto",
      "monto": 450.50,
      "categoria": "Transporte",
      "concepto": "Gasolina",
      "descripcion": "Llenado de combustible",
      "metodo_pago": "Tarjeta",
      "registrado_por": "Usuario",
      "fecha": "2024-03-06T15:30:00Z"
    },
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "tipo": "ingreso",
      "monto": 15000.00,
      "categoria": "Salario",
      "concepto": "Pago quincenal",
      "descripcion": null,
      "metodo_pago": "Transferencia",
      "registrado_por": "Usuario",
      "fecha": "2024-03-01T08:00:00Z"
    }
  ],
  "vista": "mensual"
}
All transactions are automatically ordered by date in descending order (most recent first). The API limits results to 500 transactions per request.

Use Cases

  • Dashboard Overview: Fetch recent transactions using vista=mensual
  • Weekly Reports: Get last 4 weeks of activity with vista=semanal
  • Custom Analysis: Analyze specific periods using vista=personalizada
  • Daily Tracking: Monitor recent activity with vista=diaria

Build docs developers (and LLMs) love