# GraphQL API

**URL:** https://community.opentargets.org/c/data-access/graphql-api/19.md

[Latest](https://community.opentargets.org/latest.md) · [Categories](https://community.opentargets.org/categories.md) · [Tags](https://community.opentargets.org/tags.md)

---

## [About the GraphQL API category](https://community.opentargets.org/t/about-the-graphql-api-category/42)

<div class="topic-metadata">

**Author:** [@community\_manager](https://community.opentargets.org/u/community_manager)\
**Replies:** 0

</div>

For questions around accessing Open Targets data using the GraphQL API. Note, we already have some information in our data access documentation, and make sure to check whether your issue has already been posted before w…

---

## [Target.expressions returns empty as of 26.06 — has it been replaced by baselineExpression?](https://community.opentargets.org/t/target-expressions-returns-empty-as-of-26-06-has-it-been-replaced-by-baselineexpression/2043)

<div class="topic-metadata">

**Author:** [@elarwei](https://community.opentargets.org/u/elarwei)\
**Replies:** 6\
**Last updated:** [6 October 2026 12:21 UTC](https://community.opentargets.org/t/target-expressions-returns-empty-as-of-26-06-has-it-been-replaced-by-baselineexpression/2043 "2026-10-06T12:21:35Z")

</div>

Hi all, I searched the community first and only found an older thread about the previous expressions structure (/t/graphql-query-for-expression-data/1840), which predates this change — so I’m opening a new topic. On …

---

## [Data gap in knownDrugs GraphQL results (for example CCR5 and Maraviroc)](https://community.opentargets.org/t/data-gap-in-knowndrugs-graphql-results-for-example-ccr5-and-maraviroc/1980)

<div class="topic-metadata">

**Author:** [@Minh](https://community.opentargets.org/u/Minh)\
**Replies:** 1\
**Last updated:** [2 March 2026 14:13 UTC](https://community.opentargets.org/t/data-gap-in-knowndrugs-graphql-results-for-example-ccr5-and-maraviroc/1980 "2026-03-02T14:13:50Z")

</div>

Hi Open Targets Community, I’m looking for some support regarding how to retrieve known drugs via the GraphQL API. For example, when querying CCR5 (ENSG00000160791) using the knownDrugs field, I can no longer find Mara…

---

## [Searching credibleSets by region overlap](https://community.opentargets.org/t/searching-crediblesets-by-region-overlap/1956)

<div class="topic-metadata">

**Author:** [@Flizzy](https://community.opentargets.org/u/Flizzy)\
**Replies:** 2\
**Last updated:** [26 December 2025 12:19 UTC](https://community.opentargets.org/t/searching-crediblesets-by-region-overlap/1956 "2025-12-26T12:19:33Z")

</div>

I’m trying to retrieve all credible sets (study-loci) that overlap a genomic interval (e.g., a ±500kb window around a gene). I expected the regions argument of credibleSets to behave like an interval/overlap filter, but …

---

## [R query for colocalizations](https://community.opentargets.org/t/r-query-for-colocalizations/1846)

<div class="topic-metadata">

**Author:** [@Kumar\_Veerapen](https://community.opentargets.org/u/Kumar_Veerapen)\
**Replies:** 5\
**Last updated:** [9 July 2025 10:03 UTC](https://community.opentargets.org/t/r-query-for-colocalizations/1846 "2025-07-09T10:03:28Z")

</div>

I am really new to using the API and was curious if someone could help me? I am attempting to obtain all possible colocalizations in a particular gene and I believe the first thing I needed was to obtain studyLocusID . …

---

## [Fetching the disease ontology level](https://community.opentargets.org/t/fetching-the-disease-ontology-level/1820)

<div class="topic-metadata">

**Author:** [@Aner\_Ottolenghi](https://community.opentargets.org/u/Aner_Ottolenghi)\
**Replies:** 3\
**Last updated:** [1 July 2025 09:08 UTC](https://community.opentargets.org/t/fetching-the-disease-ontology-level/1820 "2025-07-01T09:08:54Z")

</div>

Hi kind people of the OT community! I wanted to know if it is possible, using the API, to fetch the level of a disease in the disease ontology? So for example, in the image - colitis is positioned 5th from the root. Is…

---

## [Credible set variants with PIP but no L2G score](https://community.opentargets.org/t/credible-set-variants-with-pip-but-no-l2g-score/1818)

<div class="topic-metadata">

**Author:** [@mjatoi](https://community.opentargets.org/u/mjatoi)\
**Replies:** 1\
**Last updated:** [6 June 2025 08:43 UTC](https://community.opentargets.org/t/credible-set-variants-with-pip-but-no-l2g-score/1818 "2025-06-06T08:43:32Z")

</div>

Hi there, When querying for variants that are in Open Targets in R, I noticed that some credible set variants have a posterior probability but do not have a L2G score; is this because “all \[L2G\] predictions below 0.05 a…

---

## [PheWAS Download](https://community.opentargets.org/t/phewas-download/1694)

<div class="topic-metadata">

**Author:** [@kamalika\_ray](https://community.opentargets.org/u/kamalika_ray)\
**Replies:** 8\
**Last updated:** [3 April 2025 12:07 UTC](https://community.opentargets.org/t/phewas-download/1694 "2025-04-03T12:07:45Z")

</div>

Hi, How do I download the exact results of this API in bulk. I want to download the result for 3000 variants. query search($variantId: String!) { pheWAS(variantId: $variantId) { totalGWASStudies associations { pval …

---

## [Getting proteins associated to a disease](https://community.opentargets.org/t/getting-proteins-associated-to-a-disease/1711)

<div class="topic-metadata">

**Author:** [@jrkarki](https://community.opentargets.org/u/jrkarki)\
**Replies:** 2\
**Last updated:** [20 March 2025 18:37 UTC](https://community.opentargets.org/t/getting-proteins-associated-to-a-disease/1711 "2025-03-20T18:37:02Z")

</div>

Hi there community, I have the following function which was working perfectly. Lately, I realized the size is set to 3000 at max. But I want to get all the proteins for a disease, let’s say 5000. The trick would be to u…

---

## [Publication years for Proteins](https://community.opentargets.org/t/publication-years-for-proteins/1671)

<div class="topic-metadata">

**Author:** [@jrkarki](https://community.opentargets.org/u/jrkarki)\
**Replies:** 2\
**Last updated:** [3 March 2025 12:17 UTC](https://community.opentargets.org/t/publication-years-for-proteins/1671 "2025-03-03T12:17:50Z")

</div>

Hello there community, I am required to retrieve publication dates for 10 proteins for which I am doing the following. query\_string = """ query targetAnnotation($ensemblId: String!,$cursor:String!) { targ…

---

## [GWAS lead variants via API](https://community.opentargets.org/t/gwas-lead-variants-via-api/429)

<div class="topic-metadata">

**Author:** [@pietznerm](https://community.opentargets.org/u/pietznerm)\
**Replies:** 6\
**Last updated:** [24 October 2024 14:42 UTC](https://community.opentargets.org/t/gwas-lead-variants-via-api/429 "2024-10-24T14:42:31Z")

</div>

Hi OpenTargets Team, I am a huge fan of your resource. I am currently working on a script to query GWAS variant associations for a set of genetic variants. I managed to do so for PheWAS associations. However, since most…

---

## [Getting all the LOF association to disease for a gene](https://community.opentargets.org/t/getting-all-the-lof-association-to-disease-for-a-gene/1508)

<div class="topic-metadata">

**Author:** [@Aner\_Ottolenghi](https://community.opentargets.org/u/Aner_Ottolenghi)\
**Replies:** 12\
**Last updated:** [14 October 2024 10:18 UTC](https://community.opentargets.org/t/getting-all-the-lof-association-to-disease-for-a-gene/1508 "2024-10-14T10:18:17Z")

</div>

Hi! I’m trying to write an API query that can return all the data of the direction of effect, of diseases associated with a target, in ClinVar and Orphant. Grateful for any help.

---

## [Querying for associated diseases doesn't return full list](https://community.opentargets.org/t/querying-for-associated-diseases-doesnt-return-full-list/1563)

<div class="topic-metadata">

**Author:** [@HyperValent](https://community.opentargets.org/u/HyperValent)\
**Replies:** 3\
**Last updated:** [26 September 2024 23:01 UTC](https://community.opentargets.org/t/querying-for-associated-diseases-doesnt-return-full-list/1563 "2024-09-26T23:01:23Z")

</div>

Hi! I just recently started using Open Targets for a project that I am working on and it has been exceptional so far! I just have one issue regarding using GraphQL API for getting associated diseases based on a target I…

---

## [Variant to Gene Query for multiple variants in OT Genetics](https://community.opentargets.org/t/variant-to-gene-query-for-multiple-variants-in-ot-genetics/456)

<div class="topic-metadata">

**Author:** [@pjordab](https://community.opentargets.org/u/pjordab)\
**Replies:** 4\
**Last updated:** [20 August 2024 09:09 UTC](https://community.opentargets.org/t/variant-to-gene-query-for-multiple-variants-in-ot-genetics/456 "2024-08-20T09:09:32Z")

</div>

Dear Open Target team, First of all, thank you very much for your valuable work. I need to perform a Variant to Gene search for multiple variants (\>200). I am trying to find a way to do it through a script that genera…

---

## [Excluding Non-Regular Diseases from Open Targets API Results](https://community.opentargets.org/t/excluding-non-regular-diseases-from-open-targets-api-results/1509)

<div class="topic-metadata">

**Author:** [@Vittorio\_lembo](https://community.opentargets.org/u/Vittorio_lembo)\
**Replies:** 3\
**Last updated:** [29 July 2024 11:35 UTC](https://community.opentargets.org/t/excluding-non-regular-diseases-from-open-targets-api-results/1509 "2024-07-29T11:35:08Z")

</div>

Hi everyone, I need help with a code I’m writing. Basically, I’ve already written code that retrieves, for each target UniProt ID in a list, all the associated diseases. From analyzing the results of this code (see the…

---

## [Why do some genes in Open Targets V2G data have 'NA' typeId and no reported distance?](https://community.opentargets.org/t/why-do-some-genes-in-open-targets-v2g-data-have-na-typeid-and-no-reported-distance/1515)

<div class="topic-metadata">

**Author:** [@Meet\_Bajpai](https://community.opentargets.org/u/Meet_Bajpai)\
**Replies:** 1\
**Last updated:** [26 July 2024 09:58 UTC](https://community.opentargets.org/t/why-do-some-genes-in-open-targets-v2g-data-have-na-typeid-and-no-reported-distance/1515 "2024-07-26T09:58:50Z")

</div>

I’ve been investigating the Variant-to-Gene (V2G) assignments in Open Targets using GraphQL API (using otargen package) . I’ve noticed an intriguing pattern: for certain gene targets associated with variants, the ‘typeId…

---

## [Query disease for descendants](https://community.opentargets.org/t/query-disease-for-descendants/1498)

<div class="topic-metadata">

**Author:** [@Vittorio\_lembo](https://community.opentargets.org/u/Vittorio_lembo)\
**Replies:** 2\
**Last updated:** [24 July 2024 14:26 UTC](https://community.opentargets.org/t/query-disease-for-descendants/1498 "2024-07-24T14:26:10Z")

</div>

Hi everyone, I’m trying to query a list of selected diseases for their descendants. I’ve seen from the documentation that there are different ways to query for descendants. The first one is very simple: query descend…

---

## [Retrieving \>25 associated drugs](https://community.opentargets.org/t/retrieving-25-associated-drugs/1193)

<div class="topic-metadata">

**Author:** [@Myrthe\_Willemsen](https://community.opentargets.org/u/Myrthe_Willemsen)\
**Replies:** 4\
**Last updated:** [17 July 2024 09:24 UTC](https://community.opentargets.org/t/retrieving-25-associated-drugs/1193 "2024-07-17T09:24:30Z")

</div>

Hi all! When querying ‘knownDrugs’ associated to a target, I am able to find at most 25 drugs. Would it be possible to retrieve more associated drugs without using Google Big Query? I tried suggestions like (page: { si…

---

## [R-API code to get full MONDO and DOID ID with human disease/traits](https://community.opentargets.org/t/r-api-code-to-get-full-mondo-and-doid-id-with-human-disease-traits/1485)

<div class="topic-metadata">

**Author:** [@Shicheng\_Guo](https://community.opentargets.org/u/Shicheng_Guo)\
**Replies:** 0\
**Last updated:** [16 July 2024 20:45 UTC](https://community.opentargets.org/t/r-api-code-to-get-full-mondo-and-doid-id-with-human-disease-traits/1485 "2024-07-16T20:45:00Z")

</div>

Dear All, Could anyone share R-API code to retrieve the full MONDO and DOID IDs along with associated human diseases/traits from the Open Targets annotation database? Do we have the following full table? The final tab…

---

## [R-API Script to Identify High-Scoring Target-Trait Pairs](https://community.opentargets.org/t/r-api-script-to-identify-high-scoring-target-trait-pairs/1484)

<div class="topic-metadata">

**Author:** [@Shicheng\_Guo](https://community.opentargets.org/u/Shicheng_Guo)\
**Replies:** 0\
**Last updated:** [16 July 2024 17:09 UTC](https://community.opentargets.org/t/r-api-script-to-identify-high-scoring-target-trait-pairs/1484 "2024-07-16T17:09:54Z")

</div>

Dear All, I am looking to identify some target-trait pairs with “UniProt literature” and “ChEMBL” evidence support and an Association Score greater than 0.45. Could anyone share an R-API script to achieve this from Open…

---

## [Data source scores](https://community.opentargets.org/t/data-source-scores/1065)

<div class="topic-metadata">

**Author:** [@philge\_philip](https://community.opentargets.org/u/philge_philip)\
**Replies:** 2\
**Last updated:** [16 July 2024 17:03 UTC](https://community.opentargets.org/t/data-source-scores/1065 "2024-07-16T17:03:53Z")

</div>

Hi, Is the data source scores accessible through API weighted? Thanks Philge

---

## [Can we get all Bibliography data per gene using the api?](https://community.opentargets.org/t/can-we-get-all-bibliography-data-per-gene-using-the-api/1137)

<div class="topic-metadata">

**Author:** [@cjeynes](https://community.opentargets.org/u/cjeynes)\
**Replies:** 6\
**Last updated:** [16 July 2024 16:40 UTC](https://community.opentargets.org/t/can-we-get-all-bibliography-data-per-gene-using-the-api/1137 "2024-07-16T16:40:03Z")

</div>

when a gene is searched most tabs have this option for the api BUt for the bibliography it’s not there … it would be really handy to be able to get this data through the api PS i do realise you can download all t…

---

## [Identify variants for list of ~300 genes (V2G output only)](https://community.opentargets.org/t/identify-variants-for-list-of-300-genes-v2g-output-only/1478)

<div class="topic-metadata">

**Author:** [@mbennet5](https://community.opentargets.org/u/mbennet5)\
**Replies:** 0\
**Last updated:** [5 July 2024 15:01 UTC](https://community.opentargets.org/t/identify-variants-for-list-of-300-genes-v2g-output-only/1478 "2024-07-05T15:01:56Z")

</div>

Hi there, I’m looking to use OpenTargetsGenetics to help find regulatory regions for a set of ~300 genes. My aim is to get a table from the V2G pipeline output including info on whether they are p/s/eQTL, HiC linked, FA…

---

## [List of commands and options available in OTG GraphQL for running PheWAS](https://community.opentargets.org/t/list-of-commands-and-options-available-in-otg-graphql-for-running-phewas/1364)

<div class="topic-metadata">

**Author:** [@Sabor117](https://community.opentargets.org/u/Sabor117)\
**Replies:** 6\
**Last updated:** [8 March 2024 16:10 UTC](https://community.opentargets.org/t/list-of-commands-and-options-available-in-otg-graphql-for-running-phewas/1364 "2024-03-08T16:10:31Z")

</div>

I am new both to the usage of OTG and GraphQL and have recently begun using the platform for investigating variants we have discovered via GWAS meta-analysis. For this I’ve been using the V2G function and also intend to …

---

## [R script for GraphQL query: query targetDiseaseEvidence](https://community.opentargets.org/t/r-script-for-graphql-query-query-targetdiseaseevidence/662)

<div class="topic-metadata">

**Author:** [@eleonoreschneegans](https://community.opentargets.org/u/eleonoreschneegans)\
**Replies:** 7\
**Last updated:** [11 January 2024 22:33 UTC](https://community.opentargets.org/t/r-script-for-graphql-query-query-targetdiseaseevidence/662 "2024-01-11T22:33:36Z")

</div>

Hi, I’m struggling to extract the association scores (i.e. overall association score, genetic associations, drugs, etc…) for a chosen disease of interest, and genes of interest. How could I build a query for Alzheimer’…

---

## [How to modify data source weights in the API?](https://community.opentargets.org/t/how-to-modify-data-source-weights-in-the-api/1064)

<div class="topic-metadata">

**Author:** [@philge\_philip](https://community.opentargets.org/u/philge_philip)\
**Replies:** 3\
**Last updated:** [23 August 2023 07:27 UTC](https://community.opentargets.org/t/how-to-modify-data-source-weights-in-the-api/1064 "2023-08-23T07:27:55Z")

</div>

Hi, I have come across a statement, “The default weights used in the web application can be modified by the user in the API, to adjust to different prioritisation strategies.”. Can you please tell me how to do this? Th…

---

## [GraphQL and API downloads](https://community.opentargets.org/t/graphql-and-api-downloads/1174)

<div class="topic-metadata">

**Author:** [@Alex\_Rowen](https://community.opentargets.org/u/Alex_Rowen)\
**Replies:** 4\
**Last updated:** [14 August 2023 11:11 UTC](https://community.opentargets.org/t/graphql-and-api-downloads/1174 "2023-08-14T11:11:22Z")

</div>

Dear Community! A new comer here! I am wondering how one can download data for drug-disease associations? For example, there is option to access the data via JSON, TSV or API. GraphQL playground suggests this code t…

---

## [Sample R script to query GraphQL API](https://community.opentargets.org/t/sample-r-script-to-query-graphql-api/510)

<div class="topic-metadata">

**Author:** [@enricoferrero](https://community.opentargets.org/u/enricoferrero)\
**Replies:** 5\
**Last updated:** [11 August 2023 09:02 UTC](https://community.opentargets.org/t/sample-r-script-to-query-graphql-api/510 "2023-08-11T09:02:22Z")

</div>

Hello, When I look at the documentation, I can only see the sample Python script to query the GraphQL API. If I click on the R tab, nothing happens. Would it be possible to add the R sample script (and/or can someone s…

---

## [An R script to use API for fetching "Associated studies: locus-to-gene pipeline" section for a gene](https://community.opentargets.org/t/an-r-script-to-use-api-for-fetching-associated-studies-locus-to-gene-pipeline-section-for-a-gene/1135)

<div class="topic-metadata">

**Author:** [@yazdan59](https://community.opentargets.org/u/yazdan59)\
**Replies:** 3\
**Last updated:** [11 August 2023 08:46 UTC](https://community.opentargets.org/t/an-r-script-to-use-api-for-fetching-associated-studies-locus-to-gene-pipeline-section-for-a-gene/1135 "2023-08-11T08:46:00Z")

</div>

Hello, I want to write a query in R that fetch all information regarding the “Associated studies: locus-to-gene pipeline” section (especially L2G pipeline scores) based on an “Ensemble ID” of a gene as input. Could you p…

---

## [Date of access using API](https://community.opentargets.org/t/date-of-access-using-api/1109)

<div class="topic-metadata">

**Author:** [@Hassan](https://community.opentargets.org/u/Hassan)\
**Replies:** 1\
**Last updated:** [13 June 2023 08:12 UTC](https://community.opentargets.org/t/date-of-access-using-api/1109 "2023-06-13T08:12:44Z")

</div>

New to this community and this data source. I was wondering if it is possible to access old data using GraphQL api or limit it to a certain version of database? I am curious about reproducibility.

[Next page](https://community.opentargets.org/c/data-access/graphql-api/19.md?page=1)
