Skip to main content

Quickstart

This guide will help you make your first request to the Knidian AI API and understand the response.

Prerequisites​

Before you begin, make sure you have:

  • A Knidian AI API key (see Authentication)
  • A tool to make HTTP requests (like curl, Postman, or a programming language of your choice)

Making Your First API Request​

Let's make a simple request to generate a differential diagnosis from a clinical history.

Request Example​

curl -X POST https://api.knidian.ai/diagnose \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"clinical_history": "A 45-year-old male presents with chest pain, shortness of breath, and fatigue for the past 3 days. The pain is described as pressure-like, radiating to the left arm, and worsens with exertion. He has a history of hypertension and hyperlipidemia, and his father had a myocardial infarction at age 50."
}'

Using JavaScript​

const fetchDiagnosis = async () => {
try {
const response = await fetch('https://api.knidian.ai/diagnose', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
clinical_history: 'A 45-year-old male presents with chest pain, shortness of breath, and fatigue for the past 3 days. The pain is described as pressure-like, radiating to the left arm, and worsens with exertion. He has a history of hypertension and hyperlipidemia, and his father had a myocardial infarction at age 50.'
})
});

const data = await response.json();
console.log(data);
} catch (error) {
console.error('Error:', error);
}
};

fetchDiagnosis();

Using Python​

import requests

url = "https://api.knidian.ai/diagnose"
headers = {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
}
payload = {
"clinical_history": "A 45-year-old male presents with chest pain, shortness of breath, and fatigue for the past 3 days. The pain is described as pressure-like, radiating to the left arm, and worsens with exertion. He has a history of hypertension and hyperlipidemia, and his father had a myocardial infarction at age 50."
}

response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data)

Next Steps​

Now that you've made your first API request, you can: