For developers & agents
A receivables desk built to be run by AI agents
An AI bookkeeper chasing invoices needs the aging report as data, a late fee it can defend with a statute citation, reminder copy with correct day arithmetic, and a send path that never lies about what went out. Duebay exposes the same engine behind the app as a REST API and a hosted MCP server, so an agent calls a tool instead of guessing at the law or the calendar.
Quickstart
No signup, one call
This exact command works right now: the sandbox key dc_test_sandbox is always valid on the compute endpoints. Send a balance, a due date and the agreed terms; get back the fee, the arithmetic, and what California law says about it, citation included.
request
curl -X POST https://www.duebay.com/api/v1/late-fee \
-H "Authorization: Bearer dc_test_sandbox" \
-H "Content-Type: application/json" \
-d '{"balance_cents":250000,"due_date":"2026-06-01","as_of":"2026-07-15","state":"CA","terms":{"type":"percent_monthly","value":1.5,"grace_days":5}}'response 200
{
"data": {
"fee_cents": 4839,
"fee": 48.39,
"basis": "ok",
"days_overdue": 44,
"chargeable_days": 39,
"derivation": [
"Invoice was due Jun 1, 2026; as of Jul 15, 2026 it is 44 days overdue.",
"Minus the 5-day grace period agreed on the invoice: 39 chargeable days.",
"Agreed rate: 1.5% per month, accrued per calendar month (not annualized to a daily rate).",
"Chargeable period Jun 6, 2026 to Jul 15, 2026 = 1 full month + 9 days of a 31-day month = 1.2903 months.",
"$2,500.00 x 1.5% x 1.2903 months = $48.39 (simple interest, not compounded).",
"California law on agreed rates: Yes, subject to the constitutional usury limits of art. XV, § 1: for loans/forbearances NOT primarily for personal, family, or household purposes (i.e., business/commercial), the cap is the higher of 10% per annum or 5% over the Federal Reserve Bank of San Francisco discount rate (set as of the 25th day before the loan); consumer-purpose loans are capped at 10%. Exemptions swallow much of the rule: banks, savings associations, credit unions, industrial loan companies, licensed pawnbrokers, real-estate-broker-arranged loans secured by realty, and other statutorily exempt classes are not subject to the caps. Note usury law applies to loans/forbearances - bona fide trade credit and agreed charges on sales invoices are generally analyzed as forbearance only if credit is extended on an overdue debt. (Cal. Const. art. XV, § 1). Check your agreed rate against this before charging."
],
"statute": {
"state_code": "CA",
"state_name": "California",
"legal_interest_rate_pct": 10,
"interest_rate_citation": "Cal. Civ. Code § 3289(b); Cal. Const. art. XV, § 1",
"interest_rate_summary": "For breach of contract - the situation covering overdue B2B invoices - Civ. Code § 3289(b) provides that if a contract entered into after Jan. 1, 1986 does not stipulate a rate, the obligation bears interest at 10% per annum after breach (excludes notes secured by real-property deeds of trust); a contractually stipulated lawful rate keeps running after breach (§ 3289(a)). Separately, the constitutional default \"legal rate\" for loans/forbearances generally is 7% per annum (art. XV, § 1). Both verified on the official leginfo.legislature.ca.gov site.",
"contract_rate_summary": "Yes, subject to the constitutional usury limits of art. XV, § 1: for loans/forbearances NOT primarily for personal, family, or household purposes (i.e., business/commercial), the cap is the higher of 10% per annum or 5% over the Federal Reserve Bank of San Francisco discount rate (set as of the 25th day before the loan); consumer-purpose loans are capped at 10%. Exemptions swallow much of the rule: banks, savings associations, credit unions, industrial loan companies, licensed pawnbrokers, real-estate-broker-arranged loans secured by realty, and other statutorily exempt classes are not subject to the caps. Note usury law applies to loans/forbearances - bona fide trade credit and agreed charges on sales invoices are generally analyzed as forbearance only if credit is extended on an overdue debt.",
"contract_rate_citation": "Cal. Const. art. XV, § 1",
"prompt_payment_scope": "public+private-construction",
"prompt_payment_rate_summary": "Public: California Prompt Payment Act (Gov. Code § 927 et seq.) - state agencies must pay undisputed invoices within 45 days of receipt or pay late-payment penalties (must dispute within 15 working days; enhanced penalties for small businesses). Private construction: Civ. Code § 8800 - owner must pay undisputed progress payments within 30 days of demand; violation carries a penalty of 2% per month on the amount wrongfully withheld in lieu of interest, plus prevailing-party attorney fees; owner may withhold up to 150% of a good-faith disputed amount. Related contractor-to-subcontractor prompt-pay provisions exist across the construction codes. No general private non-construction commercial prompt-pay act.",
"prompt_payment_citation": "Cal. Gov. Code § 927 et seq.; Cal. Civ. Code § 8800",
"late_fee_notes": "Flat late fees on commercial invoices are enforceable if they satisfy California's liquidated-damages doctrine (reasonable, not a penalty; California law presumptively favors liquidated-damages clauses in non-consumer contracts). In construction, the 2%/month prompt-payment penalty regime supplies the remedy for wrongful withholding. Interest-style late charges on trade credit can implicate usury as a \"forbearance\" if the transaction is recharacterized as a loan - the business-purpose cap (higher of 10% or FRBSF discount +5%) is the relevant ceiling for non-exempt creditors.",
"sources": [
"https://leginfo.legislature.ca.gov/faces/codes_displaySection.xhtml?lawCode=CIV§ionNum=3289",
"https://leginfo.legislature.ca.gov/faces/codes_displayText.xhtml?lawCode=CONS&article=XV",
"https://calconstructionlawblog.com/2013/07/09/an-overview-of-californias-prompt-payment-laws/",
"https://www.levelset.com/prompt-payment/california-prompt-payment-faqs/",
"https://law.justia.com/codes/california/2010/civ/8800-8802.html"
],
"confidence": "high"
},
"balance_cents": 250000,
"due_date": "2026-06-01",
"as_of": "2026-07-15",
"terms": {
"type": "percent_monthly",
"value": 1.5,
"grace_days": 5
},
"statute_disclaimer": "Informational summary of state and federal statutes as researched on the sources listed per entry; not legal advice - verify current law with licensed counsel before relying on any rate or citation."
},
"request_id": "req_1f2e3d4c5b6a79880911aabb",
"disclaimer": "Duebay computes late fees and interest from state statutes and the terms on your invoice, and shows the citation behind every number. It is general information, not legal advice: statutes change and contracts vary, so confirm with counsel before relying on a figure in a dispute. Where a rule could not be verified, Duebay says \"verify with counsel\" rather than guessing."
}This is the real response, computed by the engine, not hand-typed. Note basis: with no agreed terms the engine returns reference_only and charges nothing, because a late fee generally must be agreed in advance to be enforceable. Reading your own book (aging, invoices) is the keyed half.
Built for agents
What an agent actually needs from this API
Two things a model should not guess
A language model can draft a polite email, but it will hallucinate a "standard" late-fee rate and it will get day-count arithmetic wrong across a month boundary. Duebay does the statute lookup (with the citation) and the arithmetic (with the derivation), deterministically, so your agent never has to trust its own guess about someone's money.
Single-key auth
One API key unlocks the REST API and the MCP server. Authorization: Bearer dc_live_... or dc_test_.... No OAuth dance, no per-endpoint credentials. The compute endpoints need no key at all.
Machine-readable docs
A full reference, a spec at /api/openapi, and a plain-text summary at /llms.txt so an agent can onboard itself without a human reading a page first.
Honest by construction
reminder_sent is logged only after the email provider accepted the message; a failed send logs send_failed with the real reason. No agreed late-fee terms means nothing to charge, and an unverified statute field is null with a statute_unavailable note, never a guess.
Safe by default
Anonymous compute calls work for a dry run, throttled to 4/min and 20/day per IP. The sandbox key dc_test_sandbox raises that to 10/min and 200/day with zero signup, and never bills. Writes take an Idempotency-Key, so an agent retry cannot double-create an invoice or double-email a customer.
Citations and derivations on every call
Every late-fee figure returns plain-English derivation lines you can reproduce by hand, and the statute context carries its citation, its source URLs and an honest confidence grade. Every keyed call lands in an inspectable request log.
REST API
Every endpoint
Base URL https://www.duebay.com/api/v1. The compute endpoints (late-fee, dunning drafts, statutes, pricing) need no key; the literal sandbox key `dc_test_sandbox` also works there with zero signup, at a higher throttle. Your own data (aging, invoices, usage) needs a real key: send `Authorization: Bearer dc_live_...` (or `x-api-key`). A `dc_test_` key works on every plan, throttled, and never bills. Sending reminders needs a paid plan.
/api/v1/late-fee
No key neededCompute the late fee for an overdue balance from the terms AGREED on the invoice, with the state statute shown alongside: citation, sources and a confidence grade. Deterministic: no model, same input to same output, and every number is reproducible from the plain-English derivation lines. No agreed terms means nothing to charge; the statutory rate is then shown as a labelled reference, never as a fee. Free, no key needed.
request
curl -X POST https://www.duebay.com/api/v1/late-fee \
-H "Authorization: Bearer dc_test_sandbox" \
-H "Content-Type: application/json" \
-d '{"balance_cents":250000,"due_date":"2026-06-01","as_of":"2026-07-15","state":"CA","terms":{"type":"percent_monthly","value":1.5,"grace_days":5}}'/api/v1/dunning/draft
No key neededRender payment-reminder drafts for an invoice you describe inline: subject and body per step of the standard chase (courtesy heads-up, friendly, firm, final), or one step when `tone` is given. It composes; it does NOT send. Free, no key needed.
request
curl -X POST https://www.duebay.com/api/v1/dunning/draft \
-H "Authorization: Bearer dc_test_sandbox" \
-H "Content-Type: application/json" \
-d '{"customer_name":"Acme Ltd","business_name":"Beech Studio","invoice_number":"INV-1042","amount_cents":250000,"due_date":"2026-06-01","as_of":"2026-07-15","payment_url":"https://pay.example.com/inv-1042","tone":"firm"}'/api/v1/statutes
No key neededThe state late-fee / interest / prompt-payment statute library as structured data: every entry carries its citations, source URLs, an honest confidence grade and the dataset's generated_at. Fields that could not be verified are null, never guessed. Free, no key needed, CDN-cached.
request
curl https://www.duebay.com/api/v1/statutes
/api/v1/statutes/{state}
No key neededOne state's statute entry, by two-letter code (CA) or name slug (california). A state without a verified entry returns an explicit statute_unavailable error, never an invented rate.
request
curl https://www.duebay.com/api/v1/statutes/CA
/api/v1/aging
Requires a keyThe caller's live AR aging report: outstanding balances bucketed current / 1-30 / 31-60 / 61-90 / 90+, the largest overdue balance, and DSO computed by the simple method over the trailing 91 days, with the method stated in the response. Requires a key (reads your own invoices).
request
curl https://www.duebay.com/api/v1/aging \ -H "Authorization: Bearer dc_live_..."
/api/v1/invoices
Requires a keyList the caller's invoices, newest first, with the customer, outstanding balance, days overdue and chasing state on each row.
request
curl "https://www.duebay.com/api/v1/invoices?overdue=true" \ -H "Authorization: Bearer dc_live_..."
/api/v1/invoices
Requires a keyCreate an invoice, upserting its customer by name in the same call. Unknown body fields are rejected with the known_keys listed, so an agent can self-correct. Idempotent via the Idempotency-Key header.
request
curl -X POST https://www.duebay.com/api/v1/invoices \
-H "Authorization: Bearer dc_live_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: inv-1042" \
-d '{"invoice_number":"INV-1042","amount_cents":250000,"issue_date":"2026-05-02","due_date":"2026-06-01","customer":{"name":"Acme Ltd","email":"[email protected]","state":"CA"},"payment_url":"https://pay.example.com/inv-1042","late_fee":{"type":"percent_monthly","value":1.5,"grace_days":5}}'/api/v1/invoices/{id}/remind
Requires a paid planActually send the next (or a specified) reminder for one invoice, through the same send path the app uses. reminder_sent is logged only after the provider accepted the message; a failed send logs send_failed and returns the real error. Requires a paid plan. Idempotent via Idempotency-Key, so a retry cannot double-email a customer.
request
curl -X POST https://www.duebay.com/api/v1/invoices/4f2ac9d1-3b7e-4a90-8e21-6c8f2b9a5d3e/remind \
-H "Authorization: Bearer dc_live_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: remind-inv-1042-step-2" \
-d '{}'/api/v1/usage
Requires a keyThe caller's request-log summary: billable calls this month, the plan quota and overage price, and the 20 most recent requests.
request
curl https://www.duebay.com/api/v1/usage \ -H "Authorization: Bearer dc_live_..."
/api/v1/pricing
No key neededMachine-readable pricing: plans, active-invoice limits, included API calls, per-call overage, rate limits and features, projected from the same module the pricing page renders.
request
curl https://www.duebay.com/api/v1/pricing
Duebay computes late fees and interest from state statutes and the terms on your invoice, and shows the citation behind every number. It is general information, not legal advice: statutes change and contracts vary, so confirm with counsel before relying on a figure in a dispute. Where a rule could not be verified, Duebay says "verify with counsel" rather than guessing.
Live API access is a Pro or Scale feature
The compute endpoints are free and keyless, always, and dc_test_sandbox works on them with zero signup. A dc_test_ key is free on every plan and adds your own data (aging, invoices, usage), throttled, and never bills. A live dc_live_ key at plan quota, and sending reminders through the API, need Pro or Scale. See /api/v1/pricing for the machine-readable version.
See plans & quotas