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.
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.
{
"error": "Invalid creator ID"
}/api/razorpay/create-orderCreate Order
Initializes a new Razorpay order for a donation. Called before launching the Razorpay checkout modal.
Body Parameters
amountintegerThe amount to charge in INR rupees (not paise — the backend converts internally).
creatorIdstringrequiredThe Supabase UUID of the creator receiving the donation.
curl -X POST https://schat.webasthetic.in/api/razorpay/create-order \ -H "Content-Type: application/json" \ -d '{"amount": 500, "creatorId": "uuid-here"}'
{
"orderId": "order_P1XvB..."
}/api/ttsGenerate TTS
Converts a donation message into speech via the configured TTS provider cascade (Google Cloud → Azure → Kokoro → Edge).
Body Parameters
textstringrequiredThe text to synthesize.
providerstringOptional override for TTS provider (auto | google | azure | kokoro | edge).
curl -X POST https://schat.webasthetic.in/api/tts \ -H "Content-Type: application/json" \ -d '{"text": "Hello stream!"}'
{
"audioContent": "UklGRigAAABXQVZFZ...",
"provider": "azure"
}/api/moderation/validate-messageValidate Message
Runs a message through the creator's configured strictness policy and custom banned words list via Groq LLM.
Body Parameters
creatorIdstringrequiredThe creator whose policy should be used.
messagestringrequiredThe text to analyze.
{
"decision": "deny",
"userMessage": "Message blocked by automod."
}/api/razorpay/webhookRazorpay 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.
{
"event": "payment.captured",
"payload": {
"payment": {
"entity": {
"id": "pay_H...",
"amount": 50000,
"notes": {
"creator_id": "uuid"
}
}
}
}
}