# 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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/clinicaltrials-gov/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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/credits/clinicaltrials-gov/get-api-version \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/get-enums \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/get-search-areas \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/get-stats-size \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/get-studies-metadata \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/get-study \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/list-all-studies \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/clinicaltrials-gov/search-studies \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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>"}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.