Skill Tracer
Skills › Scientific Agent Skills › database-lookup › opentargets.md

opentargets.md

362 lines · skills/database-lookup/references/opentargets.md at 5f2bc03

Open on GitHub
1# Open Targets Platform API
2

Open Targets Platform API

Raw lines 1 to 2
3## Base URLs
4
5**GraphQL API (primary, recommended):**
6```
7https://api.platform.opentargets.org/api/v4/graphql
8```
9
10**Important:** The GraphQL endpoint requires HTTP POST with `Content-Type: application/json`. WebFetch (GET-only) will not work — use `curl` via shell instead:
11```bash
12curl -s -X POST -H "Content-Type: application/json" \
13 -d '{"query":"{ target(ensemblId: \"ENSG00000157764\") { approvedSymbol approvedName } }"}' \
14 https://api.platform.opentargets.org/api/v4/graphql
15```

Base URLs

GraphQL API (primary, recommended):

https://api.platform.opentargets.org/api/v4/graphql

Important: The GraphQL endpoint requires HTTP POST with Content-Type: application/json. WebFetch (GET-only) will not work — use curl via shell instead:

curl -s -X POST -H "Content-Type: application/json" \
  -d '{"query":"{ target(ensemblId: \"ENSG00000157764\") { approvedSymbol approvedName } }"}' \
  https://api.platform.opentargets.org/api/v4/graphql
Raw lines 3 to 16
17## Authentication
19No API key required. All endpoints are public.

Authentication

No API key required. All endpoints are public.

Raw lines 17 to 20
21## GraphQL API
23All GraphQL queries are sent as POST requests to the GraphQL endpoint.
25```
26POST https://api.platform.opentargets.org/api/v4/graphql
27Content-Type: application/json
30 "query": "...",
31 "variables": { ... }
33```

GraphQL API

All GraphQL queries are sent as POST requests to the GraphQL endpoint.

POST https://api.platform.opentargets.org/api/v4/graphql
Content-Type: application/json

{
  "query": "...",
  "variables": { ... }
}
Raw lines 21 to 34
35### 1. Target information (by Ensembl Gene ID)
37```graphql
38query TargetInfo($ensemblId: String!) {
39 target(ensemblId: $ensemblId) {
40 id
41 approvedSymbol
42 approvedName
43 biotype
44 proteinIds {
45 id
46 source
47 }
48 tractability {
49 label
50 modality
51 value
52 }
53 safetyLiabilities {
54 event
55 effects {
56 direction
57 dosing
58 }
59 }
60 pathways {
61 pathway
62 pathwayId
63 }
64 functionDescriptions
65 subcellularLocations {
66 location
67 }
68 }
70```
72**Variables:** `{ "ensemblId": "ENSG00000141510" }`
75---

1. Target information (by Ensembl Gene ID)

query TargetInfo($ensemblId: String!) {
  target(ensemblId: $ensemblId) {
    id
    approvedSymbol
    approvedName
    biotype
    proteinIds {
      id
      source
    }
    tractability {
      label
      modality
      value
    }
    safetyLiabilities {
      event
      effects {
        direction
        dosing
      }
    }
    pathways {
      pathway
      pathwayId
    }
    functionDescriptions
    subcellularLocations {
      location
    }
  }
}

Variables: { "ensemblId": "ENSG00000141510" }


Raw lines 35 to 76
77### 2. Disease information (by EFO ID)
79```graphql
80query DiseaseInfo($efoId: String!) {
81 disease(efoId: $efoId) {
82 id
83 name
84 description
85 therapeuticAreas {
86 id
87 name
88 }
89 synonyms {
90 terms
91 }
92 }
94```
96**Variables:** `{ "efoId": "EFO_0000311" }` (cancer)
99---

2. Disease information (by EFO ID)

query DiseaseInfo($efoId: String!) {
  disease(efoId: $efoId) {
    id
    name
    description
    therapeuticAreas {
      id
      name
    }
    synonyms {
      terms
    }
  }
}

Variables: { "efoId": "EFO_0000311" } (cancer)


Raw lines 77 to 100
101### 3. Target-Disease associations
103```graphql
104query Associations($ensemblId: String!, $page: Pagination!) {
105 target(ensemblId: $ensemblId) {
106 approvedSymbol
107 associatedDiseases(page: $page) {
108 count
109 rows {
110 disease {
111 id
112 name
113 }
114 score
115 datasourceScores {
116 id
117 score
118 }
119 }
120 }
121 }
123```
125**Variables:**
126```json
128 "ensemblId": "ENSG00000141510",
129 "page": { "index": 0, "size": 10 }
131```
134---

3. Target-Disease associations

query Associations($ensemblId: String!, $page: Pagination!) {
  target(ensemblId: $ensemblId) {
    approvedSymbol
    associatedDiseases(page: $page) {
      count
      rows {
        disease {
          id
          name
        }
        score
        datasourceScores {
          id
          score
        }
      }
    }
  }
}

Variables:

{
  "ensemblId": "ENSG00000141510",
  "page": { "index": 0, "size": 10 }
}

