Skip to main content

Tolerance Report

Tolerance analysis per invoice — shows deviation from system amount, auto-approval/review/rejection results based on configured tolerance rules.

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

Overview

Analyzes each invoice against configured tolerance rules, showing the deviation from the system amount and the resulting action (auto-approved, sent to review, or rejected). Includes a summary with anomaly counts and average deviation.

  • Tolerance rule detail — configured type (PCT, ABS, AMB), value, and origin per invoice
  • Result classificationAUTO_APPROVED, REVIEW, or REJECTED
  • Anomaly filteringanomalies_only=true returns only invoices outside tolerance
  • Provider filtering — restrict to specific providers (up to 100)
  • Summary — auto-approved, in-review, rejected counts and average deviation

Query Parameters

ParameterTypeRequiredDefaultDescription
startdatestringYesISO 8601 start date
enddatestringYesISO 8601 end date. Max range 93 days
providersstringNoAllComma-separated provider IDs. Max 100
anomalies_onlybooleanNofalseOnly return invoices outside tolerance (review + rejected)
limitintegerNo25Records per page (1100)
offsetintegerNo0Records to skip

Code Examples

curl -s "https://$TENANT/apidev/v1/reports/portal/tolerance?startdate=2026-01-01&enddate=2026-03-31&anomalies_only=true&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_amountnumberProvider-reported amount
differencenumberAbsolute difference (system − provider)
deviation_pctnumberDeviation as percentage of system amount
state_idnumber | nullInvoice state code
state_namestring | nullHuman-readable state name
tolerance_configuredstringHuman-readable tolerance rule description
tolerance_typestringTolerance type: PCT (percentage), ABS (absolute), AMB (both)
tolerance_valuenumberConfigured tolerance threshold
tolerance_originstringWhere the tolerance rule was defined (e.g. "provider", "global", "product")
resultstringTolerance result: AUTO_APPROVED, REVIEW, REJECTED
within_tolerancebooleanWhether the invoice is within configured tolerance

Summary

FieldTypeDescription
total_invoicesnumberTotal invoice count in range
auto_approvednumberCount of auto-approved invoices
in_reviewnumberCount of invoices sent to review
rejectednumberCount of rejected invoices
avg_deviation_pctnumberAverage deviation percentage
providers_with_anomaliesnumberCount of providers with at least one anomaly

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,
"deviation_pct": 4.80,
"state_id": 101,
"state_name": "In Review",
"tolerance_configured": "5% or $500",
"tolerance_type": "AMB",
"tolerance_value": 5.00,
"tolerance_origin": "provider",
"result": "REVIEW",
"within_tolerance": false
},
{
"invoice_id": "710450328802",
"provider_id": "504210987602",
"provider_name": "ServiFlota Express",
"service_id": "820134567803",
"service_number": "SRV-2026-00195",
"invoice_date": "2026-03-02",
"system_amount": 9200.00,
"provider_amount": 11800.00,
"difference": -2600.00,
"deviation_pct": 28.26,
"state_id": 103,
"state_name": "Rejected",
"tolerance_configured": "10%",
"tolerance_type": "PCT",
"tolerance_value": 10.00,
"tolerance_origin": "global",
"result": "REJECTED",
"within_tolerance": false
}
],
"summary": {
"total_invoices": 253,
"auto_approved": 198,
"in_review": 42,
"rejected": 13,
"avg_deviation_pct": 3.45,
"providers_with_anomalies": 8
}
},
"meta": {
"total": 55,
"limit": 50,
"offset": 0
}
}

Errors

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