App öffnen
Moonborn — API · admin

Drain unreported usage_events to Stripe billing meter (admin/cron entrypoint)

Pulls oldest N pending usage_events (stripe_reported_at IS NULL), ships each to stripe.billing.meterEvents.create with idempotent identifier=usage_events.id. Marks reported on 2xx. Per-row failures logged + left pending for next tick. Idempotent — invoke repeatedly until response.fetched=0.

POST/v1/admin/billing/flush-usagescope · Bearer (API key or session JWT)

Responses

200Flush cycle completed
403Forbidden — platform admin only
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
503Stripe usage meter entry point not wired (env missing)
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring

Examples

cURL
curl -X POST https://api.moonborn.co/v1/admin/billing/flush-usage \
  -H "Authorization: Bearer $MOONBORN_API_KEY"
TypeScript
import Moonborn from '@moonborn/sdk';

const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });

const result = await client.admin.adminFlushUsageToStripe();
Python
import os
from moonborn import Moonborn

client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])

result = client.admin.admin_flush_usage_to_stripe()