# Searching Clinicaltrials

Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment...

- Repository: https://github.com/maziyarpanahi/openmed (5755 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -g -a claude-code -y`
Codex: `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -g -a codex -y`
Cursor: `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -g -a cursor -y`
Gemini CLI: `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add maziyarpanahi/openmed`

## Description

Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination. Use when the user wants to find trials for a diagnosis or drug, screen patients against open studies, build a trial-matching feature, or pull a trial corpus for analysis. Trigger keywords: clinical trial, ClinicalTrials.gov, NCT number, trial search, recruiting studies, eligibility, query.cond, query.intr, pageToken, v2 API. Pairs adjacent to OpenMed: take Disease/Pharmaceutical entities from openmed.analyze_text and turn them into query.cond / query.intr filters; the returned eligibility text feeds parsing-trial-eligibility. ClinicalTrials.gov API v2 is fully public, no API key, no license.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Searching ClinicalTrials.gov (v2 REST API)

Query **ClinicalTrials.gov**, the U.S. registry of clinical studies, for trials
matching a condition, intervention, and recruitment status. This skill uses the
**modern v2 REST API** (`/api/v2/studies`), which returns structured JSON and
paginates with an opaque cursor (`pageToken`), not page numbers.

The v2 API is **fully public**: no API key, no registration, no license barrier.
The legacy v1/classic API and the older `query_term`-style endpoints are
deprecated, do not build on them.

## When to use

- OpenMed extracted a diagnosis ("metastatic colorectal cancer") or a drug
  ("pembrolizumab") and you want open trials for it.
- You are building a patient-to-trial matching feature and need candidate studies
  before applying eligibility logic (`parsing-trial-eligibility`).
- You need a corpus of trial records (eligibility text, outcomes) to feed back
  into `openmed.analyze_text` for biomedical NER.

If you already have an NCT number, fetch the single study directly
(`/api/v2/studies/NCT01234567`) instead of searching.

## Quick start (real v2 API call)

Base URL: `https://clinicaltrials.gov/api/v2`. No auth. JSON by default.

```python
import requests

BASE = "https://clinicaltrials.gov/api/v2"

The rest: https://github.com/maziyarpanahi/openmed/blob/HEAD/skills/searching-clinicaltrials/SKILL.md
