Skip to main content

Billing API

Manage plans, subscriptions, and checkout. Session authentication is required for billing endpoints.

Base URL: https://app.kamustatus.com/api

List Plans

Returns all available plans. This endpoint is public.

curl https://app.kamustatus.com/api/billing/plans

Response:

[
{
"id": "plan_free",
"name": "Free",
"monitors": 5,
"checkInterval": 300,
"regions": 1,
"price": 0
},
{
"id": "plan_pro",
"name": "Pro",
"monitors": 50,
"checkInterval": 30,
"regions": 5,
"price": 19
},
{
"id": "plan_business",
"name": "Business",
"monitors": 200,
"checkInterval": 10,
"regions": 10,
"price": 49
}
]

Get Current Subscription

curl https://app.kamustatus.com/api/billing/subscription \
-b cookies.txt

Response:

{
"planId": "plan_pro",
"status": "active",
"currentPeriodStart": "2025-05-01T00:00:00Z",
"currentPeriodEnd": "2025-06-01T00:00:00Z"
}

Create Checkout Session

Initiates a checkout flow for upgrading or subscribing to a plan.

curl -X POST https://app.kamustatus.com/api/billing/checkout \
-b cookies.txt \
-H "Content-Type: application/json" \
-d '{
"planId": "plan_pro"
}'

Response:

{
"checkoutUrl": "https://checkout.stripe.com/pay/cs_..."
}

Redirect the user to the checkoutUrl to complete payment.

Webhook

Kamustatus receives payment events via a webhook endpoint. This is used internally to process subscription changes and is not intended for external use.

POST https://app.kamustatus.com/api/billing/webhook

Admin Plan Management

Admin users can manage plans via the API. Requires admin session authentication.

Create Plan

curl -X POST https://app.kamustatus.com/api/billing/plans \
-b cookies.txt \
-H "Content-Type: application/json" \
-d '{
"name": "Enterprise",
"monitors": 1000,
"checkInterval": 10,
"regions": 20,
"price": 199
}'

Update Plan

curl -X PATCH https://app.kamustatus.com/api/billing/plans/:planId \
-b cookies.txt \
-H "Content-Type: application/json" \
-d '{
"price": 249
}'

Delete Plan

curl -X DELETE https://app.kamustatus.com/api/billing/plans/:planId \
-b cookies.txt