Raw lines 101 to 135
136### 4. Disease-Target associations (from disease side)
138```graphql
139query DiseaseAssociations($efoId: String!, $page: Pagination!) {
140 disease(efoId: $efoId) {
141 name
142 associatedTargets(page: $page) {
143 count
144 rows {
145 target {
146 id
147 approvedSymbol
148 }
149 score
150 datasourceScores {
151 id
152 score
153 }
154 }
155 }
156 }
158```
160**Variables:**
161```json
163 "efoId": "EFO_0000311",
164 "page": { "index": 0, "size": 10 }
166```
168---

4. Disease-Target associations (from disease side)

query DiseaseAssociations($efoId: String!, $page: Pagination!) {
  disease(efoId: $efoId) {
    name
    associatedTargets(page: $page) {
      count
      rows {
        target {
          id
          approvedSymbol
        }
        score
        datasourceScores {
          id
          score
        }
      }
    }
  }
}

Variables:

{
  "efoId": "EFO_0000311",
  "page": { "index": 0, "size": 10 }
}

Raw lines 136 to 169
170### 5. Evidence for a target-disease pair
172```graphql
173query Evidence($ensemblId: String!, $efoId: String!, $size: Int!) {
174 disease(efoId: $efoId) {
175 evidences(ensemblIds: [$ensemblId], size: $size) {
176 count
177 rows {
178 id
179 score
180 datasourceId
181 datatypeId
182 literature
183 diseaseFromSource
184 targetFromSourceId
185 resourceScore
186 urls {
187 niceName
188 url
189 }
190 }
191 }
192 }
194```
196**Variables:**
197```json
199 "ensemblId": "ENSG00000141510",
200 "efoId": "EFO_0000311",
201 "size": 10
203```
205---

5. Evidence for a target-disease pair

query Evidence($ensemblId: String!, $efoId: String!, $size: Int!) {
  disease(efoId: $efoId) {
    evidences(ensemblIds: [$ensemblId], size: $size) {
      count
      rows {
        id
        score
        datasourceId
        datatypeId
        literature
        diseaseFromSource
        targetFromSourceId
        resourceScore
        urls {
          niceName
          url
        }
      }
    }
  }
}

Variables:

{
  "ensemblId": "ENSG00000141510",
  "efoId": "EFO_0000311",
  "size": 10
}

Raw lines 170 to 206
207### 6. Drug/molecule information
209```graphql
210query DrugInfo($chemblId: String!) {
211 drug(chemblId: $chemblId) {
212 id
213 name
214 drugType
215 maximumClinicalStage
216 mechanismsOfAction {
217 rows {
218 mechanismOfAction
219 targets {
220 id
221 approvedSymbol
222 }
223 }
224 }
225 indications {
226 rows {
227 disease {
228 id
229 name
230 }
231 maxClinicalStage
232 }
233 }
235 }
237```
239**Variables:** `{ "chemblId": "CHEMBL25" }` (aspirin)
242---

6. Drug/molecule information

query DrugInfo($chemblId: String!) {
  drug(chemblId: $chemblId) {
    id
    name
    drugType
    maximumClinicalStage
    mechanismsOfAction {
      rows {
        mechanismOfAction
        targets {
          id
          approvedSymbol
        }
      }
    }
    indications {
      rows {
        disease {
          id
          name
        }
        maxClinicalStage
      }
    }

  }
}

Variables: { "chemblId": "CHEMBL25" } (aspirin)


Raw lines 207 to 243
244### 7. Search across targets, diseases, and drugs
246```graphql
247query Search($queryString: String!, $entityNames: [String!], $page: Pagination!) {
248 search(queryString: $queryString, entityNames: $entityNames, page: $page) {
249 total
250 hits {
251 id
252 entity
253 name
254 description
255 score
256 }
257 }
259```
261**Variables:**
262```json
264 "queryString": "BRAF melanoma",
265 "entityNames": ["target", "disease", "drug"],
266 "page": { "index": 0, "size": 10 }
268```
271---

7. Search across targets, diseases, and drugs

query Search($queryString: String!, $entityNames: [String!], $page: Pagination!) {
  search(queryString: $queryString, entityNames: $entityNames, page: $page) {
    total
    hits {
      id
      entity
      name
      description
      score
    }
  }
}

Variables:

{
  "queryString": "BRAF melanoma",
  "entityNames": ["target", "disease", "drug"],
  "page": { "index": 0, "size": 10 }
}

Raw lines 244 to 272
273### 8. Drugs and clinical candidates for a target
275```graphql
276query ClinicalCandidates($ensemblId: String!) {
277 target(ensemblId: $ensemblId) {
278 approvedSymbol
279 drugAndClinicalCandidates {
280 count
281 rows {
282 id
283 maxClinicalStage
284 drug { id name drugType maximumClinicalStage }
285 clinicalReports { id source clinicalStage url }
286 }
287 }
288 }
290```
292Variables: `{ "ensemblId": "ENSG00000157764" }` (BRAF).
293The current schema uses clinical-stage strings. Do not parse them as numeric
294trial phases or infer withdrawal from a missing field.
296---

8. Drugs and clinical candidates for a target

