# Open Targets Platform Scraper (`parseforge/opentargets-scraper`) Actor

Query Open Targets Platform GraphQL API for targets (genes), diseases, or drugs and return rich associations including drugs by disease, known drugs, indications, mechanisms of action, pathways, tractability and genetic constraint. No API key required.

- **URL**: https://apify.com/parseforge/opentargets-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Education, Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $29.25 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

![ParseForge Banner](https://github.com/ParseForge/apify-assets/raw/main/banner.jpg)

## 🎯 Open Targets Platform Scraper

> 🚀 **Export drug-target-disease associations in seconds.** Query the **Open Targets Platform GraphQL API** across targets, diseases, drugs, and free-text search. No API key, no registration, no manual GraphQL stitching.

> 🕒 **Last updated:** 2026-05-13 · **📊 4 entity modes** · **🧬 60,000+ targets** · **🦠 26,000+ diseases** · **💊 13,000+ drugs** · **🌐 EBI GraphQL API**

The **Open Targets Platform Scraper** queries the [Open Targets v4 GraphQL API](https://api.platform.opentargets.org/api/v4/graphql) and returns rich, joined records for **targets (genes), diseases, drugs, and free-text search**. Open Targets is a public-private partnership between EMBL-EBI, GSK, Sanofi, Bristol Myers Squibb, Pfizer, Genentech, MSD, and the Wellcome Sanger Institute that integrates genetics, genomics, transcriptomics, drug, and literature evidence into target-disease association scores used across drug discovery.

This Actor exposes **four query modes in one input form**: pull a target by Ensembl ID (or HGNC symbol), a disease by EFO / MONDO ID, a drug by ChEMBL ID, or a free-text search across all three. Each record returns the canonical ID, name, descriptive metadata, and the relevant association table (associated diseases, associated targets, mechanisms of action, indications, drug warnings).

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Drug discovery teams, target ID scientists, computational biologists, bioinformaticians, regulatory analysts, journal editors, ML researchers | Target prioritization, drug repurposing, disease-target maps, ChEMBL-to-EFO joins, indication discovery, mechanism-of-action audits, ML feature engineering |

---

### 📋 What the Open Targets Scraper does

Four query modes in a single Actor:

- 🧬 **Target mode.** Fetch by Ensembl gene ID (e.g. `ENSG00000146648` for EGFR), or by HGNC symbol that the Actor resolves via the GraphQL search hit. Returns approvedSymbol, approvedName, biotype, function descriptions, hallmarks, tractability modalities, pathways, the top associated diseases (scored), and the drug + clinical-candidate table.
- 🦠 **Disease mode.** Fetch by EFO or MONDO ID (e.g. `EFO_0000222` for Acute Myeloid Leukemia). Returns description, therapeutic areas, synonyms, parents, children, the top associated targets (scored), and the drug + clinical-candidate table.
- 💊 **Drug mode.** Fetch by ChEMBL ID (e.g. `CHEMBL1201583`). Returns description, drug type, maximum clinical stage, synonyms, trade names, cross-references, mechanisms of action with target objects, indications with diseases, drug warnings, and parent molecule.
- 🔎 **Search mode.** Free-text search across target + disease + drug. Returns one row per hit with entity type, ID, name, description, and relevance score.

> 💡 **Why it matters:** Open Targets is the canonical public source for evidence-based target prioritization in pharma. Building your own GraphQL queries means schema introspection, pagination plumbing, and constant rewrites. This Actor returns ready-joined records on every run.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded target-disease dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td><code>mode</code></td><td>enum</td><td><code>"target"</code></td><td>One of <code>target</code>, <code>disease</code>, <code>drug</code>, <code>search</code>.</td></tr>
<tr><td><code>maxItems</code></td><td>integer</td><td><code>10</code></td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
<tr><td><code>ensemblId</code></td><td>string</td><td><code>"ENSG00000146648"</code></td><td>For target mode. EGFR by default.</td></tr>
<tr><td><code>symbol</code></td><td>string</td><td><code>""</code></td><td>For target mode. HGNC symbol fallback resolved via search.</td></tr>
<tr><td><code>efoId</code></td><td>string</td><td><code>"EFO_0000222"</code></td><td>For disease mode. EFO or MONDO ID.</td></tr>
<tr><td><code>chemblId</code></td><td>string</td><td><code>"CHEMBL1201583"</code></td><td>For drug mode. ChEMBL drug ID.</td></tr>
<tr><td><code>searchQuery</code></td><td>string</td><td><code>""</code></td><td>For search mode. Free-text query string.</td></tr>
<tr><td><code>searchEntities</code></td><td>string[]</td><td><code>[]</code></td><td>For search mode. Restrict to <code>target</code>, <code>disease</code>, or <code>drug</code>. Empty = all three.</td></tr>
</tbody>
</table>

**Example: target mode for EGFR with associated diseases.**

```json
{
    "mode": "target",
    "ensemblId": "ENSG00000146648",
    "maxItems": 50
}
````

**Example: free-text search across targets and diseases for "cancer".**

```json
{
    "mode": "search",
    "searchQuery": "cancer",
    "searchEntities": ["target", "disease"],
    "maxItems": 25
}
```

> ⚠️ **Good to Know:** target mode accepts either `ensemblId` or `symbol`. When you provide a symbol like `BRAF`, the Actor first calls the GraphQL `search` query to resolve the canonical Ensembl ID, then fetches the target object. Disease IDs follow EFO / MONDO / Orphanet conventions (`EFO_*`, `MONDO_*`, `Orphanet_*`). Drug IDs follow the ChEMBL `CHEMBL*` convention. Search hits include a relevance score that you can sort downstream.

***

### 📊 Output

The output shape varies by mode. Each record always carries an `entity` field, an `id`, a `url`, and a `scrapedAt` timestamp.

#### 🧾 Search-mode schema

| Field | Type | Example |
|---|---|---|
| 🏷️ `entity` | enum | `"target"`, `"disease"`, or `"drug"` |
| 🆔 `id` | string | `"ENSG00000139618"` |
| 🔗 `url` | string | `"https://platform.opentargets.org/target/ENSG00000139618"` |
| 📛 `name` | string | `"BRCA2"` |
| 📝 `description` | string | `"BRCA2 DNA repair associated"` |
| 🎯 `score` | number | `471.1691` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-13T22:26:22.091Z"` |

#### 🧾 Target-mode schema (selected fields)

| Field | Type | Notes |
|---|---|---|
| 🏷️ `entity` | string | `"target"` |
| 🆔 `id` | string | Ensembl gene ID |
| 🔬 `approvedSymbol` | string | HGNC symbol |
| 📛 `approvedName` | string | Full gene name |
| 🧬 `biotype` | string | e.g. `protein_coding` |
| 📜 `functionDescriptions` | string\[] | UniProt descriptions |
| 🎯 `hallmarks` | object | Cancer hallmarks block |
| 💊 `tractability` | object\[] | Modality / value / label tuples |
| 🔁 `pathways` | object\[] | Reactome pathways |
| 🦠 `associatedDiseases` | object | Top diseases with scores |
| 💊 `drugAndClinicalCandidates` | object | Drugs in development |

#### 📦 Sample record (search mode)

<details>
<summary><strong>🎯 Search "cancer" returning the BRCA2 target hit</strong></summary>

```json
{
    "entity": "target",
    "id": "ENSG00000139618",
    "name": "BRCA2",
    "url": "https://platform.opentargets.org/target/ENSG00000139618",
    "description": "BRCA2 DNA repair associated",
    "score": 471.1691,
    "scrapedAt": "2026-05-13T22:26:22.091Z"
}
```

</details>

<details>
<summary><strong>🦠 Search "cancer" returning the hereditary breast/ovarian cancer disease hit</strong></summary>

```json
{
    "entity": "disease",
    "id": "MONDO_0003582",
    "name": "hereditary breast ovarian cancer syndrome",
    "url": "https://platform.opentargets.org/disease/MONDO_0003582",
    "description": "An autosomal dominant inherited syndrome caused by mutations in the BRCA1 or BRCA2 genes.",
    "score": 468.7041,
    "scrapedAt": "2026-05-13T22:26:22.091Z"
}
```

</details>

<details>
<summary><strong>🦠 Top "cancer" hit: MONDO_0004992</strong></summary>

```json
{
    "entity": "disease",
    "id": "MONDO_0004992",
    "name": "cancer",
    "url": "https://platform.opentargets.org/disease/MONDO_0004992",
    "description": "A tumor composed of atypical neoplastic, often pleomorphic cells that invade other tissues.",
    "score": 5509.3164,
    "scrapedAt": "2026-05-13T22:26:22.090Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🎯 | **Four query modes.** Target, disease, drug, and free-text search in one Actor. |
| 🧬 | **Joined records.** Target rows carry associated diseases, drugs, hallmarks, pathways, and tractability in a single document. |
| 🔁 | **Symbol fallback.** Pass `BRCA1` or `EGFR` and the Actor resolves the Ensembl ID via the search hit before fetching the full object. |
| 🦠 | **EFO + MONDO + Orphanet.** Standard biomedical ontologies, ready for joins. |
| 💊 | **ChEMBL cross-reference.** Drug mode joins ChEMBL IDs to mechanisms of action, indications, and warnings. |
| ⚡ | **Fast.** GraphQL queries with retry and pagination size 250. |
| 🚫 | **No authentication.** Works on the public GraphQL endpoint. No login or API key. |

> 📊 Open Targets is the de facto reference dataset for target prioritization in modern drug discovery.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Modes | Setup |
|---|---|---|---|---|---|
| **⭐ Open Targets Scraper** *(this Actor)* | $5 free credit, then pay-per-use | Full Open Targets | **Live per run** | target, disease, drug, search | ⚡ 2 min |
| Hand-rolled GraphQL | Free | Full | Manual | Manual | 🐢 Days |
| OmicsDB / commercial target-ID platforms | $$$/year | Curated subset | Quarterly | Many | ⏳ Weeks |
| Static EBI dataset dumps | Free | Snapshot | Stale | None | 🕒 Variable |

Pick this Actor when you want broad target-disease-drug coverage, four ready-built query modes, and no pipeline maintenance.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the Open Targets Platform Scraper page on the Apify Store.
3. 🎯 **Set input.** Pick a mode, enter an ID (or a search query), and set `maxItems`.
4. 🚀 **Run it.** Click **Start** and let the Actor collect your data.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 💊 Pharma R\&D & Target ID

- Target prioritization scored by disease association
- Tractability dashboards across portfolios
- Drug repurposing audits against new indications
- Mechanism-of-action joins with ChEMBL

</td>
<td width="50%" valign="top">

#### 🧬 Computational Biology

- ML feature tables joining ENSG, EFO, and ChEMBL IDs
- Pathway enrichment with Reactome IDs
- Genetic-constraint annotation of candidate genes
- Cross-disease target overlap analyses

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 📰 Scientometrics & Competitive Intelligence

- Tracking competitor pipelines by ChEMBL drug ID
- Indication-creep mapping across portfolios
- Clinical-stage distribution by mechanism
- Drug-warning surveillance for safety teams

</td>
<td width="50%" valign="top">

#### 🤖 ML & AI for Drug Discovery

- Knowledge graphs joining target, disease, and drug
- Embedding generation for drug-target prediction
- Benchmark suites for biomedical NLP
- Retrieval-augmented LLM applications

</td>
</tr>
</table>

***

### 🔌 Automating Open Targets Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Quarterly refreshes catch every Open Targets release.

***

### 🌟 Beyond business use cases

Data like this powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Reproducible target prioritization with versioned dataset pulls
- Teaching datasets for bioinformatics and pharmacology
- Open-source benchmark publications
- Cross-database joins with ChEMBL, UniProt, and PDB

</td>
<td width="50%">

#### 🎨 Personal and creative

- Indie biomedical-search apps for curious users
- Visualizations for science communication
- Educational drug-target dashboards
- Portfolio projects on biomedical NLP

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Neglected-disease target prioritization
- Open-science pandemic preparedness
- Public-domain biomedical-data outreach
- Civic transparency on pharma pipelines

</td>
<td width="50%">

#### 🧪 Experimentation

- Train target-disease association models
- Prototype agentic tools that resolve gene symbols
- Benchmark biomedical knowledge graphs
- Generate target embeddings at scale

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20Open%20Targets%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20Open%20Targets%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20Open%20Targets%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20Open%20Targets%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Pick a mode (target / disease / drug / search), enter the ID or query, click Start, and the Actor posts a GraphQL document to `api.platform.opentargets.org/api/v4/graphql`. Records are emitted as clean JSON ready for download. No browser automation, no captchas, no setup.

#### 🧬 Where does the data come from?

Directly from the Open Targets Platform GraphQL API. Open Targets is a public-private partnership coordinated by EMBL-EBI.

#### 🔬 Why are there four modes instead of one?

Each entity (target, disease, drug) has a different shape and a different set of association tables. Modelling them as one mode would force a lowest-common-denominator schema. The four modes return the right joined data for each entity, plus a flat-list search mode for discovery.

#### 🆔 How do I resolve a gene symbol to an Ensembl ID?

Use target mode and pass the symbol in the `symbol` field while leaving `ensemblId` empty. The Actor runs the GraphQL `search` query, takes the top hit with `entity = target`, and uses its Ensembl ID to fetch the full target object.

#### 🦠 Which disease ontologies are supported?

Open Targets uses EFO, MONDO, and Orphanet identifiers. The `efoId` input accepts all three (e.g. `EFO_0000222`, `MONDO_0003582`, `Orphanet_145`).

#### 💊 Which drug ontology is supported?

ChEMBL drug IDs (`CHEMBL*`). Drug records cross-reference DrugBank, PubChem, and other sources via the `crossReferences` block.

#### 🔁 How often is the dataset refreshed?

Open Targets ships quarterly platform releases. Every run of this Actor hits the live GraphQL endpoint, so your dataset reflects the current release at run time.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to run this Actor on any cron interval (weekly, monthly, quarterly) and keep a downstream target-disease database in sync.

#### ⚖️ Is this data legal to use?

Open Targets data is released under a CC0 dedication. The raw association data is publicly accessible. Review Open Targets licensing for your specific use case, especially for redistribution.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and unlocks scheduling, higher concurrency, and larger datasets.

#### 🎯 What if I need evidence-level detail?

This Actor returns target-level, disease-level, drug-level, and search-result records. For row-level evidence (single GWAS hits, single literature citations), reach out via the contact form below to request a companion evidence scraper.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

Open Targets Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get run notifications in your channels
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe target-disease data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh association data into your drug-discovery backend, or alert your team in Slack when a watched target updates.

***

### 🔗 Recommended Actors

- [**🤗 Hugging Face Model Scraper**](https://apify.com/parseforge/hugging-face-model-scraper) - Model metadata, downloads, and benchmarks
- [**🏥 FINRA BrokerCheck Scraper**](https://apify.com/parseforge/finra-brokercheck-scraper) - U.S. broker and firm regulatory disclosures
- [**🏨 Greatschools Scraper**](https://apify.com/parseforge/greatschools-scraper) - U.S. school ratings and demographics
- [**📈 Smart Apify Actor Scraper**](https://apify.com/parseforge/smart-apify-actor-scraper) - Apify Store actor metadata and quality signals

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more reference-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by Open Targets, EMBL-EBI, or any of its partner organizations. All trademarks mentioned are the property of their respective owners. Only publicly available open biomedical data is collected.

# Actor input Schema

## `mode` (type: `string`):

target/disease/drug = fetch one entity by ID (or symbol). search = list all matches for a query string across selected entity types.

## `searchQuery` (type: `string`):

Free-text search query (e.g. 'cystic fibrosis', 'BRAF', 'aspirin'). Used when mode = search.

## `searchEntities` (type: `array`):

Entity types to include in search results. Leave empty for all (target + disease + drug).

## `ensemblId` (type: `string`):

Ensembl gene identifier for target mode (e.g. ENSG00000146648 for EGFR). Used when mode = target.

## `symbol` (type: `string`):

HGNC approved gene symbol for target mode (e.g. EGFR, BRCA1). Used as fallback search when ensemblId is empty.

## `efoId` (type: `string`):

EFO / MONDO disease identifier (e.g. EFO\_0000222 for Acute Myeloid Leukemia). Used when mode = disease.

## `chemblId` (type: `string`):

ChEMBL drug identifier (e.g. CHEMBL1201583 for Imatinib). Used when mode = drug.

## `maxItems` (type: `integer`):

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## Actor input object example

```json
{
  "mode": "target",
  "searchQuery": "",
  "searchEntities": [],
  "ensemblId": "ENSG00000146648",
  "symbol": "",
  "efoId": "EFO_0000222",
  "chemblId": "CHEMBL1201583",
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (type: `string`):

Overview of scraped data

## `fullData` (type: `string`):

Complete dataset

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "target",
    "searchQuery": "",
    "ensemblId": "ENSG00000146648",
    "symbol": "",
    "efoId": "EFO_0000222",
    "chemblId": "CHEMBL1201583",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/opentargets-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "target",
    "searchQuery": "",
    "ensemblId": "ENSG00000146648",
    "symbol": "",
    "efoId": "EFO_0000222",
    "chemblId": "CHEMBL1201583",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/opentargets-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "target",
  "searchQuery": "",
  "ensemblId": "ENSG00000146648",
  "symbol": "",
  "efoId": "EFO_0000222",
  "chemblId": "CHEMBL1201583",
  "maxItems": 10
}' |
apify call parseforge/opentargets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/opentargets-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Open Targets Platform Scraper",
        "description": "Query Open Targets Platform GraphQL API for targets (genes), diseases, or drugs and return rich associations including drugs by disease, known drugs, indications, mechanisms of action, pathways, tractability and genetic constraint. No API key required.",
        "version": "0.0",
        "x-build-id": "HgNbbuQNfImhmMk3H"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~opentargets-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-opentargets-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~opentargets-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-opentargets-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~opentargets-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-opentargets-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Entity Mode",
                        "enum": [
                            "target",
                            "disease",
                            "drug",
                            "search"
                        ],
                        "type": "string",
                        "description": "target/disease/drug = fetch one entity by ID (or symbol). search = list all matches for a query string across selected entity types.",
                        "default": "target"
                    },
                    "searchQuery": {
                        "title": "Search query (search mode)",
                        "type": "string",
                        "description": "Free-text search query (e.g. 'cystic fibrosis', 'BRAF', 'aspirin'). Used when mode = search.",
                        "default": ""
                    },
                    "searchEntities": {
                        "title": "Search entity types (search mode)",
                        "type": "array",
                        "description": "Entity types to include in search results. Leave empty for all (target + disease + drug).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "ensemblId": {
                        "title": "Ensembl Gene ID",
                        "type": "string",
                        "description": "Ensembl gene identifier for target mode (e.g. ENSG00000146648 for EGFR). Used when mode = target.",
                        "default": ""
                    },
                    "symbol": {
                        "title": "Approved Gene Symbol",
                        "type": "string",
                        "description": "HGNC approved gene symbol for target mode (e.g. EGFR, BRCA1). Used as fallback search when ensemblId is empty.",
                        "default": ""
                    },
                    "efoId": {
                        "title": "EFO Disease ID",
                        "type": "string",
                        "description": "EFO / MONDO disease identifier (e.g. EFO_0000222 for Acute Myeloid Leukemia). Used when mode = disease.",
                        "default": ""
                    },
                    "chemblId": {
                        "title": "ChEMBL Drug ID",
                        "type": "string",
                        "description": "ChEMBL drug identifier (e.g. CHEMBL1201583 for Imatinib). Used when mode = drug.",
                        "default": ""
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
