# Research papers

Cormorant finds scholarly papers across the open sources at once and gives
you one record per paper, whichever source you found it through. It knows
each paper's identifiers, authors, venue, versions and every open copy, with
the licence of each copy.

| Source | What it adds | Licence of the data |
|---|---|---|
| arXiv | Preprints in physics, mathematics, computer science and more | Metadata CC0; each paper its own licence |
| PubMed Central / Europe PMC | Life-science articles, PMIDs and PMCIDs | Per article (the open-access subset is CC) |
| PLOS | Every PLOS journal article, full text as JATS | CC BY 4.0 |
| DOAJ | Open-access journals and their articles | Metadata CC0 |
| HAL | French open archive | Per deposit |
| Zenodo | Research outputs and datasets | Per record |
| Crossref | DOI metadata for every publisher, retractions | Metadata facts, no licence needed |
| OpenAlex | The scholarly graph: works, authors, institutions | CC0 |

SSRN and Google Scholar are **link-only**: their terms forbid automated
access, so Cormorant never contacts them. An SSRN paper is still found by its
DOI (`10.2139/ssrn.<id>`) through Crossref and OpenAlex, with a link to SSRN.
bioRxiv, medRxiv, OpenReview (ICLR, NeurIPS, TMLR) and the ACL Anthology
come from Cormorant's own copies of those sources, refreshed every night
(OpenReview and the Anthology weekly). A paper retracted per Crossref answers
`retracted: true`.

## 1. Search

```sh
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/papers/search?q=protein+folding+language+model&from_year=2022"
```

Every source is asked at the same time, inside a few seconds. A slow, busy
or failing source never fails the request: `sources_status` says what each
one did (`ok`, `empty`, `timeout`, `busy`, `budget`, `error`, `off`) and
`partial` is `true` when one did not answer. A partial answer is not cached,
so asking again later can give more. Choose the sources with
`sources=arxiv,plos` (ids from `GET /v1/papers/sources`); `store` is
Cormorant's own paper store.

Filters: `from_year`, `to_year`, `type` (`preprint`, `article`,
`proceedings`, `review`, `dataset`), `oa=true` (only papers with an open
copy) and `fulltext=true` (only papers whose full text Cormorant serves).

## 2. Look a paper up

```sh
curl -s -H "Authorization: Bearer $KEY" "https://api.cormorant.ch/v1/papers/arXiv:1706.03762"
```

Any of these work, bare or as the paper's page address:

| Scheme | Example |
|---|---|
| DOI | `10.1371/journal.pone.0123456`, `https://doi.org/…` |
| arXiv | `arXiv:2301.01234`, `2301.01234v2`, `hep-th/9901001`, `https://arxiv.org/abs/…` |
| PubMed Central | `PMC1234567` |
| PubMed | `PMID:31452104` |
| HAL | `hal-01234567` |
| Zenodo | `https://zenodo.org/records/1234567` |
| OpenAlex | `W2741809807` |
| Cormorant | `pap_…` |

bioRxiv, medRxiv, SSRN and PLOS page addresses are read as their DOI. The
answer has Cormorant's id (`pap_…`), which stays the same: when two records
turn out to be one paper, the older id is kept and the other one keeps
working. A record is answered from the store for up to a week
(`cached: true`); after that the sources are asked again.

Errors: `422 invalid_paper_id`, `404 paper_not_found`, and `410
paper_removed` with a `notice` for a paper taken down (retracted, withdrawn
or on request).

## 3. Resolve a reference list

```sh
curl -s -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"items": ["10.1038/s41586-020-2649-2", "Vaswani et al. 2017, arXiv:1706.03762", "PMC1234567"]}' \
  "https://api.cormorant.ch/v1/papers/resolve"
```

Up to 500 identifiers, addresses or citation strings. A DOI, arXiv id or
PMCID inside a citation is used. Each item answers its `paper` or an
`error`; the request succeeds as a whole.

### Larger lists: export as a job

```sh
curl -s -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"ids": ["10.1038/s41586-020-2649-2", "arXiv:1706.03762"], "fulltext": true, "idempotency_key": "reading-list-1"}' \
  "https://api.cormorant.ch/v1/papers/batch"
```

Up to 50,000 papers in one job. Each is read as `GET /v1/papers/{id}`, and
with `fulltext: true` it also gets its full text by section, but only where a
copy's licence allows reuse. Every other paper comes with its metadata,
abstract and links, and `fulltext_error: licence_restricted`. Follow the job
with `GET /v1/jobs/{job_id}` (or `callback_url`), then download every item as
JSON Lines from `GET /v1/papers/batch/{job_id}/export` (`status=failed` for
the ones that failed). Each item is charged as the single routes are; the
download is not charged.

