Read-only HTTP API over the Open Tree of Life synthesis tree. All responses are JSON unless noted; all endpoints accept GET only.
Conventions about tree nodes hoptree mrca path search
URL scheme is /api/v1/<resource>[/<id>][?params].
The version is in the path; bumping to v2 means a breaking
change.
Errors share one envelope with a stable
error.code string clients can switch on:
{
"error": {
"code": "node_not_found",
"message": "No node with external_id 'ottBOGUS'.",
"details": { "id": "ottBOGUS" }
}
}
Caching: successful responses set
Cache-Control: public, max-age=86400. The dataset only
changes when OTT republishes.
CORS: Access-Control-Allow-Origin: * on
every endpoint. The data is public.
Ids: taxon ids are ottN (e.g.
ott93302) or anonymous mrca ids
mrcaottXottY. Anything else is rejected with
bad_request for the relevant param.
/api/v1/aboutCapabilities + dataset metadata. Useful for cache-busting clients (the
generated_at field changes on each request, but the
node_count is stable for a given dataset).
{
"api_version": "v1",
"node_count": 2725682,
"summary_methods": [
"leaves"
],
"tree_formats": [
"json",
"newick"
],
"generated_at": "2026-05-07T01:32:52Z"
}
/api/v1/tree?taxon=…&k=…The focal subtree, summary-pruned to k leaves. Each node
carries display name, type, depth, tip count, supertree-leaf flag, weight
(supertree descendant count), full annotation lists, and pre-computed
x / y coordinates suitable for direct rendering.
This is what the viewer fetches on every navigation.
| param | type | default | notes |
|---|---|---|---|
taxon | string | ott93302 | OTT external id or mrca id. |
k | int | 30 | Summary leaf budget. Min 2. |
format | enum | json | json or newick (placeholder branch lengths of 1). |
JSON shape (truncated):
{
"focal_id": "ott452461",
"displayed_root_id": "ott452461",
"nodes": {
"ott452461": {
"id": "ott452461",
"display": "Procellariiformes",
"type": "internal",
"supertree_leaf": false,
"weight": 231,
"annotations": { "supported_by": [...], "terminal": [...], ... },
"depth": 0,
"tip_count": 28,
"x": 0,
"y": 50
},
...
},
"edges": [
{ "source": "ott452461", "target": "ott85277" },
...
]
}
/api/v1/nodes/{id}Per-node detail. Walks the parent chain to the OTT root and includes a
sample of up to 50 children (use /children for full
pagination).
{
"id": "ott452461",
"display": "Procellariiformes",
"type": "internal",
"weight": 231,
"parents": [{ "id": "...", "display": "..." }, ...],
"child_count": 4,
"children_sample": [{ "id": "ott85277", "display": "Diomedeidae" }, ...],
"annotations": { "supported_by": [...], ... },
"external_links": { "opentree": "https://tree.opentreeoflife.org/...", "wikidata": null, "ncbi": null }
}
/api/v1/nodes/{id}/childrenPaginated children of a node.
| param | type | default | notes |
|---|---|---|---|
offset | int | 0 | |
limit | int | 50 | Cap 500. |
/api/v1/nodes/{id}/descendantsAll descendants of a node, flat. Optional tips_only=true
filter restricts to leaves of the OTT supertree.
| param | type | default | notes |
|---|---|---|---|
tips_only | bool | false | |
offset | int | 0 | |
limit | int | 500 | Cap 5000. |
/api/v1/hoptree?ids=A,B,C…Minimum spanning subtree of a list of visited nodes (in visit order).
Same JSON shape as /tree; each node carries
visited and visit_order so a client can
highlight the user's path. Used to render the navigation breadcrumb in
the viewer.
/api/v1/mrca?ids=A,B…Most-recent common ancestor of a set of nodes. At least two ids required.
{
"mrca": { "id": "...", "display": "..." },
"inputs": [
{ "id": "ott917716", "display": "Goniurosaurus" },
{ "id": "ott342539", "display": "Hemitheconyx" }
]
}
/api/v1/path?from=A&to=BTopological path between two nodes via their LCA. length
counts edges; via is the ordered node id list from
from up to LCA and back down to to.
{
"from": "ott917716",
"to": "ott342539",
"lca": { "id": "...", "display": "..." },
"length": 4,
"via": ["ott917716", "...", "...", "...", "ott342539"]
}
/api/v1/search?q=…Taxon name search.
| param | type | default | notes |
|---|---|---|---|
q | string | — | Required. |
mode | enum | exact | exact, prefix, or substring. |
limit | int | 50 | Cap 200. |
{
"query": "Goniurosaurus",
"mode": "prefix",
"limit": 10,
"results": [
{ "id": "ott917716", "display": "Goniurosaurus" },
{ "id": "ott665630", "display": "Goniurosaurus araneus" },
...
]
}
Reference implementation in PHP, served by
api/index.php with the per-resource handlers under
api/handlers/. Source on
GitHub;
design rationale in api-design.md.