REST v1 Specification

Revora API Reference

Reference for Revora's REST edge endpoints. All requests require your Revora publishable key transmitted in the x-revora-public-key header.

POST/api/v1/sessions

Initialize Cancellation Session

Authenticates the public integration key, verifies the subscriber subscription against Stripe, enforces the merchant's monthly session quota, and initializes a cancellation session in revora_sessions.

Headers

HeaderRequiredDescription
x-revora-public-keyRequiredYour Revora publishable key (pk_live_... or pk_test_...)
Content-TypeRequiredapplication/json

Request Example

curl
curl -X POST "https://revorahq.vercel.app/api/v1/sessions" \
  -H "x-revora-public-key: pk_live_revora_..." \
  -H "Content-Type: application/json" \
  -d '{ "customer": { "id": "cus_Nx8294hjk2", "subscriptionId": "sub_1M982jkl1", "planId": "price_1948293", "planName": "Pro Monthly", "planValue": 4900, "currency": "usd", "billingInterval": "month" }}'

Response Payload

HTTP 200 OK
response.json
{
  "sessionToken": "d04a8069634e5a9c8b7f1e2d3c4b5a6f7e8d9c0b1a2f3e4d5c6b7a8f9e0d1c2b",
  "widgetConfig": {
    "productName": "Acme SaaS",
    "planTier": "pro",
    "customCss": null,
    "retentionFlows": {
      "too_expensive": {
        "type": "discount",
        "percent": 25,
        "duration_months": 3
      },
      "not_using": {
        "type": "pause",
        "duration_months": 2
      }
    },
    "reasons": [
      {
        "id": "too_expensive",
        "label": "Too expensive"
      },
      {
        "id": "not_using",
        "label": "Not using enough"
      },
      {
        "id": "missing_feature",
        "label": "Missing features / Technical issue"
      },
      {
        "id": "switching",
        "label": "Switching to another product"
      },
      {
        "id": "other",
        "label": "Other"
      }
    ],
    "theme": {
      "colors": {
        "porcelain": "#F8FAFC",
        "midnight": "#0F172A",
        "riverTeal": "#0F8F83"
      }
    }
  }
}