# Occurrence inventory for species

**URL:** https://discourse.gbif.org/t/occurrence-inventory-for-species/3465
**Category:** Data Use
**Created:** [August 23, 2022, 7:33pm UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465 "2022-08-23T19:33:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![larsgw](https://sea1.discourse-cdn.com/gbif1/user_avatar/discourse.gbif.org/larsgw/32/715_2.png) [@larsgw](https://discourse.gbif.org/u/larsgw)
#### Post date: [August 23, 2022, 7:33pm UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465/1 "2022-08-23T19:33:50Z")

</div>

I would like to create a checklist of species based on a taxon key and a country code, from the API, for use in a demo web app. This is nearly possible in several distinct ways, but never entirely:

- [Occurrence metrics](https://www.gbif.org/developer/occurrence#metrics) can show counts by species (optionally filtered by country), but only one species at a time (and without being able to list all occurring species).
- [Occurrence inventories](https://www.gbif.org/developer/occurrence#inventories) show occurrence counts (optionally filtered by country and parent taxon) split by year, dataset etc., but not split by species.
- [Such species lists can be downloaded](https://discourse.gbif.org/t/new-feature-download-lists-of-distinct-species-contained-in-occurrence-searches/687), but this requires creating downloads (which is too overkill and permanent for my purposes) and requires logging in (which is not ideal in the web app).
- There is an internal API path to do this, e.g. `https://www.gbif.org/api/occurrence/breakdown?advanced=false&country=BE&dimension=speciesKey&taxon_key=10501569` for `BE` (Belgium) and `10501569` (_Chrysis_), but this path cannot be used outside of the GBIF domain due to Cross-Origin Resource Sharing and has no equivalent in the public API as far as I can tell.

Is this possible in some way I have not found? If not, can I request adding support for a `taxonKey` (or `speciesKey`) property to the Occurrence Inventories API?

I can understand something like this having performance reasons but I hope that is not the case here, as it is already supported in the internal API.

---

<div class="post-metadata">

### Author: ![mgrosjean](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@mgrosjean](https://discourse.gbif.org/u/mgrosjean)
#### Post date: [August 25, 2022, 11:29am UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465/2 "2022-08-25T11:29:47Z")

</div>

Hi @larsgw the easiest would probably be to use the `facet` parameters of the `occurrence/search` ([GBIF occurrence API](https://www.gbif.org/developer/occurrence#search)).  
For example: [https://api.gbif.org/v1/occurrence/search?country=BE&taxon\_key=10501569&limit=0&facet=scientificName&facetLimit=100](https://api.gbif.org/v1/occurrence/search?country=BE&taxon_key=10501569&limit=0&facet=scientificName&facetLimit=100)  
You can page through the facets by using the `facetLimit` and `facetOffset` parameters. You can also choose a different facet than scientific name and you can even work with multiple facets.

Is this what you had in mind?  
Let us know, thanks!

---

<div class="post-metadata">

### Author: ![larsgw](https://sea1.discourse-cdn.com/gbif1/user_avatar/discourse.gbif.org/larsgw/32/715_2.png) [@larsgw](https://discourse.gbif.org/u/larsgw)
#### Post date: [August 25, 2022, 2:09pm UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465/3 "2022-08-25T14:09:59Z")

</div>

Thank you. This is, again, _nearly_ what I was hoping for. In my use case I would like to compare the checklist against various lists of GBIF species identifiers (extracted from identification keys) to find the best match, but the facets returned here don’t seem to have the GBIF identifier of the species unfortunately. I could try to map the GBIF IDs in the lists from the keys to species names to match them that way but I’d be worried about multiple distinct species with the same label (though I’m not sure if that happens much in the backbone).

---

<div class="post-metadata">

### Author: ![mgrosjean](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@mgrosjean](https://discourse.gbif.org/u/mgrosjean)
#### Post date: [August 25, 2022, 6:03pm UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465/4 "2022-08-25T18:03:02Z")

</div>

Hi @larsgw, you can choose the facet to get the `taxonKey` instead: [https://api.gbif.org/v1/occurrence/search?country=BE&taxon\_key=10501569&limit=0&facet=taxonKey&facetLimit=100](https://api.gbif.org/v1/occurrence/search?country=BE&taxon_key=10501569&limit=0&facet=taxonKey&facetLimit=100)  
or the `speciesKey`: [https://api.gbif.org/v1/occurrence/search?country=BE&taxon\_key=10501569&limit=0&facet=speciesKey&facetLimit=100](https://api.gbif.org/v1/occurrence/search?country=BE&taxon_key=10501569&limit=0&facet=speciesKey&facetLimit=100)  
Would that work?

---

<div class="post-metadata">

### Author: ![larsgw](https://sea1.discourse-cdn.com/gbif1/user_avatar/discourse.gbif.org/larsgw/32/715_2.png) [@larsgw](https://discourse.gbif.org/u/larsgw)
#### Post date: [August 25, 2022, 6:59pm UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465/5 "2022-08-25T18:59:58Z")

</div>

Oh I see, that’s perfect. Thank you!

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/gbif1/original/1X/d2525d53d815eb0c992cc44730ed8a6a1be1dbb5.png) [@system](https://discourse.gbif.org/u/system)
#### Post date: [September 25, 2022, 5:00am UTC](https://discourse.gbif.org/t/occurrence-inventory-for-species/3465/6 "2022-09-25T05:00:05Z")

</div>

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