POST /v1/interactions/ask

Ask a natural-language question about drug interactions. The system uses AI to extract drug names from your question, then runs the full interaction check pipeline.

Request

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

Parameters

NameTypeRequiredDescription
questionstringrequiredNatural-language question about drug interactions.
contextstringoptionalAdditional clinical context (e.g., patient age, conditions).
formatstringoptional"structured" (default), "summary", or "conversational". Best used with "conversational".

Examples

cURL

curl -X POST "https://api.rxlabelguard.com/v1/interactions/ask" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"question": "Can I take warfarin with ibuprofen?", "format": "conversational"}'

JavaScript

const response = await fetch("https://api.rxlabelguard.com/v1/interactions/ask", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY",
  },
  body: JSON.stringify({
    question: "My patient takes metformin and lisinopril, any concerns?",
    format: "conversational",
  }),
});

const data = await response.json();
console.log(data.summary);  // Natural language answer

Python

import requests

response = requests.post(
    "https://api.rxlabelguard.com/v1/interactions/ask",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={
        "question": "Can I take warfarin with ibuprofen?",
        "format": "conversational",
    },
)

data = response.json()
print(data["summary"])

Response

Returns the same schema as POST /check. If no drug names can be extracted from the question, returns an empty result with an error message in the errors array.

{
  "resolutions": [...],
  "pairs": [...],
  "disclaimer": "This information is derived from FDA...",
  "errors": [],
  "summary": "Based on your question, warfarin and ibuprofen have a major interaction..."
}