Skip to content

Reference

API reference

Every endpoint, merge field and error code below is generated from the same modules the API imports, so this page cannot say something the code does not do. Machine-readable versions: /api/openapi and /llms.txt. The curl examples on the compute endpoints use the sandbox key dc_test_sandbox, which always works, with zero signup.

Base URL

https://www.duebay.com/api/v1

Auth

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.

Idempotency

Send an `Idempotency-Key` header on POST /invoices and POST /invoices/{id}/remind to make retries safe: replaying the same key returns the ORIGINAL response with an `Idempotent-Replay: true` header, so an agent retry can never double-create an invoice or double-email a customer.

Tracing

Every response carries `X-Request-Id` and the body's `request_id`. Every keyed call is written to the inspectable request log (GET /api/v1/usage and Settings).

Attribution

Responses to anonymous, sandbox and Free-plan callers carry an `attribution` field naming Duebay. Paid responses do not.

Response envelope

This is the real response to the late-fee request example under POST /late-fee below, computed by the actual engine, not a hand-typed sample. Note the derivation lines: every number is reproducible by hand, and the statute carries its citation and a confidence grade.

200 response

{
  "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&sectionNum=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."
}

Merge fields

Every placeholder the templates understand

POST /dunning/draft and the reminder send path render with exactly these fields. An unknown placeholder in a template stays visible in the output, never silently blanked, so a bad template is caught by eye.

placeholderrenders as
{{customer_name}}Who the reminder addresses.
{{business_name}}Who it is from; signs the email.
{{invoice_number}}The invoice reference.
{{amount_due}}Outstanding balance, preformatted (e.g. $2,500.00).
{{issue_date}}Invoice issue date, human formatted.
{{due_date}}Invoice due date, human formatted.
{{days_overdue}}Whole days past due as of the computation date.
{{payment_url}}Where the customer pays. The [[payment_line]]...[[/payment_line]] block renders only when this exists.
{{portal_url}}The customer's read-only statement page. Lines using it are dropped when it is absent.

Errors

Structured, never silent

Every non-2xx response is JSON, never a fabricated fallback. The code is stable; build on it, not on the message text. Unknown body fields come back with known_keys, so an agent can self-correct on the next attempt.

codestatusmeaning
invalid_request400A required field is missing or malformed. `details.field` names it; an unknown field also lists `details.known_keys`, every key the endpoint understands.
unauthorized401The endpoint needs a real API key and none (or an invalid or revoked one, or the sandbox key) was presented.
upgrade_required402A live dc_live_ key on the Free plan, the Free invoice cap, or sending reminders without a paid plan. The message says which.
not_found404No invoice, customer or statute entry matches, or it belongs to a different owner. Unknown states say statute_unavailable rather than inventing a rate.
unprocessable422The request is well-formed but cannot be acted on: a paid or void invoice, a customer with no email, a completed sequence.
rate_limited429The per-minute burst, the test-key daily cap, or the anonymous daily cap. Retry-After is set.
not_configured503A required backend (database, email provider) is not configured on this deployment. Nothing was pretended to work.
upstream_unavailable502The email provider rejected or failed the send. The reminder was NOT sent, and send_failed was logged. Safe to retry.
internal500An unexpected server error. Safe to retry; contact support if it persists.

400, an unknown field (the real error, with known_keys)

{
  "error": {
    "code": "invalid_request",
    "message": "Unknown body field: amount.",
    "details": {
      "field": "amount",
      "known_keys": [
        "balance",
        "balance_cents",
        "due_date",
        "as_of",
        "state",
        "terms"
      ]
    }
  },
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}

Rate limits

By key type

The compute endpoints work with no key, throttled. dc_test_sandbox raises that throttle with zero signup. A free dc_test_ key adds your own data, never bills; a dc_live_ key needs Pro or Scale.

TierPer minutePer dayVolume
Anonymous (compute endpoints only)4/min20/dayLate fee, dunning drafts, statutes, pricing. No data access.
Sandbox key (dc_test_sandbox)10/min200/dayCompute endpoints with zero signup. No account behind it, so no data access.
Test key (any plan, dc_test_)10/min200/dayCompute + your own data (aging, invoices, usage), against the real engine. Never bills.
Pro (dc_live_)60/minn/a2,000 calls/mo included, then $0.03/call. Sending reminders included.
Scale (dc_live_)300/minn/a10,000 calls/mo included, then $0.02/call. Sending reminders included.

Every response carries X-RateLimit-Limit, X-RateLimit-Remaining, X-Quota-Limit and X-Quota-Remaining headers, so an agent can back off before it gets a 429. Full plan details at /pricing or the machine-readable /api/v1/pricing.

Endpoints

Every route

POST

/api/v1/late-fee

No key needed

Compute 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.

