# ClinicalTrials.gov — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search and retrieve comprehensive information about clinical trials worldwide, including study details, eligibility criteria, locations, and outcomes data. Access structured metadata and statistics to find relevant research studies matching your specific medical conditions or research interests.

**Category:** Healthcare | **Website:** [clinicaltrials.gov/](https://clinicaltrials.gov/) | **Docs:** [parse.bot/marketplace/a3a61d39-12ed-4317-a5a1-1aa169f5a77f/clinicaltrials-gov-api](https://parse.bot/marketplace/a3a61d39-12ed-4317-a5a1-1aa169f5a77f/clinicaltrials-gov-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_api_version

Retrieve the current API version identifier and the ISO timestamp of the last data refresh. Useful for verifying API availability and data currency.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/get_api_version \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_enums

Retrieve valid values for all categorical/enumeration fields in the ClinicalTrials.gov data model. Each entry contains the enum type name, its accepted values (with optional legacy display values), and the data pieces (fields) that use that enum.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/get_enums \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_search_areas

Retrieve the mapping between search query parameters and their underlying data fields with weights. Each search area group contains named areas (e.g. BasicSearch, ConditionSearch) that define which data pieces are searched and their relative weight.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/get_search_areas \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_stats_size

Retrieve aggregate database size and distribution statistics including total number of studies, average record size in bytes, percentile breakdown of record sizes, size range distribution histogram, and the largest studies by byte size.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/get_stats_size \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_studies_metadata

Retrieve the hierarchical data model and field definitions for the study record structure. Returns a recursive tree describing every field available in study records, including name, piece identifier, title, type, sourceType, description, rules, and children.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/get_studies_metadata \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_study

Retrieve full details for a single clinical trial by its NCT ID. Returns the complete protocolSection (identification, status, sponsor, description, design, outcomes, eligibility, contacts), derivedSection (condition/intervention browse modules), resultsSection (participant flow, baseline, outcome measures, adverse events — present only when hasResults is true), and hasResults flag.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `nctId` | string | Yes | NCT identifier in format 'NCTxxxxxxxx' (e.g. 'NCT04516746') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/get_study \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"nctId":"<string>"}'
```

### list_all_studies

Bulk retrieve studies with automatic internal cursor-based pagination. Iterates pages until the requested limit is reached. Returns a flat array of study objects and the count of studies actually returned.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `fields` | string | No | Comma-separated list of fields to return (e.g. 'NCTId,BriefTitle') |
| `limit` | integer | No | Maximum number of studies to retrieve (default 100) |
| `pageSize` | integer | No | Number of results per internal API page (max 1000, defaults to min of limit and 1000) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/list_all_studies \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fields":"<string>","limit":"<integer>","pageSize":"<integer>"}'
```

### search_studies

Search for clinical trials with extensive filtering and cursor-based pagination. Supports condition, intervention, status filters, and general keyword search. Returns paginated results with a nextPageToken for fetching subsequent pages. Each study includes protocolSection (identification, status, description, design, eligibility), derivedSection (condition/intervention browse), and hasResults flag.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `fields` | string | No | Comma-separated list of fields to return (e.g. 'NCTId,BriefTitle,OverallStatus') |
| `filter_advanced` | string | No | Advanced filter expression using Essie expression syntax (e.g. 'AREA[Phase]PHASE3') |
| `filter_overallstatus` | string | No | Filter by study status. Accepted values: RECRUITING, COMPLETED, ACTIVE_NOT_RECRUITING, NOT_YET_RECRUITING, ENROLLING_BY_INVITATION, SUSPENDED, TERMINATED, WITHDRAWN, UNKNOWN. Multiple values pipe-separated (e.g. 'RECRUITING\|COMPLETED'). |
| `format` | string | No | Response format: 'json' or 'csv' |
| `pageSize` | integer | No | Number of results per page (max 1000) |
| `pageToken` | string | No | Token for next page of results, obtained from a previous response's nextPageToken |
| `query_cond` | string | No | Search by condition or disease (e.g. 'diabetes', 'cancer') |
| `query_intr` | string | No | Search by intervention or treatment (e.g. 'aspirin', 'immunotherapy') |
| `query_term` | string | No | General search terms across all fields |
| `sort` | string | No | Sort order. Use '@relevance' for relevance-based sorting, or a field name with :asc or :desc suffix (e.g. 'LastUpdatePostDate:desc') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-clinicaltrials-gov-api-a3a61d39/search_studies \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fields":"<string>","filter_advanced":"<string>","filter_overallstatus":"<string>","format":"<string>","pageSize":"<integer>","pageToken":"<string>","query_cond":"<string>","query_intr":"<string>","query_term":"<string>","sort":"<string>"}'
```
