RevKeen Docs
Api reference

Generate billing schedule preview

Generate a preview of upcoming billing dates and amounts based on the provided schedule configuration.

This endpoint uses the same billing calculation logic as the actual scheduler, ensuring that the preview matches what will actually be billed (Key Invariant #4: Preview === Scheduler).

Use this to show customers their expected billing schedule before they subscribe, or to preview changes to an existing subscription's billing configuration.


Related endpoints

  • GET /billing/intervals — Get billing intervals
  • GET /billing/anchor-rules — Get billing anchor rules

Common errors

  • 400 invalid_request — malformed payload or failed validation.

Idempotency

Pass an Idempotency-Key header (UUID v4 recommended) to make retries safe. Keys are valid for 24 hours; see the idempotency guide.

POST
/billing/preview
x-api-key<token>

Your RevKeen API key (powered by Unkey). Get it from Dashboard > Settings > API Keys. Use rk_sandbox_* for test mode and rk_live_* for production.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://api.revkeen.com/v2/billing/preview" \  -H "x-api-key: $REVKEEN_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "interval": "day"  }'
{
  "data": {
    "items": [
      {
        "sequence": 1,
        "date": "2019-08-24T14:15:22Z",
        "formattedDate": "string",
        "dayName": "string",
        "amountMinor": 0,
        "formattedAmount": "string",
        "isTrialEnd": true,
        "isFirstCharge": true,
        "isFinalPayment": true
      }
    ],
    "summary": "string",
    "totalAmountMinor": 0,
    "firstChargeDate": "2019-08-24T14:15:22Z",
    "trialEndDate": "2019-08-24T14:15:22Z",
    "scheduleEndDate": "2019-08-24T14:15:22Z",
    "timezone": "string"
  }
}
{
  "error": "string",
  "field": "string"
}