API Reference
Complete endpoint reference for the Billing Service. All endpoints require JWT authentication. The service runs on port 8087.
Usage Metering
| Method | Path | Description |
|---|---|---|
POST | /api/v1/billing/tenants/:tenantId/usage | Record usage event |
POST | /api/v1/billing/tenants/:tenantId/usage/batch | Record batch usage events |
GET | /api/v1/billing/tenants/:tenantId/usage/summary | Get usage summary |
Billing Calculations
| Method | Path | Description |
|---|---|---|
GET | /api/v1/billing/tenants/:tenantId/billing/preview | Preview current period billing |
GET | /api/v1/billing/tenants/:tenantId/billing/estimate | Get monthly cost estimate |
Invoices
| Method | Path | Description |
|---|---|---|
POST | /api/v1/billing/tenants/:tenantId/invoices | Generate invoice |
GET | /api/v1/billing/tenants/:tenantId/invoices | List tenant invoices |
GET | /api/v1/billing/invoices/:invoiceId | Get invoice |
POST | /api/v1/billing/invoices/:invoiceId/finalize | Finalize invoice |
GET | /api/v1/billing/invoices/:invoiceId/pdf | Download invoice PDF |
POST | /api/v1/billing/invoices/:invoiceId/void | Void invoice |
Subscriptions
| Method | Path | Description |
|---|---|---|
GET | /api/v1/billing/tenants/:tenantId/subscription | Get active subscription |
GET | /api/v1/billing/tenants/:tenantId/subscriptions | List all subscriptions |
POST | /api/v1/billing/tenants/:tenantId/subscriptions | Create subscription |
POST | /api/v1/billing/subscriptions/:subscriptionId/change-plan | Change plan |
POST | /api/v1/billing/subscriptions/:subscriptionId/cancel | Cancel subscription |
POST | /api/v1/billing/subscriptions/:subscriptionId/reactivate | Reactivate |
POST | /api/v1/billing/subscriptions/:subscriptionId/pause | Pause subscription |
POST | /api/v1/billing/subscriptions/:subscriptionId/resume | Resume subscription |
POST | /api/v1/billing/subscriptions/:subscriptionId/discount | Apply discount |
POST | /api/v1/billing/subscriptions/:subscriptionId/credits | Add credits |
Plans
| Method | Path | Description |
|---|---|---|
GET | /api/v1/billing/plans | List available plans |
GET | /api/v1/billing/plans/:planId | Get plan details |
Stripe Integration
| Method | Path | Description |
|---|---|---|
POST | /api/v1/billing/stripe/checkout | Create checkout session |
POST | /api/v1/billing/stripe/portal | Create customer portal session |
POST | /api/v1/billing/invoices/:invoiceId/payment-intent | Create payment intent |
POST | /api/v1/billing/stripe/webhook | Handle Stripe webhook |
Cost Centers
| Method | Path | Description |
|---|---|---|
POST | /api/v1/billing/cost-centers | Create cost center |
GET | /api/v1/billing/cost-centers/tenants/:tenantId | List cost centers |
GET | /api/v1/billing/cost-centers/:costCenterId | Get cost center |
PUT | /api/v1/billing/cost-centers/:costCenterId | Update cost center |
DELETE | /api/v1/billing/cost-centers/:costCenterId | Delete cost center |
Quotas
| Method | Path | Description |
|---|---|---|
POST | /api/v1/billing/quotas | Create quota |
GET | /api/v1/billing/quotas/tenants/:tenantId | List tenant quotas |
GET | /api/v1/billing/quotas/tenants/:tenantId/check | Check quota utilization |
PUT | /api/v1/billing/quotas/:quotaId | Update quota |
DELETE | /api/v1/billing/quotas/:quotaId | Delete quota |
Coupons
| Method | Path | Description |
|---|---|---|
POST | /api/v1/billing/coupons | Create coupon |
GET | /api/v1/billing/coupons | List coupons |
GET | /api/v1/billing/coupons/:couponId | Get coupon |
POST | /api/v1/billing/coupons/:couponId/deactivate | Deactivate coupon |
POST | /api/v1/billing/coupons/validate | Validate coupon |
POST | /api/v1/billing/coupons/redeem | Redeem coupon |
Real-Time Cost
| Method | Path | Description |
|---|---|---|
GET | /api/v1/billing/realtime-cost/tenants/:tenantId/current | Current costs |
GET | /api/v1/billing/realtime-cost/tenants/:tenantId/by-resource | Cost by resource |
GET | /api/v1/billing/realtime-cost/tenants/:tenantId/timeline | Cost timeline |
POST | /api/v1/billing/realtime-cost/tenants/:tenantId/alerts | Configure alert |
GET | /api/v1/billing/realtime-cost/tenants/:tenantId/alerts | List alerts |
POST | /api/v1/billing/realtime-cost/alerts/:alertId/dismiss | Dismiss alert |