## 4. Read the full text

```sh
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/papers/PMC1234567/fulltext?format=markdown"
```

The text comes by section (abstract, introduction, methods …) with the
figure and table captions and the reference list, from the paper's best copy
whose licence allows reuse: JATS XML first, then HTML, then PDF. `outline`
says where each section starts; read a long paper in parts with `offset`
and `max_chars` (up to 200,000), following `next_offset`. A paper whose
copies are all non-commercial, no-derivatives or unlicensed answers `403
licence_restricted` with `links` to read it at the source; that refusal is
not charged.

## 5. More about a paper

| Route | What it answers |
|---|---|
| `GET /v1/papers/{id}/versions` | A preprint's versions with dates and pages, and where it was published (the journal DOI, or the conference with its decision) |
| `GET /v1/papers/{id}/files` | Every PDF, JATS and HTML copy, and each file of a Zenodo record (datasets, code) with its size and checksum |
| `GET /v1/papers/{id}/reviews` | OpenReview's public reviews, meta-reviews, decision and rebuttals. Reviewers stay anonymous |
| `GET /v1/papers/{id}/references` | The papers it cites, in its order (OpenAlex; OpenCitations by DOI when OpenAlex does not link it) |
| `GET /v1/papers/{id}/citations` | The papers citing it, newest first, page by page with `next_cursor` |
| `GET /v1/papers/{id}/related` | Papers related to it, best first |
| `GET /v1/papers/venues/iclr/2024` | Every accepted paper of a conference year (`iclr`, `neurips`, `tmlr`, `acl`, `emnlp`, `naacl`, `findings` …) |
| `GET /v1/papers/authors/{orcid}/works` | An author's works by ORCID iD, newest first: a bibliography, no metrics on the person |
| `GET /v1/papers/changes` | Papers added or changed since your last call, for keeping a copy in sync: follow `next_cursor`; when it is `null`, keep your last cursor and ask again later |

### Semantic Scholar and CORE on your own key

Semantic Scholar's API licence and CORE's commercial terms do not let
Cormorant pass on its own access, so both run only on your key. Add it in
your account (provider `semantic_scholar` or `core`, `PUT
/v1/account/providers/{provider}`), and searches ask them too;
`source=semantic_scholar` on `references` and `citations` asks Semantic
Scholar. What they answer goes to you only: it is not kept in Cormorant's
paper store, and their copies are link only.

## 6. Watch a paper or a search

```sh
curl -s -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"target": {"paper": "arXiv:2401.01234"}, "schedule": {"interval": "P1D"}}' \
  "https://api.cormorant.ch/v1/watches"
```

A paper watch raises `new_version`, `published` (it appeared in a journal,
or a conference decided), `retracted`, `withdrawn` and `review_added` (a new
OpenReview note). `{"papers_query": "protein language model"}` raises
`paper_added` for each new matching paper that enters Cormorant's store,
which the nightly mirrors fill. Events come from `GET /v1/watches/events`
or your webhook, as for every watch.

## Licences and full text

Every copy in `locations` carries its `licence` (an SPDX id such as
`CC-BY-4.0`) and its `reuse` class:

- `commercial`: CC0, CC BY, CC BY-SA. Cormorant may serve the full text
  (`fulltext: true`).
- `non_commercial`, `no_derivatives`: CC BY-NC, CC BY-ND and their mixes.
  Link only: follow `url` and read it under its licence.
- `link_only`: arXiv's own licence, publisher terms, or a licence Cormorant
  cannot read. Link only.

Keep the `attribution` line when you show an arXiv record ("Thank you to
arXiv for use of its open access interoperability").

## Journals

`GET /v1/papers/journals/{issn}` answers DOAJ's record for an open-access
journal: its licence, APC, publisher and seal. `404` means DOAJ does not list
it.

## Charges

| Meter | Standard price |
|---|---|
| `papers_search` | 0.002 per search |
| `papers_lookup` | not charged |
| `papers_fulltext` | 0.002 per full text |
| `papers_cached` | 0.0005 per answer from the paper store or cache |

A resolve or an export counts one lookup per paper found (and a full text
per full text read). Versions, files, reviews and an
author's works count as lookups, a page of a venue or of changes as one
`papers_cached`, and a full text read again from the cache (a later part, say)
as `papers_cached`. An account can switch
Research papers off in the control center (`403 feature_disabled`).
