Get Drug Details API
The get-drug-details endpoint allows you to retrieve comprehensive information about a specific drug, including brand information, generic information, safety links, and savings links.
Endpoint
POST /drugs/get-drug-details
Authentication
This endpoint requires authentication using the access token obtained from generate-client-auth-token.
Include the token in the access-token header:
access-token: {access_token}
Request Headers
| Header | Required | Description |
|---|---|---|
access-token | Yes | Access token from generate-client-auth-token |
Content-Type | Yes | Must be application/json |
domain | Yes | Domain/group name for the request |
Request Body
{
drug_brand_name: string; // Required: Brand name of the drug
drug_generic_name?: string; // Optional: Generic name of the drug
}
Request Parameters
drug_brand_name (required)
- Type:
string - Description: Brand name of the drug to retrieve details for
- Example:
"Lipitor"or"Advil"
drug_generic_name (optional)
- Type:
string - Description: Generic name of the drug. If provided, the API will search for the specific generic-brand combination. Hyphens in the generic name are automatically replaced with spaces
- Example:
"atorvastatin"or"atorvastatin-calcium"
Success Response
Status Code: 200
{
statusCode: 200;
data: {
drug: {
drug_brand_name: string; // Brand name (uppercase)
drug_generic_name?: string; // Generic name (uppercase, if applicable)
drug_brand_description: string; // Drug description
drug_brand_image?: string; // Brand image URL
drug_brand_website?: string; // Brand website URL (normalized with https://)
safety_information_link?: string; // Safety information URL (normalized with https://)
prescription_information_link?: string; // Prescription information URL (normalized with https://)
brand_website_link?: string; // Brand website link (normalized with https://)
brand_savings_link?: string; // Brand savings link (normalized with https://)
// ... other drug fields from database
};
};
message: "OKAY";
}
Response Fields
drug_brand_name
- Type:
string - Description: Brand name of the drug (uppercase)
- Example:
"LIPITOR"
drug_generic_name
- Type:
string(optional) - Description: Generic name of the drug (uppercase), present when
drug_generic_namewas provided in the request - Example:
"ATORVASTATIN"
drug_brand_description
- Type:
string - Description: Detailed description of the drug. Drug brand name occurrences in the description are automatically converted to uppercase
- Example:
"LIPITOR is a prescription medicine used to lower cholesterol..."
drug_brand_image
- Type:
string(optional) - Description: URL to the brand drug image
- Example:
"https://example.com/images/lipitor.jpg"
drug_brand_website
- Type:
string(optional) - Description: URL to the brand drug website. Automatically normalized with
https://prefix if missing - Example:
"https://www.lipitor.com"
safety_information_link
- Type:
string(optional) - Description: URL to safety information. Automatically normalized with
https://prefix if missing - Example:
"https://www.lipitor.com/safety"
prescription_information_link
- Type:
string(optional) - Description: URL to prescription information. Automatically normalized with
https://prefix if missing - Example:
"https://www.lipitor.com/prescribing-info"
brand_website_link
- Type:
string(optional) - Description: URL to brand website. Automatically normalized with
https://prefix if missing - Example:
"https://www.lipitor.com"
brand_savings_link
- Type:
string(optional) - Description: URL to brand savings program. Automatically normalized with
https://prefix if missing - Example:
"https://www.lipitor.com/savings"
Error Responses
Missing Required Fields (435)
{
statusCode: 435;
data: {
}
message: "Drug brand name is required";
}
Causes:
- Missing
drug_brand_nameparameter in request body
Unauthorized (403)
{
statusCode: 403;
data: {
}
message: "UNAUTHORIZED";
}
Causes:
- Missing or invalid
access-tokenheader - Expired or invalid access token
Not Found (437)
{
statusCode: 437;
data: {
}
message: "ENTRY_NOT_FOUND";
}
Causes:
- Drug with the provided
drug_brand_name(anddrug_generic_nameif provided) does not exist - Invalid drug name provided
Server Fault (500)
{
statusCode: 500;
data: {
}
message: "SERVER_FAULT";
}
Example Requests
Example 1: Get Brand Drug Details
This example shows retrieving details for a brand drug:
curl -X POST https://api.example.com/drugs/get-drug-details \
-H "Content-Type: application/json" \
-H "access-token: your-access-token" \
-H "domain: your-domain" \
-d '{
"drug_brand_name": "Lipitor"
}'
Response:
{
"statusCode": 200,
"data": {
"drug": {
"drug_brand_name": "LIPITOR",
"drug_brand_description": "LIPITOR is a prescription medicine used to lower cholesterol and triglycerides in your blood. LIPITOR can lower the risk of heart attack, stroke, certain types of heart surgery, and chest pain in people who have heart disease or risk factors for heart disease.",
"drug_brand_image": "https://example.com/images/lipitor.jpg",
"drug_brand_website": "https://www.lipitor.com",
"safety_information_link": "https://www.lipitor.com/safety",
"prescription_information_link": "https://www.lipitor.com/prescribing-info",
"brand_website_link": "https://www.lipitor.com",
"brand_savings_link": "https://www.lipitor.com/savings"
}
},
"message": "OKAY"
}
Example 2: Get Generic Drug Details
This example shows retrieving details for a generic drug:
curl -X POST https://api.example.com/drugs/get-drug-details \
-H "Content-Type: application/json" \
-H "access-token: your-access-token" \
-H "domain: your-domain" \
-d '{
"drug_brand_name": "Lipitor",
"drug_generic_name": "atorvastatin"
}'
Response:
{
"statusCode": 200,
"data": {
"drug": {
"drug_brand_name": "LIPITOR",
"drug_generic_name": "ATORVASTATIN",
"drug_brand_description": "LIPITOR is a prescription medicine used to lower cholesterol and triglycerides in your blood. LIPITOR can lower the risk of heart attack, stroke, certain types of heart surgery, and chest pain in people who have heart disease or risk factors for heart disease.",
"drug_brand_image": "https://example.com/images/lipitor.jpg",
"drug_brand_website": "https://www.lipitor.com",
"safety_information_link": "https://www.lipitor.com/safety",
"prescription_information_link": "https://www.lipitor.com/prescribing-info",
"brand_website_link": "https://www.lipitor.com",
"brand_savings_link": "https://www.lipitor.com/savings"
}
},
"message": "OKAY"
}
Behavior Notes
Generic Name Handling
- If
drug_generic_nameis provided, the API searches for the specific generic-brand combination - Hyphens in
drug_generic_nameare automatically replaced with spaces before searching - If
drug_generic_nameis not provided, only brand drugs matchingdrug_brand_nameare returned
Description Formatting
- Drug brand name occurrences in
drug_brand_descriptionare automatically converted to uppercase - This ensures consistent formatting regardless of how the brand name appears in the database
URL Normalization
- All URL fields are automatically normalized with
https://prefix if missing - URLs that already start with
http://orhttps://are left unchanged - This applies to:
drug_brand_websitesafety_information_linkprescription_information_linkbrand_website_linkbrand_savings_link
Case Sensitivity
- Search is case-insensitive for both
drug_brand_nameanddrug_generic_name - All returned drug names are uppercase
Database Query
- When
drug_generic_nameis provided: Queriesmaster_drug_genericstable and joins withmaster_drug_brand - When
drug_generic_nameis not provided: Queriesmaster_drug_brandtable directly
Related Documentation
- Rx Overview - Learn about Rx API concepts
- Search API - Search for medications by name
- Drug Compare API - Compare drug prices across pharmacies
- API Guidelines - General API response formats and error codes