ParamInRequiredDescription
balance_centsbodyyesOutstanding balance in integer cents. `balance` (dollars) is accepted instead.
due_datebodyyesyyyy-mm-dd the invoice was due.
as_ofbodynoyyyy-mm-dd to compute as of. Defaults to today (UTC).
statebodynoTwo-letter US state code for statutory context. Omitted or unknown states return an explicit statute_unavailable note, never an invented rate.
termsbodyyes{ type: none | flat | percent_monthly | percent_annual, value, grace_days }. The terms as agreed on the invoice; the engine never invents terms.

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

{
  "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&sectionNum=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."
}
POST

/api/v1/dunning/draft

No key needed

Render 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.

ParamInRequiredDescription
customer_namebodyyesWho the reminder addresses.
business_namebodyyesWho the reminder is from (signs the email).
invoice_numberbodyyesThe invoice reference.
amount_centsbodyyesAmount due in integer cents. `amount` (dollars) is accepted instead.
due_datebodyyesyyyy-mm-dd the invoice is or was due.
as_ofbodynoyyyy-mm-dd for the days-overdue arithmetic. Defaults to today (UTC).
payment_urlbodynoWhere the customer pays. Omitted = the pay-online line is dropped, never a dead link.
portal_urlbodynoA statement page link. Omitted = the statement line is dropped.
tonebodynoupcoming | friendly | firm | final. Omitted = all four drafts.

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"}'

response

{
  "data": {
    "sequence": "Standard chase",
    "as_of": "2026-07-15",
    "days_overdue": 44,
    "drafts": [
      {
        "tone": "firm",
        "offset_days": 14,
        "send_on": "2026-06-15",
        "subject": "Second notice: invoice INV-1042 is 44 days overdue",
        "body": "Hi Acme Ltd,\n\nThis is a second reminder about invoice INV-1042 for $2,500.00, now 44 days past its Jun 1, 2026 due date.\n\nWe'd like to get this resolved this week. If there's a problem with the invoice or you need to discuss timing, reply to this email and we'll work it out.\n\nPay online: https://pay.example.com/inv-1042\n\nRegards,\nBeech Studio"
      }
    ],
    "note": "These are drafts. Nothing was sent: sending goes through POST /api/v1/invoices/{id}/remind (paid plans) or your own email tooling."
  },
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}
GET

/api/v1/statutes

No key needed

The 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
GET

/api/v1/statutes/{state}

No key needed

One 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.

ParamInRequiredDescription
statepathyesTwo-letter code or name slug.

request

curl https://www.duebay.com/api/v1/statutes/CA

response

{
  "data": {
    "generated_at": "2026-07-17T23:40:12.492Z",
    "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.",
    "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&sectionNum=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"
    }
  },
  "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."
}
GET

/api/v1/aging

Requires a key

The 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_..."

response

{
  "data": {
    "as_of": "2026-07-15",
    "total_outstanding_cents": 419000,
    "overdue_cents": 330000,
    "overdue_invoice_count": 2,
    "open_invoice_count": 3,
    "buckets": [
      {
        "key": "current",
        "label": "Current",
        "amount_cents": 89000,
        "invoice_count": 1
      },
      {
        "key": "d1_30",
        "label": "1-30 days",
        "amount_cents": 80000,
        "invoice_count": 1
      },
      {
        "key": "d31_60",
        "label": "31-60 days",
        "amount_cents": 250000,
        "invoice_count": 1
      },
      {
        "key": "d61_90",
        "label": "61-90 days",
        "amount_cents": 0,
        "invoice_count": 0
      },
      {
        "key": "d90_plus",
        "label": "91+ days",
        "amount_cents": 0,
        "invoice_count": 0
      }
    ],
    "largest_overdue": {
      "invoice_number": "INV-1042",
      "customer_name": "Acme Ltd",
      "amount_cents": 250000,
      "days_overdue": 44
    },
    "dso": {
      "days": 83.1,
      "period_days": 91,
      "formula": "DSO = (accounts receivable / credit sales in period) x days in period",
      "method": "Simple method over the trailing 91 days: receivables outstanding as of the report date, divided by the total value of invoices issued in the trailing 91 days (the closest available proxy for credit sales), times 91."
    }
  },
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}
GET

/api/v1/invoices

Requires a key

List the caller's invoices, newest first, with the customer, outstanding balance, days overdue and chasing state on each row.

ParamInRequiredDescription
statusquerynoopen | partial | paid | void | disputed.
overduequerynotrue = only invoices past due with a balance outstanding.
customer_idquerynoOnly one customer's invoices.
limitqueryno1 to 100. Defaults to 25.
offsetquerynoPagination offset. Defaults to 0.

request

curl "https://www.duebay.com/api/v1/invoices?overdue=true" \
  -H "Authorization: Bearer dc_live_..."

response

