Find the ID of a target or disease

Last updated 28 days ago

To use our Open Targets API, you need to use the Ensembl gene ID for a given target and the EFO (or Orphanet, Human Phenotype Ontology) ID for a disease of interest.

Use the /search endpoint to look for the identifier (ID) of the target or diseases of interest using a free text search such as NOD2 (target) or Crohn's disease.

The /search endpoint should be used to identify the best match for a disease or target of interest. It will not give you details on the associations or evidence available for the target or disease of interest.

You can obtain the same result in Python by parsing the JSON as a dictionary and finding the correct index:

>>> import requests
>>> from pprint import pprint
>>> r = requests.get('https://api.opentargets.io/v3/platform/public/search',
params={"q":"NOD2","size":1})
>>> pprint(r.json())
{'data': [{'data': {'approved_name': 'nucleotide binding oligomerization '
'domain containing 2',
'approved_symbol': 'NOD2',
'association_counts': {'direct': 221, 'total': 380},
'biotype': 'protein_coding',
'description': 'Involved in ...',
'ensembl_gene_id': 'ENSG00000167207',

which should return the expected JSON object. To select specific keys, you needs to traverse the resulting dictionary.

>>> r.json()['data'][0]['id']
'ENSG00000167207'

The /search endpoint replicates the functionality of the search box on the Open Targets Platform and will give the same results you get with our user interface.