# Search PubTator3

Search and read PubTator3 records through the Assyro API: which genes, chemicals, diseases and variants PubMed articles relate to each other (treat, cause…

Source: https://www.assyro.com/docs/sources/pubtator

`GET https://api.assyro.com/v1/sources/pubtator/search`

> **Note:** Preview: `api.assyro.com` is not serving production data yet. This page follows the API's published description and may change before launch.

Search and read PubTator3 records from your own code: which genes, chemicals, diseases and variants PubMed articles relate to each other (treat, cause, associate, inhibit, stimulate, interact...), how many articles state each relation, and their PMIDs, text-mined by NCBI. Published by National Center for Biotechnology Information (NLM, NIH) ([www.ncbi.nlm.nih.gov/research/pubtator3](https://www.ncbi.nlm.nih.gov/research/pubtator3/)); answered from Assyro's copy, refreshed weekly Thursday 11:30 UTC.

> **Warning:** Attribution required: every record carries `attribution`. Show it wherever you show the data: "Source: PubTator3, National Center for Biotechnology Information (NCBI), U.S. National Library of Medicine (https://www.ncbi.nlm.nih.gov/research/pubtator3/)." See the [terms](https://ftp.ncbi.nlm.nih.gov/pub/lu/PubTator3/README.txt).

Example: "What diseases do articles say metformin treats, and how many articles say so?"

## Search

`GET https://api.assyro.com/v1/sources/pubtator/search` with any of these query parameters. Repeat a parameter for a list (`?phase=PHASE2&phase=PHASE3`). An unknown parameter is refused by name.

### Search parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `query` | string | no | Names of the entities, every word required, e.g. "metformin breast cancer" or "BRCA1". |
| `entity` | string | no | A concept id on either side: "MESH:D008687" (chemical or disease), "5468" (NCBI Gene), "rs4986172" (variant). |
| `otherEntity` | string | no | A second concept id: keep only relations between `entity` and this one. |
| `relationType` | string | no | Keep relations of this type. One of: `associate`, `cause`, `compare`, `cotreat`, `drug_interact`, `inhibit`, `interact`, `negative_correlate`, `positive_correlate`, `prevent`, `stimulate`, `treat`. |
| `entityType` | string | no | Keep relations with a gene, chemical, disease or variant on one side, e.g. "gene" for the genes related to a drug. One of: `gene`, `chemical`, `disease`, `variant`. |
| `minArticles` | integer | no | Keep relations stated in at least this many articles. |
| `limit` | integer | no | Relations to return, default 10. |
| `offset` | integer | no | Skip this many results (for paging), default 0. |

Each result is a record; read one in full with [Get a record](https://www.assyro.com/docs/sources/pubtator/records).

## What a record holds

- `id`, `title`, `url`: the source's identifier, its title and its page at the source, to verify it.
- `authority`, `publishedDate`, `version`: who published it, when, and the edition read.
- `snippet` and `fields`: the matching text and the source's own fields.
- `asOf`: the day Assyro's copy of the source was read.
- `attribution`: the attribution the licence requires.

## Example request

curl:

```bash
curl "https://api.assyro.com/v1/sources/pubtator/search?query=metformin&relationType=treat&entityType=disease"
```

Python:

```python
import requests

response = requests.get(
    "https://api.assyro.com/v1/sources/pubtator/search",
    params={
        "query": "metformin",
        "relationType": "treat",
        "entityType": "disease"
    },
)
response.raise_for_status()
print(response.json())
```

JavaScript:

```javascript
const response = await fetch("https://api.assyro.com/v1/sources/pubtator/search?query=metformin&relationType=treat&entityType=disease");
const result = await response.json();
```
