Skip to main content

API Playground

The API Playground lets you test CTWise API endpoints directly from your browser without writing any code. It's the fastest way to explore the API and verify your integration logic.

Accessing the Playground

  1. Log in to your dashboard
  2. Select CTWise from the product selector
  3. Click API Playground in the navigation menu

Playground Features

FeatureDescription
Endpoint SelectionChoose from all available API endpoints
Request BuilderBuild requests with an intuitive form
Live ResponseSee real responses instantly
cURL ExportCopy ready-to-use cURL commands
HistoryView your recent requests

Making Your First Request

Step 1: Select an Endpoint

Choose an endpoint from the dropdown menu:

  • Search Rules (POST /v1/search) - Search regulatory rules
  • Semantic Search (POST /v1/semantic-search) - AI-powered semantic search
  • List Sources (GET /v1/catalog/sources) - List available content sources

Step 2: Configure Parameters

Based on the selected endpoint, fill in the required parameters:

For Search Rules:

ParameterRequiredDescription
queryYesYour search query
sourcesNoFilter by source (FDA, EMA, ICH)
limitNoMax results (default: 10)

Step 3: Send Request

Click Send Request to execute the API call.

Step 4: Review Response

The response panel shows:

  • Status Code: HTTP status (200, 400, 401, etc.)
  • Response Time: How long the request took
  • Headers: Response headers
  • Body: JSON response data

Example: Searching Regulatory Rules

Let's search for FDA clinical trial requirements:

1. Select Endpoint

Choose POST /v1/search

2. Enter Parameters

{
"query": "FDA clinical trial phase requirements",
"sources": ["fda"],
"limit": 5
}

3. Send and View Results

Click Send Request. You'll see results like:

{
"results": [
{
"rule_id": "fda-clin-001",
"title": "Clinical Trial Phases Overview",
"content": "The FDA requires clinical trials to progress through...",
"source": "FDA",
"relevance_score": 0.95
},
...
],
"total": 42,
"query_time_ms": 125
}

Semantic search uses AI to understand the meaning of your query:

Parameters

{
"query": "What are the requirements for drug labeling in Europe?",
"top_k": 10
}

Response

The semantic search returns results ranked by semantic relevance, even if the exact words don't match.

Copying cURL Commands

To use the same request outside the Playground:

  1. Configure your request
  2. Click Copy as cURL
  3. Paste into your terminal

Example cURL command:

curl -X POST "https://api.ctwise.ai/v1/search" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "FDA clinical trial requirements",
"sources": ["fda"],
"limit": 5
}'

Understanding Error Responses

400 Bad Request

{
"error": "Bad Request",
"message": "Missing required parameter: query",
"code": "MISSING_PARAMETER"
}

Solution: Check that all required parameters are provided.

401 Unauthorized

{
"error": "Unauthorized",
"message": "Invalid API key",
"code": "INVALID_API_KEY"
}

Solution: Verify your API key is correct.

429 Too Many Requests

{
"error": "Too Many Requests",
"message": "Rate limit exceeded",
"code": "RATE_LIMIT_EXCEEDED"
}

Solution: Wait and retry, or upgrade your tier for higher limits.

Tips for Using the Playground

  1. Start Simple: Begin with basic queries before adding filters
  2. Use the Examples: Click "Load Example" for pre-configured requests
  3. Check Response Time: Monitor latency to optimize your queries
  4. Export for Code: Use the cURL export to build your integration
  5. Test Edge Cases: Try empty queries, special characters, etc.

Available Endpoints

EndpointMethodDescription
/v1/searchPOSTSearch regulatory rules by keyword
/v1/semantic-searchPOSTAI-powered semantic search
/v1/catalog/sourcesGETList available content sources
/v1/rules/\{id\}GETGet a specific rule by ID
/v1/patternsGETList regulatory patterns

For detailed endpoint documentation, see the API Reference.

Playground vs Production

The Playground uses your real API key and counts against your quota. However:

  • Requests are made from your browser
  • API key is automatically included
  • Rate limits apply as normal

KG Intelligence API Scenarios

The KG Intelligence API extends CTWise with AI-powered regulatory intelligence capabilities. Test these endpoints directly in the Playground to explore event classification, regulatory mapping, and compliance analytics.

Available KG Intelligence Endpoints

The Playground supports all six KG Intelligence API endpoints:

EndpointMethodTier RequirementPurpose
/v1/intelligence/classifyPOSTStarter+Classify events and map to CFR regulations
/v1/intelligence/investigatePOSTPro+Deep investigation with risk assessment
/v1/intelligence/regulations/\{cfr\}GETStarter+Retrieve CFR regulation details
/v1/intelligence/ich/\{guideline\}GETStarter+Access ICH guidelines (Q7/Q9/Q10)
/v1/intelligence/ich/\{guideline\}/\{section\}GETStarter+Retrieve specific ICH sections
/v1/analytics/trendsGETPro+View citation trends and analytics

Example Scenario 1: Classify a Quality Event

Use Case: You receive an FDA 483 observation and need to understand which CFR regulations apply.

Endpoint: POST /v1/intelligence/classify

