Skip to content

Sell an API

How an API earns, from the Offer that grants its Verbs to the Meter, the prepaid balance and the 402 that tells any caller what to buy.

An Offer sells an API: its Entitlements grant the Verbs, its Limits count them, and its atBound says what happens past the count. A caller outside its Offer is told exactly what to buy.

What the Offer grants

Leaseline sells its API inside its App plans. The portfolio Offer grants unlimited units and API access, and Harbor Residential has held it since month 3.

OfferPriceAPI accessPast a Limit
free$0 a monthNoneupgrade
pro$29 a monthNoneupgrade
portfolio$99 a monthEvery Verb in the Product fileoverage

Offer.grant adds one Entitlement at a time. API plans, limits and uptime covers quotas and rate limits.

Metering

A Meter counts each metered call once, as an Entry. Usage is reported to Stripe each hour and billed on the period's Invoice.

Paying ahead

A Customer can pay ahead. An Offer that sets credit issues a Credit Grant with each purchase, and every metered call draws it down. Before each call the balance is checked as a Limit; at zero, the Offer's atBound applies.

Customer.creditRecharge buys another pack when the balance falls below its floor. Credits has the order of use, expiry and settlement.

The 402

A call outside the caller's Entitlements gets 402 payment-required. The reply is a problem document on the Startup's own error namespace, and its next link accepts the Offer that covers the call.

JSON
{
  "type": "https://leaseline.app/errors/payment-required",
  "title": "Payment required",
  "status": 402,
  "detail": "renew is part of offer portfolio at $99 a month.",
  "fix": "Accept the Offer named in next, then retry the call.",
  "next": "https://api.leaseline.app/offers/portfolio/accept"
}

An Agent reads the reply, accepts the Offer, pays under its own Mandate, and retries with the same idempotency key. Selling to agents covers unknown Agents and their first Limits.