Billing API
Sync metered usage to your billing provider and preview billing data.
Sync usage to billing provider
POST/v1/billing/sync
Triggers a usage sync to the configured billing provider (Stripe or webhook). Syncs current period usage for all meters for the specified customer.
| Field | Type | Required | Description |
|---|---|---|---|
customer_external_id | string | Yes | The external ID of the customer to sync |
bash
curl -X POST https://api.meterd.io/v1/billing/sync \
-H "Authorization: Bearer mtd_adm_..." \
-H "Content-Type: application/json" \
-d '{
"customer_external_id": "cust_123"
}'Preview billing
GET/v1/billing/preview?customer=...
Preview billing data without syncing to the provider. Returns usage summaries per meter for the current billing period.
| Parameter | Type | Required | Description |
|---|---|---|---|
customer | string | Yes | Customer external ID |
Example
bash
curl "https://api.meterd.io/v1/billing/preview?customer=cust_123" \
-H "Authorization: Bearer mtd_adm_..."Response
json
[
{
"meter_slug": "api-requests",
"meter_id": "01JBX...",
"usage": 15230.0,
"unit_price": 0.001,
"amount": 15.23
}
]Configuration
Configure your billing provider in Settings → Billing Integration. See the Billing Integration guide for details.