Skip to content
On this page

API Documentation

Samidha Reviews v2 — REST API reference.

Authentication

All /v2/* and /account/* endpoints require an API key passed in the X-API-Key header. Keys have the prefix riq_live_ followed by 32 hex characters.

X-API-Key: riq_live_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4

Getting your API key

Sign in via Supabase Auth (Google or email). On first login, call POST /auth/provision with your Supabase JWT to provision an org and receive your key. The key is shown exactly once — save it immediately.

curl -X POST https://api.samidhareviews.xyz/auth/provision \
  -H "Authorization: Bearer <supabase-jwt>"

# Response (key shown once — copy it now):
# { "api_key": "riq_live_...", "org_id": "...", "key_prefix": "riq_live_a1b2" }

Endpoints

API endpoints
Method Path Auth Description
POST /demo/extract None Keyless demo (rate-limited)
POST /v2/extract API key Single review extraction
POST /v2/extract/batch API key Batch reviews (fire-and-forget)
POST /v2/ingest/csv API key CSV bulk upload
GET /v2/ingest/{job_id} API key Ingest job status
GET /v2/ingest/{job_id}/result API key Download results (JSON or CSV)
GET /v2/reviews API key List stored extractions
GET /v2/insights API key Aggregated insights
POST /auth/provision Supabase JWT First-login org + key setup
GET /account Supabase JWT Key prefix + usage
POST /account/regenerate-key Supabase JWT Revoke + reissue key

Extraction response fields

All fields except product and extraction_meta may be null when the information is absent or uninferable from the source review.

Extraction response fields
Field Type Description
product string Product or service name extracted from review. Defaults to "unknown product".
stars int | null Explicit numeric star rating (1–5) stated by the reviewer. Null if not stated.
stars_inferred int | null Star rating inferred from sentiment and language when not explicit.
pros string[] List of positive aspects mentioned in the review.
cons string[] List of negative aspects or complaints.
buy_again bool | null Whether the reviewer indicates intent or willingness to repurchase.
sentiment enum | null Overall sentiment: positive | negative | neutral | mixed.
urgency enum Urgency level for customer-care triage: low | medium | high. Defaults to low.
topics string[] Product attribute topics discussed (e.g. "battery", "sound quality").
competitor_mentions string[] Competitor brands or products mentioned by name.
feature_requests string[] Explicit feature requests or improvement suggestions from the reviewer.
language string Detected language code: en, hi, or hi-en. A heuristic label, not an accuracy-scored field — read it together with code_mixed and language_signal_strength.
code_mixed bool | null true if the text contains Romanized-Hindi vocabulary (any marker from the language detector's lexicons) or Devanagari mixed with Latin letters. Recall-oriented and uncalibrated: it can be true for English text that uses a collision phrase such as "value for money". Always true when language is hi-en. Additive; null where not computed.
language_signal_strength "none" | "weak" | "moderate" | "strong" | null Ordinal strength of the detector's Hindi-marker evidence: strong = Devanagari or two or more strong markers; moderate = one strong marker or three or more weak ones; weak = one or two weak markers (near the hi-en decision boundary); none = no marker found. A documented heuristic, not a probability, not calibrated against labelled data. none means absence of evidence, not proof the text is English.
review_length_chars int | null Character count of the original (pre-sanitization) review text.
confidence float | null LLM self-reported confidence score (0.0–1.0). May be null if model does not report it.
extraction_meta object | null Provenance metadata: model, prompt_version, schema_version, extracted_at, latency_ms, input_hash.

Example response

{
  "product": "BoAt Bassheads",
  "stars": null,
  "stars_inferred": 3,
  "pros": ["sound quality"],
  "cons": ["battery life", "overpriced for 2000 rupees"],
  "buy_again": false,
  "sentiment": "mixed",
  "urgency": "low",
  "topics": ["battery", "sound quality", "price"],
  "competitor_mentions": [],
  "feature_requests": [],
  "language": "hi-en",
  "review_length_chars": 104,
  "confidence": 0.91,
  "extraction_meta": {
    "model": "openai/gpt-oss-120b",
    "prompt_version": "v2.3",
    "schema_version": "1.0.0",
    "extracted_at": "2025-01-15T10:23:45.123456",
    "latency_ms": 842,
    "input_hash": "sha256:a1b2c3..."
  }
}

CSV Upload

Use POST /v2/ingest/csv to upload a CSV file for bulk asynchronous extraction. Results are stored per-org and downloadable via GET /v2/ingest/{job_id}/result.

Column requirements

  • Must include a text column named one of: review_text, review, comment, or text
  • Optional: product column for product tagging
  • All other columns are passed through as-is

Limits

  • Maximum rows: 500
  • Maximum file size: 5 MB
  • Content-Type: multipart/form-data
  • Encoding: UTF-8

Example CSV

review_text,product,date
"Great earphones, sound is excellent","BoAt Bassheads","2024-01-15"
"Battery dies too fast for the price","BoAt Bassheads","2024-01-16"

Upload request + response

# Upload
curl -X POST https://api.samidhareviews.xyz/v2/ingest/csv \
  -H "X-API-Key: riq_live_your_key" \
  -F "file=@reviews.csv"

# Response — poll job_id for status
{"job_id": "b3f1a2d4-...", "total": 2, "status": "pending"}

# Poll status
curl https://api.samidhareviews.xyz/v2/ingest/b3f1a2d4-.../  \
  -H "X-API-Key: riq_live_your_key"

# Download results when status == "done"
curl https://api.samidhareviews.xyz/v2/ingest/b3f1a2d4-.../result \
  -H "X-API-Key: riq_live_your_key"

Rate Limits & Quotas

Rate limits and quotas
Tier / Endpoint Limit Notes
Free tier (all extractions) 100 / month 429 returned when quota exceeded
Demo endpoint (/demo/extract) 5 req / min per IP No API key required; no results stored
All other endpoints 30 req / min (default) App-wide slowapi limit; configurable per deployment

When a rate limit is exceeded, the API returns HTTP 429 Too Many Requests with a Retry-After header indicating seconds until the window resets.

Language Support

Language is auto-detected from the review text — no parameter needed. The detected code is returned in the language field of the response, together with code_mixed and language_signal_strength. The label is a heuristic: on a corpus of real reviews its agreement with the corpus label is low, and that label is itself noisy, so treat language as a hint, not a scored accuracy claim (see the README's held-out section for the measured agreement, its confidence interval and the label's inter-rater alpha).

Re-measured against the models actually deployed: The headline accuracy figure was measured under the models production actually runs today (openai/gpt-oss-20b / openai/gpt-oss-120b) after Groq deprecated the previous models on 2026-08-16 — see the headline accuracy for its confidence interval, sample size, gate status and known calibration differences vs. the previous models.

Supported languages
Code Language Script
en English Latin
hi-en Hinglish Roman-script code-mix