# Research library API

Read-only search over the research library: about 12.7M papers in the core tiers (graphics and the fields closest to
it: vision, signal processing, numerical analysis, HCI, hardware and more) with abstracts and their citations, 80M
papers in 53 other fields (physics, optics, astronomy, atmospheric science, materials, medicine, statistics,
operations research, control, acoustics and more), 1.1M further arXiv papers, and all of OpenAlex (476M works) for
looking papers up. No key is needed; each address may make 1200 requests a minute. Every answer is JSON.

## References

A paper is named by `lib:<id>` (a library paper), a DOI (`10.1145/...` or `doi:...`), an OpenAlex id (`W2108713782`
or `oa:W...`), an arXiv id (`2101.00001`, `cond-mat/0505406` before 2007, or `arxiv:...`), or `url:<link>` for a talk or page outside any library.
Lists show papers briefly: `{"ref", "title", "year", "venue", "cited_in_library"}`.

## Endpoints

- `GET /search?q=<query>&n=20&offset=0`: keyword search over the core tiers' titles, abstracts and keywords.
  The query is SQLite FTS5: `"exact phrase"`, `AND`, `OR`, `NOT`, `prefix*`. Ranked by relevance.
  `&in=fulltext` searches the 36,199 full texts instead and says where each paper's text came from (the text
  itself is not served).
- `GET /similar?q=<text>&scope=graphics&n=10`: semantic search, by meaning rather than words. Scopes:
  - `graphics`: the 811,669 papers of the graphics library;
  - `core`: all core tiers;
  - `side`: the 53 other fields (describe the problem without graphics words to find mechanisms elsewhere);
  - `arxiv`: arXiv papers in none of the tiers above;
  - `all`: core, side and arxiv together.
  `like=<ref>` instead of `q` finds papers close to that paper. Each result has a `score` (cosine similarity;
  scores are comparable within a scope, not across `graphics` and the others).
- `POST /similar` with `{"queries": ["...", ...], "scope": "side", "n": 10}`: up to 100 queries at once;
  `results` lists each query's papers in order.
- `GET /papers/<ref>`: one paper: abstract, authors, links, what it cites and what cites it in the library, its
  references outside the library, and its full-text sources. A paper outside the core tiers is looked up in OpenAlex
  or arXiv (a few seconds).
- `POST /papers` with `{"refs": [...]}`: up to 1000 references resolved briefly at once: a library paper becomes
  `lib:<id>` with its title; a DOI, OpenAlex or arXiv id the library lacks stays as written, with `"external": true`.
- `GET /health`: what is loaded.

`n` is at most 200. Results are ranked, never filtered: nothing is left out for looking less relevant.

## Examples

    curl "https://library.mirari.sh/search?q=%22blue+noise%22+AND+dithering&n=5"
    curl "https://library.mirari.sh/similar?q=reuse+expensive+estimates+across+time+when+the+signal+changes+slowly&scope=side"
    curl "https://library.mirari.sh/papers/10.1145/37401.37422"
