Check what a customer can do
Ask "can this customer export right now" and get yes or no, what is left of the Limit, when it resets, and which Offer lifts it.
Entitlement.check answers before your code or agent acts, and changes nothing. Checking access explains the checks that run without it.
Needs Lock a feature to a plan
What you get
- 1yes or no for the action, right nowEntitlement
- 1units left in the current period, and when it resetsLimit
- 1plan that lifts the cap, when an upgrade would helpOffer
Your agent does
You, to your agent
Can Riverside Property export right now?
How many exports does this customer have left today?
Check this customer’s plan before the call.
# Entitlement.check
curl -X POST https: //api.sb/ leaseline.app/ entitlements/ check \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"customer": "customer_riverside", "verb": "Collection.export"}'
import { $ } from 'startup-builder'
await $.Entitlement.check({ customer: 'customer_riverside', verb: 'Collection.export' })
npx startup-builder do Entitlement.check --json '{"customer": "customer_riverside", "verb": "Collection.export"}'
{
"name": "do",
"arguments": {
"code": "return await $.Entitlement.check({ customer: 'customer_riverside', verb: 'Collection.export' })"
}
}
Change it
- Show the reset time next to the export button.
- Warn me when a customer hits the cap three days running.
Under the hood
- Systems
- Billing
- Nouns
- Entitlement, Limit, Offer, Customer
- Events
Entitlement.checked