Getting started overview
Integrating with Infermedica's API Platform involves a structured process, beginning with establishing an enterprise partnership, securing API credentials, and then implementing the API calls within your application logic. Infermedica provides tooling and documentation to support the integration of its AI-driven medical knowledge engine into various digital health solutions, such as symptom checkers, call center triage systems, and patient engagement platforms Infermedica homepage. This guide outlines the initial steps required to get your development environment configured and execute a first successful interaction with the Infermedica API.
The core of the Infermedica platform is its Medical API, which allows for programmatic access to symptom analysis, diagnostic possibilities, and triage recommendations. Successful integration typically involves:
- Establishing a partnership and gaining access to the developer portal.
- Obtaining and securely managing your application ID and API key.
- Configuring your development environment to make HTTP requests.
- Constructing and sending a basic API request, then processing its response.
Infermedica emphasizes a partnership-driven approach, meaning direct self-service access for individual developers is not the primary model. Instead, prospective users are directed to contact their sales team to discuss specific use cases and gain access to evaluation environments and production keys Infermedica contact page.
Here's a quick reference for the initial setup:
| Step | What to do | Where |
|---|---|---|
| 1. Contact Sales | Initiate contact to discuss your project and gain access. | Infermedica Contact Us |
| 2. Account & Keys | Receive your unique Application ID and API Key after partnership agreement. | Provided by Infermedica after onboarding |
| 3. Review Docs | Familiarize yourself with the API structure and endpoints. | Infermedica API reference |
| 4. First Request | Send a basic diagnostic request to confirm connectivity. | Your development environment |
Create an account and get keys
Access to the Infermedica API is managed through a formal onboarding process rather than a self-service signup portal. To begin, you must contact Infermedica's sales team to discuss your project requirements and potential partnership. This step is crucial for obtaining evaluation access and, subsequently, production credentials.
Upon successful engagement and agreement, Infermedica will provide you with the necessary credentials:
- Application ID (
App-Id): A unique identifier for your application, used to identify your project when making API calls. - Application Key (
App-Key): A secret key associated with your Application ID, used for authentication.
These keys are typically provided via a secure channel after your account has been set up. It is critical to treat your App-Key as sensitive information, similar to a password. Do not expose it in client-side code, public repositories, or unsecured environments. Best practices for API key management include:
- Storing keys as environment variables.
- Using a secrets management service.
- Proxying API requests through a secure backend server to prevent client-side exposure.
Infermedica's developer portal provides detailed instructions on how to use these credentials for authentication within API requests Infermedica authentication guide. Adhering to secure key management practices is a fundamental aspect of API security, protecting both your application and the integrity of the Infermedica platform Microsoft Azure API security best practices.
Your first request
After obtaining your App-Id and App-Key, you can make your first API request. This example demonstrates a basic diagnostic request to the Infermedica API, which is a common starting point for evaluating the platform's capabilities. The API uses standard HTTP methods and JSON for request and response bodies MDN HTTP overview.
For this example, we'll use the /diagnosis endpoint, which requires an initial set of symptoms or observations. The Infermedica API reference provides detailed schemas for all requests Infermedica API endpoints.
Example: Initial Diagnosis Request (JavaScript)
Infermedica offers a JavaScript SDK, which simplifies interaction with the API. Here's how you might make a request using Node.js and the axios library if you are not using the specific Infermedica SDK, demonstrating the underlying HTTP call.
First, ensure you have Node.js and axios installed:
npm init -y
npm install axios dotenv
Create a .env file in your project root to store your credentials securely:
INFERMEDICA_APP_ID="YOUR_APP_ID"
INFERMEDICA_APP_KEY="YOUR_APP_KEY"
Then, create a JavaScript file (e.g., firstRequest.js):
require('dotenv').config();
const axios = require('axios');
const INFERMEDICA_APP_ID = process.env.INFERMEDICA_APP_ID;
const INFERMEDICA_APP_KEY = process.env.INFERMEDICA_APP_KEY;
const API_BASE_URL = 'https://api.infermedica.com/v3/'; // Check Infermedica docs for correct base URL
async function getDiagnosis() {
if (!INFERMEDICA_APP_ID || !INFERMEDICA_APP_KEY) {
console.error('Infermedica App ID or App Key not set in .env file.');
return;
}
try {
const response = await axios.post(
`${API_BASE_URL}diagnosis`,
{
sex: 'male',
age: 30,
evidence: [
{
id: 's_11',
choice_id: 'present'
},
{
id: 's_12',
choice_id: 'present'
}
]
},
{
headers: {
'App-Id': INFERMEDICA_APP_ID,
'App-Key': INFERMEDICA_APP_KEY,
'Content-Type': 'application/json'
}
}
);
console.log('Diagnosis Response:', JSON.stringify(response.data, null, 2));
} catch (error) {
if (error.response) {
console.error('API Error Status:', error.response.status);
console.error('API Error Data:', error.response.data);
} else if (error.request) {
console.error('No response received:', error.request);
} else {
console.error('Request setup error:', error.message);
}
}
}
getDiagnosis();
To run this code, execute it from your terminal:
node firstRequest.js
A successful response will contain diagnostic information, including potential conditions and next questions. This confirms your credentials are correct and you can communicate with the Infermedica API.
Common next steps
Once you've made your first successful API request, several common next steps can help you further integrate Infermedica into your application:
-
Explore Advanced Endpoints: Review the Infermedica API reference documentation to understand other available endpoints, such as those for symptom searching (
/search), retrieving medical concepts (/lookup), or obtaining a list of supported symptoms and risk factors (/symptoms,/risk_factors). - Implement User Input Flow: Design the user interface and logic for collecting detailed patient information (sex, age, symptoms, risk factors) that will be fed into the API. This often involves interactive symptom selection and confirmation.
- Handle API Responses: Develop robust logic to parse and present the API's responses to your users. This includes displaying diagnostic probabilities, recommended next steps (e.g., consult a physician, self-care), and follow-up questions for more refined diagnoses.
- Integrate SDKs: If available for your language and platform, consider using Infermedica's official SDKs (e.g., JavaScript SDK) to streamline API interactions and reduce boilerplate code. These SDKs often handle authentication, request formatting, and error handling Infermedica JavaScript SDK documentation.
- Error Handling and Retries: Implement comprehensive error handling, including retries for transient network issues and clear messaging for API-specific errors (e.g., invalid input, rate limits).
- Security and Compliance: Ensure your integration adheres to all relevant healthcare compliance standards (HIPAA, GDPR, CE MDR Class IIa, ISO 13485) and secure coding practices, especially concerning patient data Infermedica security and compliance overview.
- Performance Optimization: Monitor API call performance and implement caching strategies for static data (like symptom lists) where appropriate to enhance user experience and reduce API load.
Troubleshooting the first call
Encountering issues during your first API call is common. Here are some troubleshooting steps:
-
Check Credentials: Double-check your
App-IdandApp-Keyfor typos. Ensure they are correctly placed in the HTTP headers asApp-IdandApp-Key, not in the request body or URL parameters. Incorrect credentials will typically result in a401 Unauthorizedor403 ForbiddenHTTP status code. -
Verify Request Body Format: The Infermedica API expects a JSON request body. Ensure your JSON is well-formed and matches the schema specified in the Infermedica API documentation for the specific endpoint you are calling. Malformed JSON often leads to
400 Bad Requesterrors. -
Content-Type Header: Confirm that the
Content-Type: application/jsonheader is present in your request. Without it, the API may not correctly parse your request body. -
API Endpoint URL: Verify that you are using the correct base URL and endpoint path. The Infermedica API typically uses a versioned base URL (e.g.,
https://api.infermedica.com/v3/). Refer to the official API reference for the exact URLs. - Network Connectivity: Ensure your development environment has stable internet connectivity and no firewall rules are blocking outgoing HTTP requests to the Infermedica API domain.
-
Rate Limits: While less common for a first call, be aware of potential API rate limits. If you make too many requests too quickly, the API might return a
429 Too Many Requestserror. Consult Infermedica's documentation for specific rate limit policies. - Consult Documentation: The Infermedica developer portal is the authoritative source for all API details, error codes, and best practices. Review the specific endpoint's documentation and any associated error message explanations.
- Contact Support: If you've exhausted troubleshooting steps, contact Infermedica's support channel, provided during your onboarding process. Be prepared to share your request (excluding your secret key) and the full error response received.