Billing
Close expired billing periods
Admin-only endpoint that scans expired user billing states, writes closed period ledgers, freezes revision 1 snapshots when missing, and then rolls each matched state into a new monthly period. The operation is idempotent across repeated runs because state rolling uses the previous user_id, period_key, and period_end as the update condition.
post/admin/billing/periods/close-expired
Request
- Base URL: https://api.crawlora.net/api/v1
- URL: https://api.crawlora.net/api/v1/admin/billing/periods/close-expired
- Auth: API key in header x-api-key
Query parameters
limitinteger
Maximum expired states to scan. Defaults to 500 and clamps to 5000.
Headers
x-api-keystring required
Admin API key required unless an Admin JWT is already present
Response
Close expired periods summary
Example response
{
"code": 200,
"data": {
"closed": 498,
"errors": [
{
"error": "upsert billing period ledger: connection reset",
"period_key": "2026-04",
"user_id": "user-1"
}
],
"failed": 1,
"scanned": 500,
"skipped": 1,
"snapshot_skipped": 1,
"snapshots_created": 498
},
"msg": "OK"
}Changes
No recorded changes to this operation across all 4 revisions of this API.