Querying for all ranks that appear within a parent rank


I’m looking for a solution to accurately getting all (more distant-descendend) children of any given parent rank. E.g. it would yield all genera that appear within the order Cetacea (whale), or every species.

This is the closest that I’ve come up with:

This would yield 57 species bird of paradise within the family Paradisaeidae. So it mostly works, except that it also gives me 6 Arachnida (class, of the phylum Arthropoda). I’ve solved this by looping the results through a condition that checks whether the family is Paradisaeidae.
Nontheless, what I’m looking for is a “cleaner” search, where within the GBIF backbone DB it would simply give me every child of the tree (or whatever the datastructure is) of any lower rank I want, like all genera within an order, or all species of a family.

Thank you and kind regards

Hi @Simon

I suggest to first use the match API to get the backbone key (taxonKey) and then use the Search API.
For example:

https://api.gbif.org/v1/species/match?verbose=true&name=Cetacea gives you the usageKey for Cetacea which you can then use in another call:
https://api.gbif.org/v1/species/search?higherTaxonKey=733&rank=species (you will want to page through the results with the limit and offset parameters).
This is the equivalent of this search on the website: Search
You can also refine the search, for example, select only the accepted names.

This blogpost might be helpful as well: (Almost) everything you want to know about the GBIF Species API - GBIF Data Blog, it explains the difference between the search and match functions in the species API.

1 Like

Thanks a lot @mgrosjean
This is what I’ve been looking for!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.