Request Body:

{
"event": "Temperature monitoring equipment in the warehouse was not calibrated according to written procedures",
"product_type": "drug"
}

Expected Response:

  • Event type: equipment_calibration
  • Applicable CFR: 21 CFR 211.68 (Automatic, mechanical, and electronic equipment)
  • Category: equipment
  • Confidence score: High (0.85+)

Copy-Paste cURL:

curl -X POST "https://api.ctwise.ai/v1/intelligence/classify" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "Temperature monitoring equipment in the warehouse was not calibrated according to written procedures",
"product_type": "drug"
}'

Example Scenario 2: Investigate a Complex Event

Use Case: You're investigating a major deviation and need similar historical observations, ICH guidance, and risk assessment.

Endpoint: POST /v1/intelligence/investigate

Request Body:

{
"event": "Cleaning validation study did not include worst-case product scenarios",
"product_type": "drug",
"include_similar": true,
"include_ich": true,
"include_risk_assessment": true
}

Expected Response:

  • Event classification and applicable CFR sections
  • 3-5 similar FDA 483 observations from 2020-2024
  • Relevant ICH Q7 (cleaning validation) and Q9 (risk management) sections
  • AI-powered risk assessment with recommended actions
  • Historical citation frequency data

Copy-Paste cURL:

curl -X POST "https://api.ctwise.ai/v1/intelligence/investigate" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "Cleaning validation study did not include worst-case product scenarios",
"product_type": "drug",
"include_similar": true,
"include_ich": true,
"include_risk_assessment": true
}'

Note: Requires Pro+ tier subscription.

Example Scenario 3: Look Up a CFR Regulation

Use Case: You need the full text and ICH cross-references for a specific CFR section.

Endpoint: GET /v1/intelligence/regulations/21-CFR-211.42

Expected Response:

  • Complete CFR 211.42 text (Design and construction features)
  • All subsections
  • Related ICH Q7 guideline sections
  • FDA 483 citation frequency data
  • Related CFR sections

Copy-Paste cURL:

curl -X GET "https://api.ctwise.ai/v1/intelligence/regulations/21-CFR-211.42" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json"

Example Scenario 4: Browse ICH Guidelines

Use Case: You're developing SOPs and need to reference ICH Q7 GMP requirements.

Endpoint: GET /v1/intelligence/ich/Q7

Expected Response:

  • Complete ICH Q7 guideline structure
  • All 19 main sections
  • CFR cross-references for each section
  • Related ICH Q9 and Q10 guidelines

Copy-Paste cURL:

curl -X GET "https://api.ctwise.ai/v1/intelligence/ich/Q7" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json"

Example Scenario 5: View a Specific ICH Section

Use Case: You need detailed requirements from ICH Q7 Section 12.4 (Cleaning Validation).

Endpoint: GET /v1/intelligence/ich/Q7/12.4

Expected Response:

  • Full section 12.4 text and subsections
  • Mapped CFR sections (21 CFR 211.67)
  • Implementation guidance
  • Common deficiencies from FDA 483 observations

Copy-Paste cURL:

curl -X GET "https://api.ctwise.ai/v1/intelligence/ich/Q7/12.4" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json"

Use Case: You're planning internal audits and want to understand trending FDA 483 citations.

Endpoint: GET /v1/analytics/trends

Query Parameters:

?time_period=1y&product_type=drug&limit=10

Expected Response:

  • Top 10 trending CFR citations over the past year
  • Event type frequency analysis
  • Severity distribution (critical/major/minor)
  • Geographic trends by region
  • Rank changes compared to previous period

Copy-Paste cURL:

curl -X GET "https://api.ctwise.ai/v1/analytics/trends?time_period=1y&product_type=drug&limit=10" \
-H "X-Api-Key: ctw_YOUR_API_KEY" \
-H "Content-Type: application/json"

Note: Requires Pro+ tier subscription.

Tier Access Requirements

FeatureStarterProEnterprise
Classify Event
CFR Lookup
ICH Guidelines
Investigate Event-
Analytics Trends-
Rate Limit1,000/day10,000/dayUnlimited

Upgrade to Pro to access comprehensive investigation and analytics features. Contact sales@orchestraprime.com for Enterprise pricing.

Response Times

EndpointTypical LatencyNotes
Classify200-500msFast classification
Investigate1.0-2.5sIncludes semantic search and risk assessment
CFR Lookup100-300msCached responses <50ms
ICH Guideline200-500msFull guideline larger response
ICH Section100-300msSingle section faster
Analytics Trends600-1200msAggregation over large dataset

Tips for Testing in Playground

  1. Start with Classify: Begin with simple event classification to understand the API's capabilities
  2. Use Specific Events: Detailed descriptions improve classification accuracy and similar observation matching
  3. Try Different Product Types: Filter by drug, food, device, or api to see product-specific regulations
  4. Explore ICH Cross-References: Use CFR lookup to discover related ICH guideline sections
  5. Monitor Response Times: Check the Playground's response time metrics to optimize your queries

For complete endpoint documentation, see the KG Intelligence API Overview.

Next Steps