POST /v1/interactions/graph-search

Coming Soon

Search the RxLabelGuard drug knowledge graph by name prefix. Matches against generic names and brand names using an in-memory index cached across Lambda invocations. Use this endpoint to resolve user-entered drug names to RxCUI identifiers before calling POST /v1/interactions/graph-eval.

This endpoint is not yet available for public use.

Graph-based drug search is currently in private beta. Register your interest to be notified when early access opens.

Request

POST /v1/interactions/graph-search
Content-Type: application/json
x-api-key: rxlg_your_api_key

Parameters

NameTypeRequiredDescription
querystringrequiredDrug name prefix to search. Matches against generic names and brand names (case-insensitive substring match). Minimum 1 character.
limitnumberoptionalMaximum number of results to return. Defaults to 10.

Examples

cURL

curl -X POST "https://api.rxlabelguard.com/v1/interactions/graph-search" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"query": "warfar", "limit": 5}'

JavaScript

// Autocomplete: search as user types, then pass rxcui to graph-eval
const response = await fetch("https://api.rxlabelguard.com/v1/interactions/graph-search", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY",
  },
  body: JSON.stringify({
    query: "metform",
    limit: 10,
  }),
});

const results = await response.json();
// results is an array of { rxcui, genericName, brandNames }
const rxcuis = results.map((r) => r.rxcui);

Python

import requests

response = requests.post(
    "https://api.rxlabelguard.com/v1/interactions/graph-search",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={"query": "lisinop", "limit": 5},
)

results = response.json()
for drug in results:
    print(f"{drug['genericName']} (RxCUI: {drug['rxcui']}) — {drug['brandNames']}")

Response Schema

Returns an array of matching drug entries sorted by relevance. Each entry contains the RxCUI needed for graph-eval and graph-neighborhood.

[
  {
    "rxcui": "11289",
    "genericName": "warfarin",
    "brandNames": ["COUMADIN", "JANTOVEN"]
  },
  {
    "rxcui": "202421",
    "genericName": "warfarin sodium",
    "brandNames": ["COUMADIN"]
  }
]

Match Behavior

The search performs a case-insensitive substring match on both genericName and all entries in brandNames. The drug index is loaded into Lambda memory on first invocation and cached across warm invocations, keeping search latency under 5ms once warmed.