API Reference

Authentication

The S-Chat API uses standard HTTP session auth (via Supabase) for frontend calls and API keys for backend integrations. You can view and manage your API keys in the Developer Settings of your dashboard.

For external scripts, authentication is performed via HTTP Bearer Auth. Provide your API key as the bearer token value.

Keep your keys safe

Your API keys carry many privileges. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.

Example Request
curl https://schat.webasthetic.in/api/billing/create-order \
  -H "Authorization: Bearer schat_live_aB1cD2eF3gH4"

Errors

S-Chat uses standard HTTP status codes. All error responses include a JSON body with an error field.

400Bad Request
401Unauthorized
403Forbidden
500Server Error
Error Response
{
  "error": "Invalid creator ID"
}
POST/api/razorpay/create-order

Create Order

Initializes a new Razorpay order for a donation. Called before launching the Razorpay checkout modal.

Body Parameters

amountinteger

The amount to charge in INR rupees (not paise — the backend converts internally).

creatorIdstringrequired

The Supabase UUID of the creator receiving the donation.

Request
curl -X POST https://schat.webasthetic.in/api/razorpay/create-order \
  -H "Content-Type: application/json" \
  -d '{"amount": 500, "creatorId": "uuid-here"}'
Response
{
  "orderId": "order_P1XvB..."
}
POST/api/tts

Generate TTS

Converts a donation message into speech via the configured TTS provider cascade (Google Cloud → Azure → Kokoro → Edge).

Body Parameters

textstringrequired

The text to synthesize.

providerstring

Optional override for TTS provider (auto | google | azure | kokoro | edge).

Request
curl -X POST https://schat.webasthetic.in/api/tts \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello stream!"}'
Response
{
  "audioContent": "UklGRigAAABXQVZFZ...",
  "provider": "azure"
}
POST/api/moderation/validate-message

Validate Message

Runs a message through the creator's configured strictness policy and custom banned words list via Groq LLM.

Body Parameters

creatorIdstringrequired

The creator whose policy should be used.

messagestringrequired

The text to analyze.

Response
{
  "decision": "deny",
  "userMessage": "Message blocked by automod."
}
POST/api/razorpay/webhook

Razorpay Webhook

The main endpoint that ingests real-time events from Razorpay. This is how S-Chat verifies payment before emitting the WebSocket trigger to OBS.

This endpoint is strictly for Razorpay server-to-server calls. It requires the x-razorpay-signature header.

  • Supported Event: payment.captured
  • Side Effects: Inserts a donations record, updates stream_goals progress, broadcasts WebSocket message to overlay.
Expected Razorpay Payload
{
  "event": "payment.captured",
  "payload": {
    "payment": {
      "entity": {
        "id": "pay_H...",
        "amount": 50000,
        "notes": {
          "creator_id": "uuid"
        }
      }
    }
  }
}
API Reference — Schat Overlay & Webhook Endpoints | Schat