Skip to main content

Differences Report

System vs provider amount comparison per invoice — highlights discrepancies with percentage and absolute differences.

GET/apidev/v1/reports/portal/differences
PermissionAPICLI_RPTPORTAL_DIFERENCIAS
Rate Limit10 req/min (sliding window)
Cache300s (5 min)
Max Range93 days

Overview

Compares system-calculated amounts against provider-reported amounts for each invoice. Returns paginated rows with per-invoice differences and a summary with aggregate totals.

  • Per-invoice detail — absolute and percentage difference for every invoice
  • Provider filtering — restrict to specific providers (up to 100)
  • State filtering — filter by invoice state codes (100–106)
  • Summary aggregates — total system vs provider amounts, net difference, count of invoices with discrepancies

Query Parameters

ParameterTypeRequiredDefaultDescription
startdatestringYesISO 8601 start date
enddatestringYesISO 8601 end date. Max range 93 days
providersstringNoAllComma-separated provider IDs. Max 100
statesstringNoAllComma-separated state codes (100–106)
limitintegerNo25Records per page (1100)
offsetintegerNo0Records to skip

Code Examples

curl -s "https://$TENANT/apidev/v1/reports/portal/differences?startdate=2026-01-01&enddate=2026-03-31&limit=50" \
-H "Authorization: Bearer $TOKEN" \
-H "X-API-Key: $APIKEY" \
-H "tenant: $TENANT"

Response Fields

Rows

FieldTypeDescription
invoice_idstringInvoice identifier
provider_idstringProvider identifier
provider_namestringProvider display name
service_idstringAssociated service identifier
service_numberstringService number (human-readable)
invoice_datestringInvoice date
system_amountnumberSystem-calculated amount
provider_amountnumber | nullProvider-reported amount. null if not submitted
differencenumberAbsolute difference (system − provider)
difference_pctnumberPercentage difference
state_codestring | nullInvoice state code
state_namestring | nullHuman-readable state name
provider_invoice_numberstring | nullProvider's own invoice number
provider_invoice_datestring | nullDate on the provider's invoice

Summary

FieldTypeDescription
total_systemnumberSum of all system amounts
total_providernumberSum of all provider amounts
net_differencenumberTotal system − total provider
avg_variation_pctnumberAverage variation percentage
total_invoicesnumberTotal invoice count in range
invoices_with_differencenumberCount of invoices where difference ≠ 0

Example Response

{
"success": true,
"data": {
"rows": [
{
"invoice_id": "710450328800",
"provider_id": "504210987600",
"provider_name": "Transporte Rápido S.A.",
"service_id": "820134567800",
"service_number": "SRV-2026-00142",
"invoice_date": "2026-02-15",
"system_amount": 12500.00,
"provider_amount": 13100.00,
"difference": -600.00,
"difference_pct": -4.80,
"state_code": "101",
"state_name": "In Review",
"provider_invoice_number": "FAC-2026-0087",
"provider_invoice_date": "2026-02-14"
},
{
"invoice_id": "710450328801",
"provider_id": "504210987601",
"provider_name": "Logística del Norte",
"service_id": "820134567801",
"service_number": "SRV-2026-00158",
"invoice_date": "2026-02-18",
"system_amount": 8700.00,
"provider_amount": 8700.00,
"difference": 0.00,
"difference_pct": 0.00,
"state_code": "102",
"state_name": "Approved",
"provider_invoice_number": "LN-0234",
"provider_invoice_date": "2026-02-17"
}
],
"summary": {
"total_system": 842300.00,
"total_provider": 856720.00,
"net_difference": -14420.00,
"avg_variation_pct": 1.71,
"total_invoices": 253,
"invoices_with_difference": 87
}
},
"meta": {
"total": 253,
"limit": 50,
"offset": 0
}
}

Errors

CodeHTTPDescription
BAD_REQUEST400Missing required headers or startdate/enddate
VALIDATION_ERROR400Date range exceeds 93 days, invalid state codes, > 100 providers
UNAUTHORIZED401Invalid or expired JWT / API Key
FORBIDDEN403User lacks APICLI_RPTPORTAL_DIFERENCIAS permission
RATE_LIMITED429Exceeded 10 req/min
INTERNAL_ERROR500Unexpected server error