API referenceIndoPGx v1.1

IndoPGx API

Two endpoints, one envelope. /pgx/check for single-prescription safety (sub-200ms target)./pgx/batch_csv for diagnostic-lab batch interpretation. Every response carries the hardened envelope: api_version, request_id, audit_log_id,confidence, data_completeness, source_citations.

BASE URL
bioreason-india.vercel.app/api
API VERSION
1.1.0
AUTH
Bearer <id_token>
P95 LATENCY TARGET
200 ms

POST/pgx/check

Single prescription-time pharmacogenomic safety check. Returns the hardened envelope plus CPIC-graded alerts, safer alternatives, and Indian context. Designed for EHR order-entry embedding.

curl -X POST https://bioreason-india.vercel.app/api/pgx/check \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <id_token>" \
  -d '{ "drug": "Clopidogrel", "variants": ["rs4244285"], "state": "Bihar", "ethnicity": "Indo-Aryan", "indication": "ACS" }'
{
  "api_version": "1.1.0",
  "request_id": "pgx-a3f1e9c8b7d24e2f",
  "audit_log_id": "audit-7d2c1b9e3f4a8c1d5b2e",
  "timestamp": "2026-06-16T09:14:22.481Z",
  "latency_ms": 187,
  "confidence": "high",
  "data_completeness": {
    "genotype_provided": true,
    "state_provided": true,
    "ethnicity_provided": true,
    "indication_provided": true,
    "fields_populated": 4,
    "fields_total": 4
  },
  "source_citations": [
    {
      "field": "alerts[CYP2C19]",
      "source": "CPIC guideline · CYP2C19*2",
      "evidence_level": "1A",
      "url": "https://cpicpgx.org/guidelines/"
    },
    {
      "field": "alerts[CYP2C19].af_india",
      "source": "IndiGen 1029-genome (CSIR-IGIB) + published Indian cohort PMIDs",
      "url": "https://clingen.igib.res.in/indigen/"
    }
  ],
  "drug": "Clopidogrel",
  "drug_normalised": "clopidogrel",
  "sensitivity": "high",
  "overall_severity": "HIGH",
  "alerts": [
    {
      "severity": "HIGH",
      "severity_score": 3,
      "variant": "rs4244285",
      "gene": "CYP2C19",
      "star_allele": "*2",
      "af_india": 0.23,
      "af_global": 0.15,
      "category": "genotype-confirmed",
      "message": "CYP2C19*2 (rs4244285) carrier on clopidogrel: HIGH risk — Reduced metabolism",
      "action": "Reduced metabolism — consider Prasugrel/Ticagrelor; dose-adjust SSRIs and PPIs.",
      "alternatives": ["Ticagrelor", "Prasugrel"],
      "test_recommended": false
    }
  ],
  "safer_alternatives": [
    { "name": "Ticagrelor", "rationale": "CYP2C19-independent, direct P2Y12 inhibitor. CPIC Level A." },
    { "name": "Prasugrel",  "rationale": "CYP2C19-independent activation. Standard alternative for *2 carriers." }
  ],
  "indian_context": { "state": "Bihar" },
  "grounding_contract": "no entity outside graph result rows"
}
api_versionstringSemver of the response schema.
request_idstringUnique ID for this call. Include in support tickets.
audit_log_idstringImmutable audit-log entry ID. Persisted server-side (365-day retention).
timestampstringISO-8601 UTC.
latency_msintServer-side processing latency.
confidenceenumhigh | medium | low. Derived from completeness + alert category.
data_completenessobjectfields_populated / fields_total. genotype/state/ethnicity/indication flags.
source_citationsarrayPer-field provenance with evidence_level (CPIC 1A/1B/2A/2B) and URL/PMID.
sensitivityenumhigh | moderate | none. Clinical sensitivity tier.
overall_severityenumHIGH | MODERATE | INFO | NONE.
alertsarrayPgxAlert objects with variant, gene, star_allele, af_india, af_global, action.
safer_alternativesarrayDrug name + rationale.
indian_contextobjectState-specific endemic risks when state provided.
grounding_contractstringAlways returns 'no entity outside graph result rows'.

POST/pgx/batch_csv

CSV-in, JSON-out batch interpretation for diagnostic labs. Per-row failures do not abort the batch — the response includes successful + failed counts, every row carries an ok flag.

drug,variants,state,ethnicity,indication,patient_ref
Clopidogrel,rs4244285,Bihar,Indo-Aryan,ACS,patient-0001
Azathioprine,rs116855232;rs1142345,Maharashtra,,IBD maintenance,patient-0002
Warfarin,,Tamil Nadu,Dravidian,AFib,patient-0003
Required: drug. Optional: variants (semicolon-separated rsIDs), state, ethnicity, indication, patient_ref.
curl -X POST https://bioreason-india.vercel.app/api/pgx/batch_csv \
  -H "Authorization: Bearer <id_token>" \
  -F "file=@panel_2026_06.csv"

Engine metadata endpoints

GET /pgx/version
API version, engine version, CPIC guideline version, SLA targets.
GET /pgx/status
Engine health, audit-log policy, grounding-contract enforcement.
GET /pgx/drugs
All drugs covered by the safety layer.
GET /pgx/variants
All 61 tracked variants with Indian allele frequencies.
POST /pgx/batch
Bulk drug list per single genotype (medication reconciliation).
GET /pgx/india_panel
Full IndoPGx flagship panel — pathway + wedges + Ayurvedic overlay.
Open beta: 60 requests / minute / user. Lab API pilot: negotiated per-sample volume. Hospital embed: SLA-bound throughput in contract. Pilot intake at /pilot.