Multi-Purpose API Suite

Comprehensive API suite for FDA drug product information, AI-powered text analysis, and bulk data exports

v1.0.0OpenAPI 3.0.0

Overview

Comprehensive API suite for FDA drug product information, AI-powered text analysis, and bulk data exports

Base URL

https://api.mydomain.com

Rate Limits

API requests are rate-limited to ensure fair usage. Bulk operations include automatic delays.

Authentication

FDA Endpoints

FDA product endpoints do not require authentication and are publicly accessible.

AI Analysis Endpoints

AI analysis endpoints require server-side API key configuration. The Claude API key must be set as an environment variable on the server.

Environment Variable Required: CLAUDE_API_KEY must be configured on the server.

API Endpoints

POST/api/ai/analyze

Analyze text content using Claude AI with customizable prompts and use cases

Request Body

{
  "text": "This is a sample document that needs analysis...",
  "prompt": "Please summarize the key points and extract important insights from this text.",
  "useCase": "document_summary",
  "provider": "string"
}

Parameters

ParameterTypeRequiredDescription
textstringYesText content to analyze
promptstringNoCustom analysis prompt for the AI
useCasestringNoSpecific use case for the analysis
providerstringNoAI provider to use
GET/api/fda-products/bulk

Export large datasets of FDA drug product information in JSON or CSV format with pagination support

Query Parameters

ParameterTypeDefaultDescription
formatstringjsonResponse format
batchSizeinteger1000Number of records per batch (max 1000)
maxRecordsinteger0Maximum number of records to export (0 = all)

Usage Examples

AI Text Analysis

POST /api/ai/analyze
Content-Type: application/json

{
  "text": "Your document content here...",
  "prompt": "Analyze this document and extract key insights",
  "useCase": "document_analysis"
}

Basic JSON Export

GET /api/fda-products/bulk

CSV Export with Limits

GET /api/fda-products/bulk?format=csv&maxRecords=5000&batchSize=500

cURL - AI Analysis

curl -X POST "https://api.mydomain.com/api/ai/analyze" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Sample document content to analyze...",
    "prompt": "Please summarize and extract key points",
    "useCase": "document_summary"
  }'

cURL - FDA Data Export

curl -X GET "https://api.mydomain.com/api/fda-products/bulk?format=json&maxRecords=100" \
  -H "Accept: application/json"

JavaScript - AI Analysis

const analyzeText = async (text, prompt) => {
  const response = await fetch('/api/ai/analyze', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ text, prompt, useCase: 'analysis' })
  });
  
  const result = await response.json();
  console.log('Analysis result:', result.content[0].text);
};

JavaScript - FDA Data Fetch

const response = await fetch('/api/fda-products/bulk?format=json&maxRecords=1000');
const data = await response.json();
console.log(`Exported ${data.meta.totalApplications} applications`);

Data Schemas

FDAApplication

{
  "type": "object",
  "properties": {
    "applicationNumber": {
      "type": "string",
      "description": "FDA application number"
    },
    "sponsorName": {
      "type": "string",
      "description": "Sponsor/manufacturer name"
    },
    "products": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/FDAProduct"
      }
    },
    "totalProducts": {
      "type": "number",
      "description": "Total number of products in application"
    }
  }
}

FDAProduct

{
  "type": "object",
  "properties": {
    "productNumber": {
      "type": "string",
      "description": "Product number"
    },
    "brandName": {
      "type": "string",
      "description": "Brand name of the product"
    },
    "activeIngredient": {
      "type": "string",
      "description": "Active ingredient(s)"
    },
    "form": {
      "type": "string",
      "description": "Dosage form (tablet, capsule, etc.)"
    },
    "strength": {
      "type": "string",
      "description": "Strength of the product"
    },
    "route": {
      "type": "string",
      "description": "Route of administration"
    },
    "marketingStatus": {
      "type": "string",
      "description": "Current marketing status"
    },
    "teCode": {
      "type": "string",
      "description": "Therapeutic equivalence code"
    },
    "referenceDrug": {
      "type": "string",
      "description": "Reference drug information"
    },
    "referenceStandard": {
      "type": "string",
      "description": "Reference standard"
    }
  }
}

BulkExportMeta

{
  "type": "object",
  "properties": {
    "totalApplications": {
      "type": "number",
      "description": "Total applications exported"
    },
    "totalProducts": {
      "type": "number",
      "description": "Total products exported"
    },
    "exportDate": {
      "type": "string",
      "format": "date-time",
      "description": "Export timestamp"
    },
    "totalAvailable": {
      "type": "number",
      "description": "Total records available in FDA database"
    },
    "exportComplete": {
      "type": "boolean",
      "description": "Whether export completed successfully"
    }
  }
}

Error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Error message"
    },
    "success": {
      "type": "boolean",
      "example": false
    },
    "details": {
      "type": "string",
      "description": "Detailed error information"
    }
  }
}