All guides

ClinicalTrials.gov API v2: endpoints, paging and examples

What the ClinicalTrials.gov API is

ClinicalTrials.gov has a public REST API, version 2, at https://clinicaltrials.gov/api/v2. It returns registered study records as JSON or CSV. Every request on this page was run against the live API on 6 October 2026, without an API key or login.

The registry describes the API as providing metadata, statistics and the most recent version of the clinical trials available on ClinicalTrials.gov. That last phrase matters if you want to know what changed in a record, which is covered at the end of this guide.

curl "https://clinicaltrials.gov/api/v2/version"

{
  "apiVersion" : "2.0.5",
  "dataTimestamp" : "2026-10-05T09:00:05"
}

dataTimestamp is the UTC time of the dataset the API is serving. Read it before and after a long download: if it changed, the registry refreshed its data while you were paging and your pages may not belong to the same snapshot.

Endpoints

All paths are relative to https://clinicaltrials.gov/api/v2 and accept GET.

/studies
Search studies and read the results page by page.
/studies/{nctId}
One study by its NCT ID.
/studies/metadata
The study data model: every field and piece name you can request.
/studies/search-areas
The search areas you can name in a query, such as LastUpdatePostDate.
/studies/enums
Allowed values for coded fields, such as statuses and phases.
/stats/size
Statistics on the size of study records.
/stats/field/values
Value statistics for individual fields.
/stats/field/sizes
Sizes of list fields.
/version
The API version and the dataset timestamp.

Choosing which fields come back

A full study record is large. The fields parameter takes a comma- or pipe-separated list of field or piece names from the registry's data structure, such as NCTId, BriefTitle, OverallStatus, PrimaryCompletionDate and EnrollmentCount. Name a whole section, such as ConditionsModule, to get everything beneath it.

Two things catch people out:

  • You request fields by their capitalized names, but the JSON comes back nested under camel-case module names. PrimaryCompletionDate arrives as protocolSection.statusModule.primaryCompletionDateStruct.date.
  • Dates keep the precision the sponsor entered. A primary completion date can be a full day, 2027-12-26, or only a month, 2027-09. Do not parse every value as a day.

An unknown name is rejected with HTTP 400 and a plain-text message, for example Parameter 'fields' contains invalid field name: 'Nope'.

With format=csv the fields parameter takes CSV column names instead, such as NCT Number and Study Title.

Paging with page tokens

The API has no page numbers or offsets. Each response that has more results includes a nextPageToken; send it back as pageToken to get the next page. The last page has no token.

  • Keep every other parameter the same as on the first request. Only pageToken, pageSize and countTotal may differ.
  • A page can contain an empty studies array and still have a token. Stop when the token is missing, not when a page is empty.
  • totalCount is returned with the first page only.
  • For CSV, the token is in the x-next-page-token response header and the total in x-total-count.

Fetching one study by NCT ID

curl "https://clinicaltrials.gov/api/v2/studies/NCT04852770?fields=NCTId,BriefTitle,OverallStatus,PrimaryCompletionDate,EnrollmentCount,LastUpdatePostDate"

{"protocolSection":{"identificationModule":{"nctId":"NCT04852770","briefTitle":"Efficacy of TBCT, MBHP and PPT for PTSD During the Covid-19 Pandemics"},"statusModule":{"overallStatus":"TERMINATED","primaryCompletionDateStruct":{"date":"2023-06-21"},"lastUpdatePostDateStruct":{"date":"2025-04-04"}},"designModule":{"enrollmentInfo":{"count":135}}}}

An ID the registry does not know returns HTTP 404. According to the specification, an ID that is an alias of another study returns a 301 redirect to the current record. Besides json and csv, this endpoint also offers json.zip, fhir.json and ris formats.

Python: read every page of a search

This script uses the requests library. It pages through industry-sponsored Phase 3 studies updated since 1 September 2026 and prints the first 250.

import itertools
import time

import requests

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


def get_json(session, url, params=None):
    response = session.get(url, params=params, timeout=45, allow_redirects=False)
    response.raise_for_status()
    # A throttled request can come back as a redirect or as an HTML page,
    # so check the content type before parsing.
    if "json" not in response.headers.get("Content-Type", ""):
        raise RuntimeError(f"Expected JSON, got HTTP {response.status_code}")
    return response.json()


def iter_studies(session, params, pause=0.5):
    params = {**params, "format": "json", "pageSize": 100}
    while True:
        body = get_json(session, f"{BASE}/studies", params)
        yield from body["studies"]
        token = body.get("nextPageToken")
        if not token:
            return
        params["pageToken"] = token  # every other parameter stays the same
        time.sleep(pause)


session = requests.Session()
session.headers["User-Agent"] = "my-research-script ([email protected])"

params = {
    "query.term": "AREA[LastUpdatePostDate]RANGE[2026-09-01,MAX]",
    "filter.advanced": "AREA[Phase]PHASE3 AND AREA[LeadSponsorClass]INDUSTRY",
    "fields": "NCTId,BriefTitle,OverallStatus,PrimaryCompletionDate,EnrollmentCount",
}

