# /ictrp/trials/search

`POST /api/ictrp/trials/search`

Price: 20 credits

Search the WHO ICTRP meta-registry across every registry in the WHO network. Narrows by health condition, title, intervention, primary sponsor, registered secondary identifier, recruitment status, trial phase, the results, rare-disease, COVID-19 and clinical-trial flags, and the registration date. The portal exposes no country filter that its backend honours, so a geography is narrowed after the fact from the `countries` field of ictrp/trials. The registration-date bounds are matched against every registration grouped onto a result, so a result's own `registration_date` can fall outside that window; narrow strictly on that field if the window has to be exact. Each result carries the trial id, its title, recruitment status, registration date, and the ids of the cross-registrations grouped onto the same trial.

## How to use it

This is the widest trial search available here — it covers ClinicalTrials.gov, the EU registers and roughly a dozen national ones at once — but each hit is a summary, so follow an interesting id to ictrp/trials, or to clinicaltrials, euctis or eudract when the id belongs to one of those. `secondary_id` is a loose text match over registered cross-references rather than an exact id lookup, so a EudraCT or NCT number there widens the result set instead of pinning one trial; pass the id to ictrp/trials for that. One result row can group several registrations of the same trial, and `grouped_ids` holds the siblings.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `condition` (string, nullable) — Text matched against the health condition under study (examples: "breast cancer"; minLength: 1)
- `trial_title` (string, nullable) — Text matched against the trial title (examples: "melanoma"; minLength: 1)
- `intervention` (string, nullable) — Text matched against the intervention (examples: "metformin"; minLength: 1)
- `sponsor` (string, nullable) — Text matched against the primary sponsor (examples: "Pfizer"; minLength: 1)
- `secondary_id` (string, nullable) — Text matched against the registered secondary identifiers of a trial (examples: "NCT00841061"; minLength: 1)
- `recruitment_status` (string) — Restrict to recruiting or non-recruiting trials (default: "all"; one of: "all", "recruiting")
- `phase` (string, nullable) — Keep trials in this phase (one of: "phase_0", "phase_1", "phase_2", "phase_3", "phase_4")
- `with_results_only` (boolean) — Keep only trials whose register reports results (default: false)
- `rare_diseases_only` (boolean) — Keep only trials flagged as rare-disease trials (default: false)
- `covid_only` (boolean) — Keep only COVID-19 trials (default: false)
- `clinical_only` (boolean) — Keep only the records the portal classifies as clinical trials (default: false)
- `registered_from` (string, nullable) — Keep trials with a registration on or after this date, YYYY-MM-DD. The bound is matched against every registration grouped onto a result, so a result's own registration_date can fall outside that window (examples: "2020-01-01")
- `registered_to` (string, nullable) — Keep trials with a registration on or before this date, YYYY-MM-DD. The bound is matched against every registration grouped onto a result, so a result's own registration_date can fall outside that window (examples: "2020-12-31")
- `count` (integer, required) — Number of trials to return (min: 1; max: 3000)

## Response

### 200 — Successful Response

- `@type` (string) (default: "IctrpSearchTrial")
- `id` (string, required)
- `url` (string) (default: "")
- `recruitment_status` (string, nullable)
- `registration_date` (string, nullable)
- `grouped_ids` (array) (default: [])

## Errors

### 422 — Validation Error

A date field was not YYYY-MM-DD.

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

No trial in the ICTRP portal matched those filters.

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

