Revenue Leakage API

Analyze commercial records orders, invoices, payments, and credits for possible revenue leakage. Accepts raw JSON with no ERP or accounting integration required. Every monetary conclusion traces to supplied numbers, and exposure is reported cautiously.

Endpoint

POST /api/v1/revenue-leak

Metered by records analyzed (the total across all supplied arrays). The synchronous maximum is 10,000 records per request.

Request fields

FieldTypeDescription
ordersobject[]Order/opportunity records. Linked to invoices by order_id.
invoicesobject[]Invoice records. Linked to orders by order_id and to payments by invoice_id.
paymentsobject[]Payment records. Linked to invoices by invoice_id.
creditsobject[]Credit/refund records. Used for duplicate-credit detection.

Provide at least one array. Common fields (amount,status, currency) are detected automatically; missing values are treated as no data, never as zero.

Finding types

FieldTypeDescription
order_without_invoicefindingAn order with no linked invoice. Potential exposure.
invoice_amount_mismatchfindingInvoiced amount differs from the booked order amount.
invoice_without_paymentfindingAn unpaid invoice with no linked payment (and not void/refunded).
payment_amount_mismatchfindingPayments do not sum to the invoiced amount. Underpayment is a verified shortfall.
duplicate_invoicefindingThe same invoice id appears more than once.
duplicate_creditfindingThe same credit id appears more than once.
status_conflictfindingLifecycle statuses disagree (e.g. a won order with only void invoices).
missing_financial_recordfindingA record references an id that is absent from the supplied data.

Economic integrity

Exposure is split into potential (value at risk, such as an uninvoiced order) and verified (a proven shortfall between two supplied numbers, such as an underpayment). A discrepancy is never called lost revenue unless the numbers prove it. Counts are never turned into dollars, and when exposure cannot be defensibly calculated it is null.

Reasoning challenges

Before a finding is presented, it is tested against ordinary explanations timing gaps, duplicate keys, currency mismatches, and missing evidence. Raised challenges lower a findings confidence and are listed in its challenges array so you can judge it for yourself.

Try it live

Pick a scenario or edit the JSON, then send it against the live engine. No API key required.

Try it livePOST /api/v1/revenue-leak
Request bodyeditable
Response

// Send the request to see the live response.

Live demo endpoint · no API key needed · rate-limited · not stored · runs the production engine

Example request

Request
POST /api/v1/revenue-leak
Authorization: Bearer zap_live_...
Content-Type: application/json

{
  "orders": [
    { "order_id": "ORD-1", "amount": 18000, "status": "won" },
    { "order_id": "ORD-2", "amount": 9000, "status": "won" }
  ],
  "invoices": [
    { "invoice_id": "INV-2", "order_id": "ORD-2", "amount": 9000, "status": "paid" }
  ],
  "payments": [
    { "payment_id": "PAY-2", "invoice_id": "INV-2", "amount": 7000 }
  ]
}

Example response

200 OK
{
  "request_id": "req_xxx",
  "status": "completed",
  "summary": { "records_analyzed": 4, "findings": 2, "processing_time_ms": 1 },
  "financial_exposure": { "potential": 20000, "verified": 2000, "currency": null },
  "findings": [
    {
      "type": "order_without_invoice",
      "message": "Order ORD-1 has no linked invoice; its value is potentially at risk (not yet proven lost).",
      "monetary_class": "potential_exposure",
      "amount": 18000,
      "currency": null,
      "confidence": 0.8,
      "evidence": [{ "source": "orders", "record_id": "ORD-1", "field": "amount", "value": 18000, "index": 0 }],
      "challenges": []
    },
    {
      "type": "payment_amount_mismatch",
      "message": "Payments for invoice INV-2 do not equal the invoiced amount (observed discrepancy).",
      "monetary_class": "verified_exposure",
      "amount": 2000,
      "currency": null,
      "confidence": 0.9,
      "evidence": [
        { "source": "invoices", "record_id": "INV-2", "field": "amount", "value": 9000 },
        { "source": "payments", "record_id": "PAY-2", "field": "amount", "value": 7000 }
      ],
      "challenges": []
    }
  ]
}

Code examples

curl -X POST https://api.zapiit.com/api/v1/revenue-leak \
  -H "Authorization: Bearer $ZAPIIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "orders": [{ "order_id": "ORD-1", "amount": 18000, "status": "won" }],
    "invoices": [],
    "payments": []
  }'