---
# System prepended metadata

title: API Queries

---

# API Queries

## Get subtree
Given a clade ID return the clade with descendants up to a given/default depth.

Graphql query example:

```graphql
const GET_TREE = gql`
  fragment clade on Clade {
    id
    name
    extant
    hasChildren
    parentId
    leaves
  }

  query getTree($id: ID!) {
    tree(id: $id, depth: 3) {
      ...clade
      children {
        ...clade
        children {
          ...clade
        }
      }
    }
  } 
```

User data like email and ID attached to every request.

Basic database query would be return all nodes and edges from root up to a certain depth.

Example SPARQL query:

```javascript
SELECT ?item ?itemLabel ?article
WHERE
{
  ?article  schema:about ?item ;
      schema:isPartOf <https://species.wikimedia.org/> .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
LIMIT 200
```