
How to Search ClinicalTrials.gov Programmatically (The v2 API is Actually Good Now)
ClinicalTrials.gov quietly launched a completely new API in 2024 and it's honestly a massive upgrade over the old one. If you tried the v1 API years ago and gave up because the XML responses were a nightmare, it's worth another look. The new v2 API returns JSON, supports proper pagination with tokens, and has a clean query syntax. I spent a while building tooling around it and want to share what I learned -- the docs are decent but leave out some practical stuff. What you can search for The registry has over 500,000 clinical studies. You can search by: Keyword across all fields (drug names, conditions, descriptions) Condition (diabetes, breast cancer, PTSD, etc.) Intervention (specific drug or device names) Sponsor (Pfizer, NIH, Mayo Clinic, etc.) NCT ID for direct lookup of a specific trial You can also filter by status (recruiting, completed, terminated), phase (1-4), and study type (interventional vs observational). The API basics Base URL: https://clinicaltrials.gov/api/v2/studies
Continue reading on Dev.to
Opens in a new tab

