MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
API Reference

API Reference

Complete endpoint reference for the Billing Service. All endpoints require JWT authentication. The service runs on port 8087.


Usage Metering

MethodPathDescription
POST/api/v1/billing/tenants/:tenantId/usageRecord usage event
POST/api/v1/billing/tenants/:tenantId/usage/batchRecord batch usage events
GET/api/v1/billing/tenants/:tenantId/usage/summaryGet usage summary

Billing Calculations

MethodPathDescription
GET/api/v1/billing/tenants/:tenantId/billing/previewPreview current period billing
GET/api/v1/billing/tenants/:tenantId/billing/estimateGet monthly cost estimate

Invoices

MethodPathDescription
POST/api/v1/billing/tenants/:tenantId/invoicesGenerate invoice
GET/api/v1/billing/tenants/:tenantId/invoicesList tenant invoices
GET/api/v1/billing/invoices/:invoiceIdGet invoice
POST/api/v1/billing/invoices/:invoiceId/finalizeFinalize invoice
GET/api/v1/billing/invoices/:invoiceId/pdfDownload invoice PDF
POST/api/v1/billing/invoices/:invoiceId/voidVoid invoice

Subscriptions

MethodPathDescription
GET/api/v1/billing/tenants/:tenantId/subscriptionGet active subscription
GET/api/v1/billing/tenants/:tenantId/subscriptionsList all subscriptions
POST/api/v1/billing/tenants/:tenantId/subscriptionsCreate subscription
POST/api/v1/billing/subscriptions/:subscriptionId/change-planChange plan
POST/api/v1/billing/subscriptions/:subscriptionId/cancelCancel subscription
POST/api/v1/billing/subscriptions/:subscriptionId/reactivateReactivate
POST/api/v1/billing/subscriptions/:subscriptionId/pausePause subscription
POST/api/v1/billing/subscriptions/:subscriptionId/resumeResume subscription
POST/api/v1/billing/subscriptions/:subscriptionId/discountApply discount
POST/api/v1/billing/subscriptions/:subscriptionId/creditsAdd credits

Plans

MethodPathDescription
GET/api/v1/billing/plansList available plans
GET/api/v1/billing/plans/:planIdGet plan details

Stripe Integration

MethodPathDescription
POST/api/v1/billing/stripe/checkoutCreate checkout session
POST/api/v1/billing/stripe/portalCreate customer portal session
POST/api/v1/billing/invoices/:invoiceId/payment-intentCreate payment intent
POST/api/v1/billing/stripe/webhookHandle Stripe webhook

Cost Centers

MethodPathDescription
POST/api/v1/billing/cost-centersCreate cost center
GET/api/v1/billing/cost-centers/tenants/:tenantIdList cost centers
GET/api/v1/billing/cost-centers/:costCenterIdGet cost center
PUT/api/v1/billing/cost-centers/:costCenterIdUpdate cost center
DELETE/api/v1/billing/cost-centers/:costCenterIdDelete cost center

Quotas

MethodPathDescription
POST/api/v1/billing/quotasCreate quota
GET/api/v1/billing/quotas/tenants/:tenantIdList tenant quotas
GET/api/v1/billing/quotas/tenants/:tenantId/checkCheck quota utilization
PUT/api/v1/billing/quotas/:quotaIdUpdate quota
DELETE/api/v1/billing/quotas/:quotaIdDelete quota

Coupons

MethodPathDescription
POST/api/v1/billing/couponsCreate coupon
GET/api/v1/billing/couponsList coupons
GET/api/v1/billing/coupons/:couponIdGet coupon
POST/api/v1/billing/coupons/:couponId/deactivateDeactivate coupon
POST/api/v1/billing/coupons/validateValidate coupon
POST/api/v1/billing/coupons/redeemRedeem coupon

Real-Time Cost

MethodPathDescription
GET/api/v1/billing/realtime-cost/tenants/:tenantId/currentCurrent costs
GET/api/v1/billing/realtime-cost/tenants/:tenantId/by-resourceCost by resource
GET/api/v1/billing/realtime-cost/tenants/:tenantId/timelineCost timeline
POST/api/v1/billing/realtime-cost/tenants/:tenantId/alertsConfigure alert
GET/api/v1/billing/realtime-cost/tenants/:tenantId/alertsList alerts
POST/api/v1/billing/realtime-cost/alerts/:alertId/dismissDismiss alert