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

Next Steps​