{
  "data": [
    {
      "id": "4f2ac9d1-3b7e-4a90-8e21-6c8f2b9a5d3e",
      "invoice_number": "INV-1042",
      "status": "open",
      "source": "api",
      "description": "Brand refresh, milestone 2",
      "currency": "usd",
      "amount_cents": 250000,
      "amount_paid_cents": 0,
      "outstanding_cents": 250000,
      "issue_date": "2026-05-02",
      "due_date": "2026-06-01",
      "days_overdue": 44,
      "payment_url": "https://pay.example.com/inv-1042",
      "late_fee_terms": {
        "type": "percent_monthly",
        "value": 1.5,
        "grace_days": 5
      },
      "chasing": {
        "reminders_sent": 2,
        "last_reminded_at": "2026-06-15T09:00:12Z",
        "next_step_index": 2,
        "next_action_at": "2026-07-01T00:00:00Z",
        "paused": false
      },
      "archived": false,
      "customer": {
        "id": "9c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
        "name": "Acme Ltd",
        "email": "[email protected]"
      },
      "created_at": "2026-05-02T14:03:21Z",
      "updated_at": "2026-06-15T09:00:12Z"
    }
  ],
  "total": 1,
  "limit": 25,
  "offset": 0,
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}
POST

/api/v1/invoices

Requires a keyIdempotency-Key

Create 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.

ParamInRequiredDescription
invoice_numberbodyyesUnique per account.
amount_centsbodyyesInteger cents. `amount` (dollars) is accepted instead.
issue_datebodyyesyyyy-mm-dd.
due_datebodyyesyyyy-mm-dd.
customerbodyyes{ name, email?, company?, state? }. Upserted by case-insensitive name. Or pass customer_id.
customer_idbodynoAn existing customer's id, instead of `customer`.
descriptionbodynoFree text.
currencybodynoISO code, defaults to usd.
payment_urlbodynoWhere the customer pays (http/https).
late_feebodyno{ type, value, grace_days } as agreed on the invoice.

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}}'

response

{
  "data": {
    "id": "4f2ac9d1-3b7e-4a90-8e21-6c8f2b9a5d3e",
    "invoice_number": "INV-1042",
    "status": "open",
    "source": "api",
    "description": "Brand refresh, milestone 2",
    "currency": "usd",
    "amount_cents": 250000,
    "amount_paid_cents": 0,
    "outstanding_cents": 250000,
    "issue_date": "2026-05-02",
    "due_date": "2026-06-01",
    "days_overdue": 44,
    "payment_url": "https://pay.example.com/inv-1042",
    "late_fee_terms": {
      "type": "percent_monthly",
      "value": 1.5,
      "grace_days": 5
    },
    "chasing": {
      "reminders_sent": 0,
      "last_reminded_at": null,
      "next_step_index": 0,
      "next_action_at": null,
      "paused": false
    },
    "archived": false,
    "customer": {
      "id": "9c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
      "name": "Acme Ltd",
      "email": "[email protected]"
    },
    "created_at": "2026-05-02T14:03:21Z",
    "updated_at": "2026-06-15T09:00:12Z"
  },
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}
POST

/api/v1/invoices/{id}/remind

Requires a paid planIdempotency-Key

Actually 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.

ParamInRequiredDescription
idpathyesThe invoice id.
stepbodyno0-based step to send. Omitted = the invoice's next scheduled step.
as_ofbodynoyyyy-mm-dd for days-overdue arithmetic. Defaults to today (UTC).

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 '{}'

response

{
  "data": {
    "invoice_id": "4f2ac9d1-3b7e-4a90-8e21-6c8f2b9a5d3e",
    "invoice_number": "INV-1042",
    "step_index": 2,
    "tone": "firm",
    "subject": "Second notice: invoice INV-1042 is 44 days overdue",
    "body": "Hi Acme Ltd,\n\nThis is a second reminder about invoice INV-1042 for $2,500.00, now 44 days past its Jun 1, 2026 due date.\n\nWe'd like to get this resolved this week. If there's a problem with the invoice or you need to discuss timing, reply to this email and we'll work it out.\n\nPay online: https://pay.example.com/inv-1042\n\nRegards,\nBeech Studio",
    "sent_to": "[email protected]",
    "provider_message_id": "tc_msg_8f4b2a91",
    "reminders_sent": 3,
    "next_step": {
      "step_index": 3,
      "date": "2026-07-01"
    }
  },
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}
GET

/api/v1/usage

Requires a key

The 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_..."

response

{
  "data": {
    "plan": "pro",
    "month_start": "2026-07-01T00:00:00.000Z",
    "billable_calls_this_month": 412,
    "included_calls_per_month": 2000,
    "overage_usd_per_call": 0.03,
    "rate_limit_per_minute": 60,
    "recent_requests": [
      {
        "endpoint": "/api/v1/aging",
        "method": "GET",
        "surface": "rest",
        "tool": null,
        "status": 200,
        "billable": true,
        "request_id": "req_1f2e3d4c5b6a79880911aabb",
        "duration_ms": 84,
        "created_at": "2026-07-15T08:12:44.310Z"
      }
    ]
  },
  "request_id": "req_1f2e3d4c5b6a79880911aabb"
}
GET

/api/v1/pricing

No key needed

Machine-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.

Developer overviewMCP server