How to add metered features to a plan
Add usage-based features with quota and reset interval.
Metered features drive usage tracking and entitlement limits.
1) Create a metered feature
curl -sS -X POST "$PORTCALL_API_BASE/v1/features" \
-H "x-api-key: $PORTCALL_API_KEY" \
-H "content-type: application/json" \
-d '{"feature_id":"credits","is_metered":true}'2) Attach with quota and interval
curl -sS -X POST "$PORTCALL_API_BASE/v1/plan-features" \
-H "x-api-key: $PORTCALL_API_KEY" \
-H "content-type: application/json" \
-d '{"plan_id":"plan_x","feature_id":"credits","quota":1000,"interval":"month"}'3) Runtime behavior
- Entitlement starts at
usage = 0. enabledis derived fromusage < quota(or always true whenquota = -1).- Usage is increased through
POST /v1/meter-events.