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/tolerancePermissionAPICLI_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 classification —
AUTO_APPROVED,REVIEW, orREJECTED - Anomaly filtering —
anomalies_only=truereturns 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
startdate | string | Yes | — | ISO 8601 start date |
enddate | string | Yes | — | ISO 8601 end date. Max range 93 days |
providers | string | No | All | Comma-separated provider IDs. Max 100 |
anomalies_only | boolean | No | false | Only return invoices outside tolerance (review + rejected) |
limit | integer | No | 25 | Records per page (1–100) |
offset | integer | No | 0 | Records to skip |
Code Examples
- cURL
- JavaScript
- Python
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"
const response = await fetch(
`https://${TENANT}/apidev/v1/reports/portal/tolerance?startdate=2026-01-01&enddate=2026-03-31&anomalies_only=true&limit=50`,
{ headers }
);
const { data, meta } = await response.json();
console.log(`Rejected: ${data.summary.rejected}`);
response = requests.get(
f"https://{TENANT}/apidev/v1/reports/portal/tolerance",
headers=headers,
params={
"startdate": "2026-01-01",
"enddate": "2026-03-31",
"anomalies_only": True,
"limit": 50,
},
)
result = response.json()
summary = result["data"]["summary"]
Response Fields
Rows
| Field | Type | Description |
|---|---|---|
invoice_id | string | Invoice identifier |
provider_id | string | Provider identifier |
provider_name | string | Provider display name |
service_id | string | Associated service identifier |
service_number | string | Service number (human-readable) |
invoice_date | string | Invoice date |
system_amount | number | System-calculated amount |
provider_amount | number | Provider-reported amount |
difference | number | Absolute difference (system − provider) |
deviation_pct | number | Deviation as percentage of system amount |
state_id | number | null | Invoice state code |
state_name | string | null | Human-readable state name |
tolerance_configured | string | Human-readable tolerance rule description |
tolerance_type | string | Tolerance type: PCT (percentage), ABS (absolute), AMB (both) |
tolerance_value | number | Configured tolerance threshold |
tolerance_origin | string | Where the tolerance rule was defined (e.g. "provider", "global", "product") |
result | string | Tolerance result: AUTO_APPROVED, REVIEW, REJECTED |
within_tolerance | boolean | Whether the invoice is within configured tolerance |
Summary
| Field | Type | Description |
|---|---|---|
total_invoices | number | Total invoice count in range |
auto_approved | number | Count of auto-approved invoices |
in_review | number | Count of invoices sent to review |
rejected | number | Count of rejected invoices |
avg_deviation_pct | number | Average deviation percentage |
providers_with_anomalies | number | Count 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
| Code | HTTP | Description |
|---|---|---|
BAD_REQUEST | 400 | Missing required headers or startdate/enddate |
VALIDATION_ERROR | 400 | Date range exceeds 93 days, > 100 providers |
UNAUTHORIZED | 401 | Invalid or expired JWT / API Key |
FORBIDDEN | 403 | User lacks APICLI_RPTPORTAL_TOLERANCIA permission |
RATE_LIMITED | 429 | Exceeded 10 req/min |
INTERNAL_ERROR | 500 | Unexpected server error |
Related
- Portal Dashboard — Executive KPIs and charts
- Differences Report — Per-invoice system vs provider comparison
- Portal Invoices — Invoice management endpoints
- Pagination — Standard pagination parameters