Get Trend Data
Invoices
Get Trend Data
Retrieve monthly trend data for income and expenses
GET
Get Trend Data
Documentation Index
Fetch the complete documentation index at: https://docs.contafy.com.mx/llms.txt
Use this file to discover all available pages before exploring further.
Authentication
This endpoint requires authentication. Include your access token in the Authorization header.Query Parameters
Filter trends by profile ID
Year to retrieve trends for (defaults to current year)
View mode for the trend data:
año-actual: Only the selected year up to the current month (default)últimos-12-meses: Rolling window of the last 12 monthsaño-completo: All 12 months of the selected yearcomparar-anterior: Current year plus last 3 months of previous year
Cutoff month (1-12) to limit data up to a specific month. Automatically clamped to current month if in current year.
Filter by tax regime code
Response
Returns an array of monthly data points:Array of monthly trend data points
Example Requests
Get current year trends (default)
Get last 12 months rolling window
Get full year with comparison
Get year up to specific month
Example Response
Error Responses
401 Unauthorized
400 Bad Request
500 Internal Server Error
Period View Modes
año-actual (Default)
Returns only the selected year up to the current month (or mes_corte if specified). This is the most common view for tracking year-to-date performance. Example: For March 2026, returns data for January, February, and March 2026 only.últimos-12-meses
Returns a rolling 12-month window ending at the current month. Useful for seeing trends without year boundaries. Example: For March 2026, returns April 2025 through March 2026.año-completo
Returns all 12 months of the selected year, regardless of the current date. Months without data return zero values. Example: Returns January through December of the selected year.comparar-anterior
Returns the current year plus the last 3 months of the previous year for comparison. Only works when viewing the current year. Example: For March 2026, returns October-December 2025 and January-March 2026.Notes
- The endpoint aggregates metrics data from multiple months into a single response
- Data points with no activity will have zero values for all numeric fields
- Trends use the same cash flow and accrual calculations as the metrics endpoint
- The response is sorted chronologically (oldest to newest)
- When using
mes_cortein the current year, it automatically clamps to the current month - Trend data is useful for charts and visualizations showing financial performance over time