# GBIF Species Occurrence Scraper — Biodiversity Records (`devilscrapes/gbif-species-occurrence-scraper`) Actor

Search GBIF's 3B+ record global biodiversity index by species name, country, year, or dataset and export clean rows — full taxonomy, event date, coordinates, basis of record, and dataset provenance — as JSON, CSV, or Excel.

- **URL**: https://apify.com/devilscrapes/gbif-species-occurrence-scraper.md
- **Developed by:** [DevilScrapes](https://apify.com/devilscrapes) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

<div align="center">
  <img src=".actor/icon.svg" width="160" alt="Devil Scrapes mark" />

## GBIF Species Occurrence Scraper — Biodiversity Records

**💰 $2.05 / 1 000 results**  ·  pay only for results  ·  no credit card to try

*The devil's in the data — we just flatten it for you.* 😈

Search GBIF's 3B+ record global biodiversity index by species name, country, year, or dataset and export clean rows — full taxonomy, event date, coordinates, basis of record, and dataset provenance — as JSON, CSV, or Excel.

</div>

***

### 🎯 What this scrapes

GBIF (the Global Biodiversity Information Facility) aggregates species occurrence records from museums, herbaria, citizen-science apps and government surveys into one searchable index of over three billion records. Its raw API is generous and keyless, but it forces callers to look up an internal `taxonKey` before they can filter by species, and most occurrence records are sparse — a huge share of optional fields are simply absent on any given row. This Actor resolves a plain species name to that taxon key for you, then returns fully flattened, typed rows so a distribution map, an ESG nature-risk screen, or a species checklist lands straight in a spreadsheet.

### 🔥 What we handle for you

resolves a species name to GBIF's internal taxon key automatically
pages past sparse, deeply nested records into one clean flat row each
stops cleanly at GBIF's ~100 000-record offset ceiling instead of erroring into it
retries transient 429/5xx responses with backoff instead of failing the whole run

### 💡 Use cases

- Build a species distribution map from georeferenced occurrence records.
- Screen a project site or supply chain footprint for nearby protected or at-risk species (ESG / nature-risk analysis).
- Assemble a country or region species checklist for an environmental impact assessment.
- Track how observation records for a species change year over year across citizen-science and museum datasets.

### ⚙️ How to use it

1. Click **Try for free** at the top of the page.
2. Type a species name (or leave the default) — most other fields have sensible defaults.
3. Click **Start**. Output streams into the run's dataset.
4. Export from **Storage → Dataset** as JSON, CSV, or Excel — or fetch via the API.

### 📥 Input

| Field | Type | Required | Default | Notes |
|---|---|:--:|---|---|
| `scientificName` | `string` | no | 'Puma concolor' | Species name to resolve to a GBIF taxon key. Takes priority over `taxonKey`. |
| `taxonKey` | `integer` | no | — | Raw GBIF taxon key, used only when `scientificName` is empty. |
| `query` | `string` | no | — | Free-text search across occurrence records. |
| `countryCode` | `string` | no | — | Restrict to one ISO-3166-1 alpha-2 country code, e.g. `US`. |
| `yearFrom` / `yearTo` | `integer` | no | — | Only occurrences recorded within this year range. |
| `hasCoordinate` | `boolean` | no | True | Restrict to georeferenced records. |
| `basisOfRecord` | `string` | no | — | Restrict to one basis-of-record type, e.g. `HUMAN_OBSERVATION`. |
| `datasetKey` | `string` | no | — | Restrict to one GBIF publisher dataset (UUID). |
| `maxResults` | `integer` | no | 100 | Stop after this many occurrences. Each row is one billed result. |
| `proxyConfiguration` | `object` | no | `{"useApifyProxy": false}` | GBIF is a public API and does not need a proxy. |

#### Example input

```json
{
  "scientificName": "Puma concolor",
  "hasCoordinate": true,
  "maxResults": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### 📤 Output

Every row is one dataset item.

| Field | Type | Notes |
|---|---|---|
| `occurrence_key` | `integer` | GBIF occurrence identifier. |
| `scientific_name` | `string` | Scientific name as recorded. |
| `accepted_scientific_name` | `string` | GBIF's accepted taxon name. |
| `taxon_rank` | `string` | Taxonomic rank, e.g. `SPECIES`. |
| `kingdom` / `phylum` / `class_` / `order` / `family` / `genus` / `species` | `string` | Full classification. |
| `event_date` / `year` / `month` / `day` | `string` / `integer` | When the occurrence was recorded. |
| `country` / `country_code` | `string` | Where the occurrence was recorded. |
| `locality` / `state_province` | `string` | Finer-grained location detail. |
| `decimal_latitude` / `decimal_longitude` | `number` | Coordinates in decimal degrees. |
| `coordinate_uncertainty_m` | `number` | Coordinate uncertainty, in metres. |
| `elevation_m` / `depth_m` | `number` | Elevation / depth, in metres. |
| `basis_of_record` | `string` | How the occurrence was recorded. |
| `dataset_name` / `dataset_key` | `string` | Publishing dataset. |
| `publishing_org_key` | `string` | GBIF publishing organization UUID. |
| `institution_code` / `collection_code` / `catalog_number` | `string` | Specimen/record provenance. |
| `recorded_by` / `identified_by` | `string` | Who recorded/identified the occurrence. |
| `license` | `string` | Data license, e.g. `CC_BY_4_0`. |
| `issues` | `array` | GBIF data-quality issue flags. |

#### Example output

```json
{
  "occurrence_key": 5938145577,
  "scientific_name": "Puma concolor (Linnaeus, 1771)",
  "taxon_rank": "SPECIES",
  "kingdom": "Animalia",
  "class_": "Mammalia",
  "family": "Felidae",
  "genus": "Puma",
  "species": "Puma concolor",
  "year": 2026,
  "month": 1,
  "day": 2,
  "country": "United States of America",
  "country_code": "US",
  "state_province": "Oregon",
  "decimal_latitude": 44.59237,
  "decimal_longitude": -121.27005,
  "basis_of_record": "HUMAN_OBSERVATION",
  "dataset_name": "iNaturalist research-grade observations",
  "license": "http://creativecommons.org/licenses/by-nc/4.0/legalcode",
  "issues": ["CONTINENT_DERIVED_FROM_COORDINATES", "TAXON_ID_NOT_FOUND"]
}
```

### 💰 Pricing

Pay-Per-Event — you pay only when these events fire:

| Event | USD | What it is |
|---|---:|---|
| `actor-start` | $0.05 | One-off warm-up charge per run |
| `result` | $0.002 | Per dataset item |

Example: 1 000 results at the rates above ≈ **$2.05**. No subscription, no minimum, no card to start — Apify gives every new account $5 of free credit.

### 🚧 Limitations

- Live search results only — this Actor does not use GBIF's asynchronous bulk Darwin Core Archive download.
- No media/image download — occurrence records may reference photos, but files are not fetched or mirrored.
- GBIF's search API caps how deep any single search can page (~100 000 records); narrow by country, year, or basis of record to reach records beyond that.

### ❓ FAQ

**Do I need an API key?**

No. GBIF is free and keyless — no account, no auth header, no signup.

**What if my species name doesn't match?**

The Actor logs the resolved taxon and rank so you can verify the match. If GBIF can't resolve a name at all, the Actor falls back to an unfiltered-by-taxon search rather than silently returning nothing.

**Why are so many fields empty?**

GBIF occurrence records are contributed by thousands of independent institutions with wildly varying completeness — a museum specimen from 1950 rarely has GPS coordinates, for example. Every field is nullable by design; this Actor never fabricates a value GBIF didn't report.

### 💬 Your feedback

Spotted a bug, hit a weird edge case, or need a new field? Open an
issue on the Actor's **Issues** tab on Apify Console — we ship
fixes weekly and we read every report.

***

<div align="center">

Built by **[Devil Scrapes](https://apify.com/DevilScrapes)** 😈 — a small fleet of
opinionated public-data Actors. Honest pricing, real engineering, zero fine print.

</div>

# Actor input Schema

## `scientificName` (type: `string`):

Species name to resolve to a GBIF taxon key, e.g. <code>Puma concolor</code>. Takes priority over Taxon key. Leave empty to skip name resolution.

## `taxonKey` (type: `integer`):

Raw GBIF taxon key, used only when Scientific name is empty.

## `query` (type: `string`):

Free-text search across occurrence records. Leave empty if you are filtering only.

## `countryCode` (type: `string`):

Restrict to one ISO-3166-1 alpha-2 country code, e.g. <code>US</code>.

## `yearFrom` (type: `integer`):

Only occurrences recorded on or after this year.

## `yearTo` (type: `integer`):

Only occurrences recorded on or before this year.

## `hasCoordinate` (type: `boolean`):

Restrict to georeferenced records (has a decimal latitude/longitude).

## `basisOfRecord` (type: `string`):

Restrict to one GBIF basis-of-record type.

## `datasetKey` (type: `string`):

Restrict to one GBIF publisher dataset (UUID).

## `maxResults` (type: `integer`):

Stop after this many occurrences. Each row is one billed result. Hard-capped at GBIF's ~100 000 offset ceiling.

## `proxyConfiguration` (type: `object`):

GBIF is a public API and does not need a proxy. Leave this off unless your account requires egress through Apify Proxy.

## Actor input object example

```json
{
  "scientificName": "Puma concolor",
  "hasCoordinate": true,
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

All dataset items as JSON.

## `datasetItemsCsv` (type: `string`):

Same data exported to CSV.

## `datasetView` (type: `string`):

Open the run dataset in the Console.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "scientificName": "Puma concolor",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("devilscrapes/gbif-species-occurrence-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "scientificName": "Puma concolor",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("devilscrapes/gbif-species-occurrence-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "scientificName": "Puma concolor",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call devilscrapes/gbif-species-occurrence-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devilscrapes/gbif-species-occurrence-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/m8woeqfcr7F6BNVVj/builds/2PsqtUnp1Ccs4URh0/openapi.json