query ClinicalCandidates($ensemblId: String!) {
  target(ensemblId: $ensemblId) {
    approvedSymbol
    drugAndClinicalCandidates {
      count
      rows {
        id
        maxClinicalStage
        drug { id name drugType maximumClinicalStage }
        clinicalReports { id source clinicalStage url }
      }
    }
  }
}

Variables: { "ensemblId": "ENSG00000157764" } (BRAF). The current schema uses clinical-stage strings. Do not parse them as numeric trial phases or infer withdrawal from a missing field.


Raw lines 273 to 297
298### 9. Tractability (druggability)
300Included in the target query (see endpoint 1 above). Modalities include:
301- `SM` (small molecule)
302- `AB` (antibody)
303- `PR` (PROTAC)
304- `OC` (other clinical)
306---

9. Tractability (druggability)

Included in the target query (see endpoint 1 above). Modalities include:

  • SM (small molecule)
  • AB (antibody)
  • PR (PROTAC)
  • OC (other clinical)

Raw lines 298 to 307
308## Key Identifiers
310| Entity | ID Format | Example |
311|---------|-----------|---------|
312| Target | Ensembl Gene ID | `ENSG00000141510` (TP53) |
313| Disease | EFO/Mondo/HP/Orphanet | `EFO_0000311` (cancer), `MONDO_0007254` |
314| Drug | ChEMBL ID | `CHEMBL25` (aspirin) |

Key Identifiers

EntityID FormatExample
TargetEnsembl Gene IDENSG00000141510 (TP53)
DiseaseEFO/Mondo/HP/OrphanetEFO_0000311 (cancer), MONDO_0007254
DrugChEMBL IDCHEMBL25 (aspirin)
Raw lines 308 to 315
316## Datasource IDs
318Datasource membership changes by release. Read `datasourceScores.id` or the
319current Platform data-source documentation before setting evidence filters.
320Do not assume the former Genetics Portal IDs remain current after integration
321into the Platform. Association scores rank evidence support, not causal probability.

Datasource IDs

Datasource membership changes by release. Read datasourceScores.id or the current Platform data-source documentation before setting evidence filters. Do not assume the former Genetics Portal IDs remain current after integration into the Platform. Association scores rank evidence support, not causal probability.

Raw lines 316 to 322
323## Pagination
325GraphQL uses `page: { index: Int, size: Int }` (0-based index).
326Evidence connections instead use `size` plus an opaque `cursor`; request the
327returned cursor and continue until exhausted. Other connections expose all rows
328without pagination arguments: check the schema for each field.

Pagination

GraphQL uses page: { index: Int, size: Int } (0-based index). Evidence connections instead use size plus an opaque cursor; request the returned cursor and continue until exhausted. Other connections expose all rows without pagination arguments: check the schema for each field.

Raw lines 323 to 329
330## Rate Limits
332- No API key required.
333- Fair-use rate limiting applies. No hard published limit.
334- For bulk data, use the Open Targets data downloads (Parquet files on GCS/FTP) rather than API.
335- Respect HTTP 429 and `Retry-After` headers.

Rate Limits

  • No API key required.
  • Fair-use rate limiting applies. No hard published limit.
  • For bulk data, use the Open Targets data downloads (Parquet files on GCS/FTP) rather than API.
  • Respect HTTP 429 and Retry-After headers.
Raw lines 330 to 336
337## Error Format
339GraphQL errors:
340```json
342 "errors": [
343 {
344 "message": "Variable '$ensemblId' expected value of type 'String!' but got: null",
345 "locations": [{"line": 1, "column": 7}]
346 }
347 ]
349```
351Inspect both HTTP status and GraphQL `errors`; an HTTP 200 can contain failed
352fields or partial `data`.

Error Format

GraphQL errors:

{
  "errors": [
    {
      "message": "Variable '$ensemblId' expected value of type 'String!' but got: null",
      "locations": [{"line": 1, "column": 7}]
    }
  ]
}

Inspect both HTTP status and GraphQL errors; an HTTP 200 can contain failed fields or partial data.

Raw lines 337 to 353
354## Tips
356- Use the GraphQL API for maximum flexibility -- request only the fields you need.
357- Send POST with JSON `query` and `variables`; no separate REST search API is documented.
358- Combine target + disease queries to get association scores with evidence breakdown.
359- Use `datasourceScores` in association queries to see which evidence sources contribute most.
360- The Open Targets Platform web UI at `https://platform.opentargets.org` has a GraphQL playground for testing queries.
362Current [GraphQL schema](https://api.platform.opentargets.org/api/v4/graphql/schema) and [API guide](https://platform-docs.opentargets.org/data-access/graphql-api).

Tips

  • Use the GraphQL API for maximum flexibility -- request only the fields you need.
  • Send POST with JSON query and variables; no separate REST search API is documented.
  • Combine target + disease queries to get association scores with evidence breakdown.
  • Use datasourceScores in association queries to see which evidence sources contribute most.
  • The Open Targets Platform web UI at https://platform.opentargets.org has a GraphQL playground for testing queries.

Current GraphQL schema and API guide.

Raw lines 354 to 362