Skip to main content

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

HeaderRequiredDescription
access-tokenYesAccess token from generate-client-auth-token
Content-TypeYesMust be application/json
domainYesDomain/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_name was 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"
  • Type: string (optional)
  • Description: URL to safety information. Automatically normalized with https:// prefix if missing
  • Example: "https://www.lipitor.com/safety"
  • Type: string (optional)
  • Description: URL to prescription information. Automatically normalized with https:// prefix if missing
  • Example: "https://www.lipitor.com/prescribing-info"
  • Type: string (optional)
  • Description: URL to brand website. Automatically normalized with https:// prefix if missing
  • Example: "https://www.lipitor.com"
  • 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_name parameter in request body

Unauthorized (403)

{
statusCode: 403;
data: {
}
message: "UNAUTHORIZED";
}

Causes:

  • Missing or invalid access-token header
  • Expired or invalid access token

Not Found (437)

{
statusCode: 437;
data: {
}
message: "ENTRY_NOT_FOUND";
}

Causes:

  • Drug with the provided drug_brand_name (and drug_generic_name if 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_name is provided, the API searches for the specific generic-brand combination
  • Hyphens in drug_generic_name are automatically replaced with spaces before searching
  • If drug_generic_name is not provided, only brand drugs matching drug_brand_name are returned

Description Formatting

  • Drug brand name occurrences in drug_brand_description are 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:// or https:// are left unchanged
  • This applies to:
    • drug_brand_website
    • safety_information_link
    • prescription_information_link
    • brand_website_link
    • brand_savings_link

Case Sensitivity

  • Search is case-insensitive for both drug_brand_name and drug_generic_name
  • All returned drug names are uppercase

Database Query

  • When drug_generic_name is provided: Queries master_drug_generics table and joins with master_drug_brand
  • When drug_generic_name is not provided: Queries master_drug_brand table directly