# Polygenic Scores API
> Polygenic (risk) scores as an API — powered by the NHGRI-EBI PGS Catalog, the open database of published polygenic scores: weighted combinations of genetic variants used to estimate a person's genetic predisposition to a trait or disease. Search traits by name to find their ontology ids, list every polygenic score developed for a trait, and read a score's full metadata — the reported and mapped (EFO/MONDO) traits, the number of variants in the score, the development method, genome build, the ancestry distribution of the samples it was built and evaluated on, the publication behind it (title, journal, date, PubMed id), the release date, license and a direct link to the scoring file. From breast cancer and coronary artery disease to type 2 diabetes and BMI, it is ideal for statistical genetics, genomics, risk-prediction research and bioinformatics tools. A polygenic-score / genetic-risk-prediction resource — distinct from single-variant association studies (GWAS Catalog), population allele frequencies (gnomAD) and clinical variant interpretation (ClinVar). Open data from the NHGRI-EBI PGS Catalog (CC BY 4.0).

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/pgs-api/..."
```

## Pricing
- **Free** (Free) — 2,750 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 53,500 calls/Mo, 8 req/s
- **Pro** ($23/Mo) — 258,000 calls/Mo, 20 req/s
- **Mega** ($60/Mo) — 905,000 calls/Mo, 50 req/s

## Endpoints

### Polygenic Scores

#### `GET /v1/score` — A polygenic score's metadata

**Parameters:**
- `id` (query, optional, string) — A PGS id Example: `PGS000001`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pgs-api/v1/score?id=PGS000001"
```

**Response:**
```json
{
    "data": {
        "score": {
            "id": "PGS000001",
            "url": "https://www.pgscatalog.org/score/PGS000001/",
            "name": "PRS77_BC",
            "method": "SNPs passing genome-wide significance",
            "traits": [
                {
                    "id": "MONDO_0004989",
                    "label": "breast carcinoma"
                }
            ],
            "license": "PGS obtained from the Catalog should be cited appropriately, and used in accordance with any licensing restrictions set by the authors. See EBI Terms of Use (https://www.ebi.ac.uk/about/terms-of-use/)",
            "ancestry": {
                "eval": {
                    "NR": 20,
                    "EUR": 80
                },
                "gwas": {
                    "EUR": 100
                }
            },
            "publication": {
                "id": "PGP000001",
                "date": "2015-04-08",
                "pmid": 25855707,
                "title": "Prediction of breast cancer risk based on profiling with common genetic variants.",
                "journal": "J Natl Cancer Inst"
            },
            "weight_type": null,
            "date_release": "2019-10-14",
            "genome_build": "NR",
            "scoring_file": "https://ftp.ebi.ac.uk/pub/databases/spot/pgs/scores/PGS000001/ScoringFiles/PGS000001.txt.gz",
            "trait_reported": "Breast cancer",
            "variants_number": 77,
            "variants_interactions":
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/search` — Find traits by name

**Parameters:**
- `q` (query, optional, string) — Trait/disease text Example: `breast cancer`
- `limit` (query, optional, string) — Max results (1-100, default 20)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pgs-api/v1/search?q=breast+cancer"
```

**Response:**
```json
{
    "data": {
        "count": 12,
        "query": "breast cancer",
        "total": 12,
        "traits": [
            {
                "label": "breast cancer",
                "trait_id": "MONDO_0007254",
                "description": "A primary or metastatic malignant neoplasm involving the breast. The vast majority of cases are carcinomas arising from the breast parenchyma or the nipple. Malignant breast neoplasms occur more frequently in females than in males. [NCIT: C9335]",
                "score_count": 0
            },
            {
                "label": "breast carcinoma",
                "trait_id": "MONDO_0004989",
                "description": "A carcinoma that arises from epithelial cells of the breast",
                "score_count": 144
            },
            {
                "label": "breast tumor luminal A or B",
                "trait_id": "MONDO_0004990",
                "description": "Subsets of breast carcinoma defined by expression of genes characteristic of luminal epithelial cells. [NCIT: C53554] [NCIT: C53555]",
                "score_count": 0
            },
            {
                "label": "estrogen-receptor negative breast cancer",
                "trait_id": "MONDO_0006513",
                "description": "A subtype of breast cancer that is estrogen-receptor negative [EFO: 1000650]",
                "score_count": 11
            },
            {
                "label": "estrogen-receptor positive breast cancer",
          
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/trait` — A trait and its polygenic scores

**Parameters:**
- `id` (query, optional, string) — Ontology trait id (from /v1/search) Example: `MONDO_0004989`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pgs-api/v1/trait?id=MONDO_0004989"
```

**Response:**
```json
{
    "data": {
        "trait": {
            "url": "http://purl.obolibrary.org/obo/MONDO_0004989",
            "label": "breast carcinoma",
            "trait_id": "MONDO_0004989",
            "score_ids": [
                "PGS000001",
                "PGS000004",
                "PGS000007",
                "PGS000015",
                "PGS000028",
                "PGS000029",
                "PGS000045",
                "PGS000050",
                "PGS000051",
                "PGS000052",
                "PGS000072",
                "PGS000153",
                "PGS000317",
                "PGS000332",
                "PGS000335",
                "PGS000344",
                "PGS000345",
                "PGS000472",
                "PGS000473",
                "PGS000474",
                "PGS000475",
                "PGS000476",
                "PGS000477",
                "PGS000478",
                "PGS000479",
                "PGS000480",
                "PGS000481",
                "PGS000482",
                "PGS000483",
                "PGS000484",
                "PGS000485",
                "PGS000486",
                "PGS000487",
                "PGS000488",
                "PGS000489",
                "PGS000490",
                "PGS000491",
                "PGS000492",
                "PGS000493",
                "PGS000494",
                "PGS000495",
                "PGS000496",
                "PGS000497",
                "PGS000498",
             
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Endpoint catalogue & notes

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pgs-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "The PGS Catalog is the open database of published polygenic scores (PGS) — weighted sets of genetic variants used to estimate a person's genetic predisposition to a trait or disease. /v1/search?q=breast cancer = find traits by free text, returning matching ontology trait ids (e.g. MONDO_0004989), labels and how many scores exist for each; /v1/trait?id=MONDO_0004989 = a trait's details and the list of polygenic score ids developed for it; /v1/score?id=PGS000001 = a single score's metadata — its name, the reported and mapped (EFO/MONDO) traits, the number of variants, the development method, genome build, ancestry distribution of the samples, the publication behind it (title, journal, date, PubMed id), release date, license and a link to the scoring file. PGS ids look like PGS000001; trait ids are EFO/MONDO/HP/Orphanet identifiers (get them from /v1/search). Data from the NHGRI-EBI PGS Catalog (CC BY 4.0). A polygenic-score / genetic-risk-prediction resource — distinct from single-variant association (GWAS Catalog), population allele frequencies (gnomAD) and clinical variant interpretation (ClinVar). Ideal for statistical genetics, genomics, risk-prediction research and bioinformatics tools.",
        "source": "PGS Catalog — Polygenic Score Catalog, EMBL-EBI (pgscatalog.org)",
        "endpoints": [
            "/v1/search",
            "/v1/trait",
            "/v1/score",
            "/v1/meta"
        ]
    },
    "meta": {
        "
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/pgs-api
OpenAPI spec: https://www.oanor.com/api/pgs-api/openapi.json