for study in itertools.islice(iter_studies(session, params), 250):
    protocol = study["protocolSection"]
    status = protocol["statusModule"]
    print(
        protocol["identificationModule"]["nctId"],
        status.get("overallStatus"),
        status.get("primaryCompletionDateStruct", {}).get("date"),
        protocol.get("designModule", {}).get("enrollmentInfo", {}).get("count"),
    )

Read optional fields with .get(). A study with no enrollment figure or completion date simply omits that part of the record.

Errors and throttling

The OpenAPI specification documents these responses: 400 with a plain-text reason for a bad parameter, 404 for an unknown study, and 301 for an alias ID. It does not state a request limit, so this guide does not quote one.

What follows is what we see running a daily collector against the API for TrialRedline, not official guidance:

  • Heavy traffic can be answered with HTTP 429 or a 5xx status. Wait and retry with a growing delay.
  • Throttling can also show up as a redirect to an HTML error page that itself returns HTTP 200. If your client follows redirects and then calls a JSON parser, the failure looks like malformed JSON. Turn off redirect following and check that Content-Type contains json before parsing, as the script above does.
  • One request stream with a short pause between pages has been enough for us. Our collector waits at least 0.4 seconds between requests and asks for 100 studies per page.
  • Send a User-Agent that names your project and a contact address.

What the API does not give you: what changed

The documented endpoints return each study as it stands today. There is no endpoint that lists a study's earlier versions, and none that tells you a sponsor moved a primary completion date, cut an enrollment target or rewrote a primary outcome. LastUpdatePostDate tells you that a record changed, not which field or what the previous value was.

To get that from the registry API alone, you save a copy of each record on a schedule and compare every new copy with the one before it. You only capture changes from the day you start saving.

TrialRedline does this comparison for the trials it covers and publishes the result. Each change is one record with the field, the previous value, the new value, the date the registry posted it and a link to the source. Four fields are compared: primary completion date, enrollment, recruitment status and primary outcome measures.

curl "https://trialredline.com/api/v1/changes?ticker=ABCD&since=2026-09-01" \
  --header "Authorization: Bearer YOUR_API_KEY"

The response is a page of change records. The values below are illustrative, to show the shape:

{
  "data": [
    {
      "id": 1,
      "nct_id": "NCT00000000",
      "field": "primary_completion",
      "before": "2026-03-31",
      "after": "2026-09-30",
      "posted_date": "2026-09-12",
      "kind": "date_slip",
      "review_status": "factual",
      "source_url": "https://clinicaltrials.gov/study/NCT00000000"
    }
  ],
  "page": 1,
  "per_page": 50,
  "has_more": false,
  "attribution": "ClinicalTrials.gov; normalized by TrialRedline. Source dates and coverage are supplied per record."
}
GET /api/v1/changes
Recorded changes across covered trials, with optional ticker and since=YYYY-MM-DD filters.
GET /api/v1/trials/NCT_ID/changes
Recorded changes for one trial.
GET /api/v1/trials/NCT_ID/history
The stored versions of one trial, with a coverage note.
GET /api/v1/mappings
Verified links between trials, sponsors and company tickers.
GET /api/v1/events
Published FDA events from the FDA calendar, with source links and date precision.

What to know before you rely on it:

  • It covers company-sponsored Phase 2 and Phase 3 drug trials linked to US-listed companies, not the whole registry. For anything else, use the registry API above.
  • History is partial. Each trial's history response carries a coverage note, and the methodology page explains the gaps.
  • The API is read-only and part of the Pro plan, with 10,000 requests a month. List endpoints take page and per_page, up to 100 records a page.
  • You can read the same changes in a browser without an account. Open any trial from the trial directory to see its recorded changes from the last 12 months.

Full API and MCP server reference, with every endpoint, example responses and client setup.

See what Pro includes

Common questions

Is there an official ClinicalTrials.gov API?

Yes. The registry publishes a REST API at https://clinicaltrials.gov/api/v2, with an OpenAPI specification at https://clinicaltrials.gov/api/oas/v2. At the time of writing the API reports version 2.0.5.

Do I need an API key for the ClinicalTrials.gov API?

No key or login was needed for any request on this page, and the OpenAPI specification defines no authentication scheme. Send a User-Agent that identifies your script so the registry can contact you about problem traffic.

How many studies can one request return?

The pageSize parameter defaults to 10 and is reduced to 1,000 if you ask for more. To read past the first page, pass the nextPageToken from each response as pageToken on the next request.

How do I get studies updated since a date?

Search the LastUpdatePostDate area with a range expression, for example query.term=AREA[LastUpdatePostDate]RANGE[2026-09-01,MAX], and add sort=LastUpdatePostDate:desc to read the newest first.

Does the ClinicalTrials.gov API return earlier versions of a study?

The documented endpoints return the most recent version of each study. They do not list earlier versions or show which fields changed between two versions. To find changes you have to save each response and compare it with the next one yourself, or use a service that does.

Can I download results as CSV?

Yes. Add format=csv to a studies request. The fields parameter then takes CSV column names such as NCT Number, and the next page token arrives in the x-next-page-token response header instead of the body.

Sources

Every statement on this page was checked against these primary sources on 6 October 2026. Rules and programs change, so read the source before relying on a detail.

Related guides

What is a PDUFA date?

FDA complete response letters

Clinical trial terms explained