---
title: "Search Medical Papers"
method: POST
path: "/v2/datasets/scientific/medical/ask"
tags: ["datasets"]
---

# Search Medical Papers

`POST /v2/datasets/scientific/medical/ask`

Search medical and biomedical papers with a natural-language question.
Federates PubMed, PMC full-text, ClinicalTrials.gov, and Semantic Scholar,
then synthesizes a cited answer.

Implementation: invokes the `medical-agent` Lambda (TypeScript, Mastra,
Claude Sonnet). Streaming responses flow through the `captain-stream` S2
basin — identical pattern to `/v2/collections/{name}/query`.

## Request body

- ScientificAskRequest — Request body for POST /v2/datasets/scientific/medical/ask
  - `include_trials` boolean — Whether the agent may call ClinicalTrials.gov.
  - `max_sources` integer — Target number of cited sources in the final answer.
  - `question` string, required — Natural-language question.
  - `recency_years` integer, nullable — Prefer evidence within the last N years where the question allows.
  - `stream` boolean — If true, response is text/event-stream; otherwise JSON.

## Response `200`

Synthesized answer with cited sources. Returns JSON by default; when `stream=true` the response is `text/event-stream` with `tool.start`, `tool.end`, `text.delta`, and `run.end` events.

- ScientificAskResponse — Response for POST /v2/datasets/scientific/medical/ask (non-streaming).
  - `answer` string, required — Synthesized answer with inline citations.
  - `domain` string, required — The scientific domain, e.g. 'medical'.
  - `gaps` string[] — Things the agent could not find or verify.
  - `latency_ms` integer — End-to-end wall-clock latency.
  - `sources` ScientificSource[]
    - `title` string, nullable
    - `url` string, required
    - `snippet` string, nullable
    - `dataset` string, nullable
    - `published_at` string, nullable
    - `authors` string[], nullable
    - `metadata` object, nullable
  - `tool_calls` integer — Number of tool calls the agent made.

## Other responses

- `400` — Malformed body or input validation error.
- `401` — Missing or invalid API key.
- `403` — API key does not belong to the organization, datasets access disabled, or trial/billing limits exceeded.

---

[API](https://skmtc.dev/runcaptain/apis/api-reference.md) · [All operations](https://skmtc.dev/runcaptain/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/runcaptain/api-reference/revisions/fe4649e3f4aa/schema)
