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
- Log in to your dashboard
- Select CTWise from the product selector
- Click API Playground in the navigation menu
Playground Features
| Feature | Description |
|---|---|
| Endpoint Selection | Choose from all available API endpoints |
| Request Builder | Build requests with an intuitive form |
| Live Response | See real responses instantly |
| cURL Export | Copy ready-to-use cURL commands |
| History | View 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:
| Parameter | Required | Description |
|---|---|---|
query | Yes | Your search query |
sources | No | Filter by source (FDA, EMA, ICH) |
limit | No | Max 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
}
Example: Semantic Search
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:
- Configure your request
- Click Copy as cURL
- 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
- Start Simple: Begin with basic queries before adding filters
- Use the Examples: Click "Load Example" for pre-configured requests
- Check Response Time: Monitor latency to optimize your queries
- Export for Code: Use the cURL export to build your integration
- Test Edge Cases: Try empty queries, special characters, etc.
Available Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/search | POST | Search regulatory rules by keyword |
/v1/semantic-search | POST | AI-powered semantic search |
/v1/catalog/sources | GET | List available content sources |
/v1/rules/\{id\} | GET | Get a specific rule by ID |
/v1/patterns | GET | List 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:
| Endpoint | Method | Tier Requirement | Purpose |
|---|---|---|---|
/v1/intelligence/classify | POST | Starter+ | Classify events and map to CFR regulations |
/v1/intelligence/investigate | POST | Pro+ | Deep investigation with risk assessment |
/v1/intelligence/regulations/\{cfr\} | GET | Starter+ | Retrieve CFR regulation details |
/v1/intelligence/ich/\{guideline\} | GET | Starter+ | Access ICH guidelines (Q7/Q9/Q10) |
/v1/intelligence/ich/\{guideline\}/\{section\} | GET | Starter+ | Retrieve specific ICH sections |
/v1/analytics/trends | GET | Pro+ | 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"
Example Scenario 6: View Analytics Trends
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
| Feature | Starter | Pro | Enterprise |
|---|---|---|---|
| Classify Event | ✓ | ✓ | ✓ |
| CFR Lookup | ✓ | ✓ | ✓ |
| ICH Guidelines | ✓ | ✓ | ✓ |
| Investigate Event | - | ✓ | ✓ |
| Analytics Trends | - | ✓ | ✓ |
| Rate Limit | 1,000/day | 10,000/day | Unlimited |
Upgrade to Pro to access comprehensive investigation and analytics features. Contact sales@orchestraprime.com for Enterprise pricing.
Response Times
| Endpoint | Typical Latency | Notes |
|---|---|---|
| Classify | 200-500ms | Fast classification |
| Investigate | 1.0-2.5s | Includes semantic search and risk assessment |
| CFR Lookup | 100-300ms | Cached responses <50ms |
| ICH Guideline | 200-500ms | Full guideline larger response |
| ICH Section | 100-300ms | Single section faster |
| Analytics Trends | 600-1200ms | Aggregation over large dataset |
Tips for Testing in Playground
- Start with Classify: Begin with simple event classification to understand the API's capabilities
- Use Specific Events: Detailed descriptions improve classification accuracy and similar observation matching
- Try Different Product Types: Filter by
drug,food,device, orapito see product-specific regulations - Explore ICH Cross-References: Use CFR lookup to discover related ICH guideline sections
- Monitor Response Times: Check the Playground's response time metrics to optimize your queries
For complete endpoint documentation, see the KG Intelligence API Overview.