Authentication
Every v1 endpoint requires the signed-in user's Supabase access token. Send it as Authorization: Bearer TOKEN. Never use or expose the Supabase service-role key.
const { data } = await supabase.auth.getSession();
const token = data.session?.access_token;
fetch("https://prophrase.in/api/v1/rephrase", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID()
},
body: JSON.stringify({ text: "send update today", tone: "Professional" })
});Access tokens expire. Use the Supabase client's session refresh support. API requests consume the authenticated user's credits and follow their plan permissions.
/api/v1/rephraseRephrase a message
Correct spelling and grammar, then rewrite the message using the selected communication style while preserving meaning and protected facts.
textstring · required3–5,000 characters.
toneenum · requiredProfessional, Polite, Shorter, Short & Crisp, Human, Email, Slack, Teams, Jira Comment, WhatsApp, Client-safe, Manager-friendly, or Firmer.
instructionstringOptional custom instruction, 3–240 characters.
threadIduuidContinue an existing ProPhrase conversation. Omit it to create a new thread.
Example request
curl https://prophrase.in/api/v1/rephrase \
-H "Authorization: Bearer $PROPHRASE_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: rewrite-2026-001" \
-d '{
"text": "send me update today",
"tone": "Professional"
}'Successful response
{
"requestId": "uuid",
"result": "Please send me the update today.",
"warnings": [],
"promptVersion": "prophrase-prompt-v2.1",
"repaired": false,
"threadId": "uuid",
"usage": { "rewriteRemaining": 24 },
"credits": { "charged": 1, "remaining": 299 }
}/api/v1/outcome-assistantPrepare an outcome-focused message
Returns Safe, Balanced, and Firm alternatives with reader interpretation, risks, protected-detail verification, and commitment warnings.
originalTextstring · required3–5,000 characters.
recipientenum · requiredmanager, senior_leader, client, customer, colleague, direct_report, recruiter, vendor, friend, family, or other.
intentenum · requiredrequest, follow_up, approval, status_update, escalation, disagreement, rejection, boundary, payment_request, apology, clarification, negotiation, extension_request, feedback, criticism_response, or other.
customRecipientstringRequired when recipient is other.
customIntentstringRequired when intent is other.
relationshipLevelenumnew, formal, regular, comfortable, or difficult.
urgencyenumnone, today, few_days, urgent, or critical.
desiredResponsestringThe response or action you want from the recipient.
channelenumwhatsapp, email, slack_teams, sms, linkedin, or other. Defaults to email.
lockedFactsstring[]Up to 30 values that must remain exact.
languageModeenumstandard or indian_workplace.
Example request
curl https://prophrase.in/api/v1/outcome-assistant \
-H "Authorization: Bearer $PROPHRASE_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: outcome-2026-001" \
-d '{
"originalText": "I need two more days to finish this safely.",
"recipient": "manager",
"intent": "extension_request",
"relationshipLevel": "regular",
"urgency": "today",
"desiredResponse": "Approve the extension",
"channel": "email",
"lockedFacts": ["two more days"],
"languageMode": "standard"
}'Successful response
{
"requestId": "uuid",
"understoodIntent": "Request two additional days.",
"variants": [
{ "id": "safe", "message": "...", "risks": [], "factVerification": [] },
{ "id": "balanced", "message": "...", "risks": [], "factVerification": [] },
{ "id": "firm", "message": "...", "risks": [], "factVerification": [] }
],
"globalWarnings": [],
"missingInformation": [],
"credits": { "charged": 1, "remaining": 298 },
"metadata": { "repaired": false, "fallback": false }
}/api/v1/creditsCredit balance
Returns whether credit billing is enabled and the authenticated user's allowance, available balance, reservations, billing period, and next refresh time.
curl https://prophrase.in/api/v1/credits \
-H "Authorization: Bearer $PROPHRASE_TOKEN"Rephrase and Outcome Assistant cost 1 credit up to 500 characters, 2 up to 1,200, 4 up to 2,500, and 8 up to 5,000. Failed generation is not charged.
Errors and limits
Errors use a consistent JSON body: { "code": "ERROR_CODE", "message": "Human-readable message" }.
400Invalid request body
401Missing, expired, or invalid token
402Insufficient credits or plan limit
403Feature or input unavailable on the plan
409Duplicate request still processing
422AI output could not be safely validated
429Rate or fair-use limit reached
502AI provider unavailable
Rate limits: 20 rephrase requests per minute and 12 Outcome Assistant requests per minute per user. Send a unique Idempotency-Key for safe retries. Maximum input length is 5,000 characters.