GET /api/expenses
Retrieves a paginated list of expenses for the authenticated user with support for filtering by profile, date, category, and more.
Authentication
This endpoint requires authentication. Include your access token in the request cookies.
Query Parameters
Filter expenses by specific profile ID (RFC emisor)
Filter by year (e.g., 2024)
Filter by payment type. Options: PUE, PPD, COMPLEMENTO_PAGO
Filter by expense category
Page number for pagination
Search term to filter expenses by concept, RFC, or name
Response
Array of expense objects
Unique identifier for the expense
Profile ID associated with this expense
Origin type. Options: XML, MANUAL
Date of the expense (ISO 8601 format)
Month of the expense (1-12)
Total amount including taxes
IVA amount (transferred tax)
Payment date (ISO 8601 format)
Description/concept of the expense
Fiscal UUID from SAT (for XML expenses)
Payment type: PUE, PPD, COMPLEMENTO_PAGO
Creation timestamp (ISO 8601)
Last update timestamp (ISO 8601)
Pagination information
Total number of expenses matching the filters
Example Request
curl -X GET "https://api.contafy.com/api/expenses?page=1&limit=20&mes=3&año=2024" \
-H "Cookie: access_token=your_access_token"
Example Response
{
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"profile_id": "profile-123",
"tipo_origen": "XML",
"fecha": "2024-03-15T10:30:00Z",
"mes": 3,
"año": 2024,
"total": 11600,
"subtotal": 10000,
"iva": 16,
"iva_amount": 1600,
"is_paid": true,
"payment_date": "2024-03-15T10:30:00Z",
"concepto": "Servicios de consultoría",
"categoria": "Servicios profesionales",
"uuid": "12345678-1234-1234-1234-123456789012",
"tipo": "PUE",
"rfc_emisor": "XAXX010101000",
"nombre_emisor": "Proveedor Ejemplo SA de CV",
"rfc_receptor": "CACX7605101P8",
"nombre_receptor": "Mi Empresa",
"created_at": "2024-03-15T10:35:00Z",
"updated_at": "2024-03-15T10:35:00Z"
}
],
"pagination": {
"total": 150,
"page": 1,
"limit": 20,
"totalPages": 8
}
}
Error Responses
Authentication required or token expired{
"error": "Unauthorized",
"message": "Authentication required"
}
Invalid query parameters{
"error": "Bad Request",
"message": "Invalid month value. Must be between 1 and 12"
}
500 Internal Server Error
Server error occurred{
"error": "Internal Server Error",
"message": "An unexpected error occurred"
}