Integration examples
cURL
curl -X POST "https://api.saubit.com.br/api/v1/interactions/check" \
-H "X-API-Key: sm_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"medications": [
{"name":"Warfarin","dose_mg":5},
{"name":"Omeprazole","dose_mg":20}
],
"patient_record": {
"current_medications":[{"name":"Dipyrone","dose_mg":500}],
"conditions":["diabetes","hypertension"]
},
"language":"en"
}'
JavaScript (Fetch)
const resp = await fetch("https://api.saubit.com.br/api/v1/interactions/check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "sm_live_xxx",
},
body: JSON.stringify({
medications: [
{ name: "Warfarin", dose_mg: 5 },
{ name: "Omeprazole", dose_mg: 20 },
],
patient_record: {
current_medications: [{ name: "Dipyrone", dose_mg: 500 }],
conditions: ["diabetes", "hypertension"],
},
language: "en",
}),
});
const data = await resp.json();
Recheck (cURL)
curl -X POST "https://api.saubit.com.br/api/v1/interactions/recheck" \
-H "X-API-Key: sm_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"analysis_id": "returned-uuid-or-id",
"patient_context": {"creatinine_clearance": 35}
}'
Chat (cURL)
curl -X POST "https://api.saubit.com.br/api/v1/chat/message" \
-H "X-API-Key: sm_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"session_id": "optional",
"message": "Can a patient on hemodialysis use this medication? What are the risks and monitoring?"
}'
Python (requests)
import requests
url = "https://api.saubit.com.br/api/v1/interactions/check"
headers = {"X-API-Key": "sm_live_xxx", "Content-Type": "application/json"}
payload = {
"medications": [{"name": "Warfarin", "dose_mg": 5}, {"name": "Omeprazole", "dose_mg": 20}],
"patient_record": {
"current_medications": [{"name": "Dipyrone", "dose_mg": 500}],
"conditions": ["diabetes", "hypertension"]
},
"language": "en",
}
resp = requests.post(url, headers=headers, json=payload, timeout=30)
print(resp.status_code, resp.json())
C# (.NET HttpClient)
using System.Net.Http;
using System.Text;
using System.Text.Json;
var client = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.saubit.com.br/api/v1/interactions/check");
req.Headers.Add("X-API-Key", "sm_live_xxx");
req.Content = new StringContent(JsonSerializer.Serialize(new {
medications = new[] {
new { name = "Warfarin", dose_mg = 5 },
new { name = "Omeprazole", dose_mg = 20 }
},
patient_record = new {
current_medications = new[] { new { name = "Dipyrone", dose_mg = 500 } },
conditions = new[] { "diabetes", "hypertension" }
},
language = "en"
}), Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
var text = await resp.Content.ReadAsStringAsync();
Try it directly
Playground da Rota
Teste a rota diretamente no Docusaurus.