Run a search
const url = 'https://api.aptrouter.com/v1/search';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"query":"statins and breast cancer survival","limit":5}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.aptrouter.com/v1/search \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "query": "statins and breast cancer survival", "limit": 5 }'Returns up to limit verbatim-cited results for query. Each result is
the highest-scoring source sentence plus its identifier and metadata.
Debits 1 prepaid credit ($0.005) from the key’s balance; if the search
produces no usable result (server error or timeout) the credit is
refunded. Requires Content-Type: application/json.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
The search query. Tokenised FTS + dense retrieval; not a boolean DSL.
Max results to return (clamped to 1–50).
Comma-separated opt-in heavier fields. Currently only abstract
(adds the full ab field to each result). Default omits it to stay
token-lean.
Examples
Minimal query
{ "query": "statins and breast cancer survival", "limit": 5}Opt in to full abstracts
{ "query": "quantum error correction surface codes", "limit": 3, "fields": "abstract"}Responses
Section titled “ Responses ”Search results.
object
Number of results returned.
Corpus confidence — cosine similarity (0–1) of the best local
semantic match. A low value means the local index had nothing close,
so a fallback lane was used (see each result’s src).
One result. Keys are abbreviated to minimise tokens.
object
Identifier — DOI (or source id) of the document.
Title.
Publication year (0 if unknown).
Authors (first few).
Relevance score in [0,1], rounded to 3 decimals.
The verbatim cited sentence(s) — quotable as-is.
Full abstract. Present only when fields=abstract was requested.
Provenance of this result: corpus (the local scholarly index), or
the fallback lane that served it — arxiv, semantic_scholar, or web.
Examples
{ "n": 2, "c": 0.871, "results": [ { "d": "MED-10", "t": "Statin Use and Breast Cancer Survival: A Nationwide Cohort Study from Finland", "y": 2014, "a": [ "Murtola TJ", "Visvanathan K" ], "s": 1, "q": "Recent studies have suggested that statins could delay or prevent breast cancer recurrence but the effect on disease-specific mortality remains unclear.", "src": "corpus" }, { "d": "MED-14", "t": "Statin use after diagnosis of breast cancer and survival: a population-based cohort study.", "y": 2016, "a": [ "Smith A" ], "s": 0.984, "q": "Preclinical studies have shown that statins can prevent growth in breast cancer cell lines and animal models.", "src": "corpus" } ]}Headers
Section titled “Headers ”Estimated token count of this response body (~4 chars/token).
Prepaid credits remaining after this call’s debit.
Invalid request: empty query (empty query), query longer than 2048
characters (query too long), or limit of 0 (limit must be >= 1).
Example
empty queryMissing, invalid, or revoked API key.
Example
invalid or revoked api keyPrepaid credit balance is zero. Top up in the dashboard to continue.
Example
insufficient credit balance — top up to continueHeaders
Section titled “Headers ”Request body was sent without Content-Type: application/json.
Example
Expected request with `Content-Type: application/json`Per-key burst rate limit exceeded, or too many concurrent in-flight
requests for this key. Honour Retry-After.
Example
rate limit exceededHeaders
Section titled “Headers ”Internal error (the charged credit is automatically refunded).
The server is shedding load (global in-flight cap reached). Honour Retry-After.
Example
server at capacity, retry shortlyHeaders
Section titled “Headers ”The search exceeded the per-request wall-clock timeout (credit refunded).
Example
search timed out