Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revenue Integrity API

Reconcile contracts, usage, invoices, payments and ledger state; detect revenue leakage and generate repair plans.

Quickstart: find a planted revenue leak without an account

This public demo runs the production reconciliation engine without storing or metering the customer-supplied records.

curl -sS -X POST https://revenueintegrity-api.com/v1/demo/reconcile \
  -H 'content-type: application/json' \
  -d '{"periodLabel":"2026-08","contract":[{"sku":"api-calls","ratePerUnitMicro":27,"includedUnits":100000,"minimumCommitmentMinor":50000}],"usage":[{"sku":"api-calls","quantity":1250000}],"invoices":[{"invoiceId":"INV-1001","sku":"api-calls","quantity":1000000,"amountMinor":2430}],"payments":[{"invoiceId":"INV-1001","amountMinor":1000}]}'

The response reports a recoverable amount in integer minor units and an evidence-backed repair for each finding:

{
  "periodLabel": "2026-08",
  "netImpactMinor": 49000,
  "recoverableMinor": 49000,
  "findingCount": 3,
  "severityCounts": {"high": 1, "medium": 1, "low": 1},
  "findings": [
    {
      "code": "quantity_mismatch",
      "severity": "low",
      "sku": "api-calls",
      "impactMinor": 675,
      "summary": "Metered 1250000 units of \"api-calls\" but invoiced 1000000 — a difference of 250000 units.",
      "evidence": [
        {"kind": "contract", "reference": "api-calls", "detail": "rate 27 micro-cents/unit, 100000 included"},
        {"kind": "usage", "reference": "api-calls", "detail": "1250000 units metered"},
        {"kind": "invoice", "reference": "INV-1001", "detail": "1000000 units invoiced"}
      ],
      "repair": {
        "action": "issue_invoice",
        "deltaMinor": 675,
        "description": "Invoice the 250000 unbilled unit(s) of \"api-calls\" at the contracted rate: 675 minor units."
      }
    },
    {
      "code": "minimum_commitment_shortfall",
      "severity": "high",
      "sku": "api-calls",
      "impactMinor": 46895,
      "summary": "Usage of \"api-calls\" earned 3105 minor units against a 50000 minimum commitment — a 46895 shortfall not trued up.",
      "evidence": [
        {"kind": "contract", "reference": "api-calls", "detail": "minimum commitment 50000 minor units"},
        {"kind": "usage", "reference": "api-calls", "detail": "1250000 units metered, earning 3105 minor units"}
      ],
      "repair": {
        "action": "true_up_commitment",
        "deltaMinor": 46895,
        "description": "Invoice the 46895 minor-unit commitment shortfall for \"api-calls\"."
      }
    },
    {
      "code": "underpayment",
      "severity": "medium",
      "sku": "*",
      "impactMinor": 1430,
      "summary": "Invoice INV-1001 totals 2430 minor units but only 1000 was received.",
      "evidence": [
        {"kind": "invoice", "reference": "INV-1001", "detail": "2430 minor units invoiced"},
        {"kind": "payment", "reference": "INV-1001", "detail": "1000 minor units received"}
      ],
      "repair": {
        "action": "collect_payment",
        "deltaMinor": 1430,
        "description": "Collect the outstanding 1430 minor units on invoice INV-1001."
      }
    }
  ],
  "requestId": "req_example"
}

That is the first useful result: recoverableMinor quantifies the supported recovery opportunity, while each finding supplies synthetic evidence and a repair action. The example evidence is derived only from the fictional contract and usage rows in the request; it is not customer or production data.

Create and use a free API key

curl -sS -X POST https://revenueintegrity-api.com/v1/keys \
  -H 'content-type: application/json' \
  -d '{"email":"you@example.com","source":{"source":"github","medium":"developer","campaign":"revenue-integrity-github","content":"readme"}}'

curl -sS -X POST https://revenueintegrity-api.com/v1/keys/claim \
  -H 'content-type: application/json' \
  -d '{"token":"PASTE_ONE_TIME_TOKEN_FROM_EMAIL"}'

export KEY='PASTE_API_KEY_FROM_CLAIM_RESPONSE'

Run the same complete payload on the authenticated endpoint. No untracked ledger.json file is required.

curl -sS -X POST https://revenueintegrity-api.com/v1/reconciliations \
  -H "Authorization: Bearer $KEY" \
  -H 'content-type: application/json' \
  -d '{"periodLabel":"2026-08","contract":[{"sku":"api-calls","ratePerUnitMicro":27,"includedUnits":100000,"minimumCommitmentMinor":50000}],"usage":[{"sku":"api-calls","quantity":1250000}],"invoices":[{"invoiceId":"INV-1001","sku":"api-calls","quantity":1000000,"amountMinor":2430}],"payments":[{"invoiceId":"INV-1001","amountMinor":1000}]}'

SDKs

The OpenAPI document is the authoritative operation and schema contract.

Collection scope

The runnable Postman collection includes the public demo, the no-key checkout path, key bootstrap, and API-key product operations. It intentionally excludes the provider-only billing webhook and browser-session subscription, invoice, and payment routes: those require a signed hub request or the dashboard's HttpOnly session and CSRF controls, and a bearer API key cannot run them. The OpenAPI document linked above remains the reference for those operations.

Authentication and troubleshooting

  • 401: set KEY to the value returned once by /v1/keys/claim.
  • 400 invalid_request: include periodLabel, contract, usage and invoices; money is integer minor units and rates are integer micro-cents. A client-side schema tool may label the same input problem 422 before send.
  • 429: wait for Retry-After when present, then retry with backoff.

Errors use a stable error.code and request ID. Share only the request ID with support, never customer records, the API key or the claim token.

Distribution attribution

The key request above uses the stable tuple github / developer / revenue-integrity-github / readme. The Postman collection and SDKs carry their own source metadata. Attribution compares qualified activation and retained use; it does not claim that this channel already performs.

License

MIT

Releases

Packages

Contributors

Languages