# NCBI Genome Assemblies Scraper (`ninhothedev/ncbi-genomes-scraper`) Actor

$0.5/1K 🔥 NCBI Genomes! List genome assemblies by taxon with stats & accessions. No key. JSON, CSV, Excel or API in seconds. Source reference genomes for pipelines ⚡

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

## Pricing

from $0.50 / 1,000 results

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/actors/running/actors-in-store.md#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

## NCBI Genome Assemblies Scraper

Pull structured **genome assembly reports** straight from the [NCBI Datasets v2](https://www.ncbi.nlm.nih.gov/datasets/) API — assembly quality stats (**N50**, contig & scaffold counts, total length, GC%), organism/taxonomy, **BioProject**, submitter and annotation gene counts — by **organism/taxon** or by **assembly accession**. No API key, no login, no scraping HTML.

Runs on ~$0.50 per 1,000 assemblies of compute — the data itself is free and public.

### What you get

For every assembly, one clean JSON record:

| Field | Example |
|---|---|
| `accession` / `current_accession` | `GCF_000001405.40` |
| `organism`, `tax_id`, `common_name` | `Homo sapiens`, `9606`, `human` |
| `assembly_name`, `assembly_level` | `GRCh38.p14`, `Chromosome` |
| `assembly_type`, `refseq_category` | `haploid-with-alt-loci`, `reference genome` |
| `bioproject`, `submitter`, `submission_date` | `PRJNA31257`, `Genome Reference Consortium`, `2022-02-03` |
| `total_length_bp`, `gc_percent`, `chromosome_count` | `3099441038`, `41.0`, `24` |
| `contig_count`, `contig_n50` | contiguity metrics |
| `scaffold_count`, `scaffold_n50` | scaffolding metrics |
| `gene_total`, `protein_coding_genes` | `59792`, `20076` |
| `annotation_provider`, `annotation_release_date` | `NCBI RefSeq`, `2025-08-01` |
| `url`, `source`, `scraped_at` | canonical NCBI Datasets page + metadata |

All numeric fields are real numbers (not strings). Every field is nullable.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `mode` | select | `taxon` | `taxon` (all assemblies for organisms) or `accessions` (explicit accessions) |
| `taxa` | array | `["human","Escherichia coli","Arabidopsis thaliana"]` | organism names, common names or Tax IDs |
| `accessions` | array | `["GCF_000001405.40"]` | GenBank/RefSeq assembly accessions |
| `assemblyLevel` | select | `any` | `any` / `complete` / `chromosome` / `scaffold` / `contig` (taxon mode) |
| `referenceOnly` | boolean | `false` | only RefSeq reference/representative genomes (taxon mode) |
| `maxItems` | integer | `200` | cap across all inputs (max 5000) |

#### Example

```json
{
  "mode": "taxon",
  "taxa": ["Escherichia coli"],
  "assemblyLevel": "complete",
  "referenceOnly": false,
  "maxItems": 500
}
```

### Use cases

- **Comparative genomics** — pull every assembly for a clade and compare length, GC% and gene counts side by side.
- **Assembly QC** — screen contig/scaffold N50 and contig counts to flag fragmented or low-quality assemblies.
- **Bioinformatics pipelines** — resolve accessions to metadata (organism, BioProject, annotation) as a pipeline lookup step.
- **Reference selection** — use `referenceOnly` to grab the canonical reference/representative genome per organism.

### How is this different from `ncbi-eutils-scraper`?

Both hit NCBI, but they are **different products for different data**:

- **[ncbi-eutils-scraper](https://apify.com/ninhothedev/ncbi-eutils-scraper)** uses the classic **E-utilities** (esearch/efetch/esummary). It is built for **literature and gene search** — PubMed articles, Gene records, and other text/entity databases.
- **This actor (NCBI Genome Assemblies Scraper)** uses the modern **NCBI Datasets v2** API. It is built for **genome assemblies and their statistics** — N50, contig/scaffold counts, total length, GC%, BioProject and annotation gene counts, returned as flat typed records.

Use the E-utils actor when you want papers or gene entries; use this one when you want assembly-level genome data and quality metrics.

### Related actors

- [ncbi-eutils-scraper](https://apify.com/ninhothedev/ncbi-eutils-scraper) — PubMed / Gene literature and entity search
- [ensembl-scraper](https://apify.com/ninhothedev/ensembl-scraper) — Ensembl genes, transcripts and cross-references
- [uniprot-scraper](https://apify.com/ninhothedev/uniprot-scraper) — UniProt protein entries
- [interpro-scraper](https://apify.com/ninhothedev/interpro-scraper) — InterPro protein domains and families

### Notes

Data comes from the free public NCBI Datasets v2 API (`https://api.ncbi.nlm.nih.gov/datasets/v2alpha`) with **no API key required**. Please respect NCBI's usage policy. This actor is not affiliated with or endorsed by NCBI/NLM/NIH.

# Actor input Schema

## `mode` (type: `string`):

How to look up assemblies. 'taxon' returns every genome assembly for the organisms/taxa listed in 'taxa'. 'accessions' returns exactly the assembly accessions listed in 'accessions'.

## `taxa` (type: `array`):

Used when mode = 'taxon'. Each entry is an organism name, common name or NCBI Tax ID (e.g. 'human', 'Escherichia coli', 'Arabidopsis thaliana', '9606'). All assemblies under each taxon are returned.

## `accessions` (type: `array`):

Used when mode = 'accessions'. Explicit GenBank/RefSeq assembly accessions (e.g. 'GCF\_000001405.40', 'GCA\_000005845.2').

## `assemblyLevel` (type: `string`):

Only for mode = 'taxon'. Restrict to a given assembly level. 'any' returns all levels.

## `referenceOnly` (type: `boolean`):

Only for mode = 'taxon'. If enabled, returns only RefSeq reference or representative genomes (best-quality assembly per organism).

## `maxItems` (type: `integer`):

Maximum number of genome assembly records to return across all taxa/accessions.

## Actor input object example

```json
{
  "mode": "taxon",
  "taxa": [
    "human",
    "Escherichia coli",
    "Arabidopsis thaliana"
  ],
  "accessions": [
    "GCF_000001405.40"
  ],
  "assemblyLevel": "any",
  "referenceOnly": false,
  "maxItems": 200
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "taxa": [
        "human",
        "Escherichia coli",
        "Arabidopsis thaliana"
    ],
    "accessions": [
        "GCF_000001405.40"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/ncbi-genomes-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 = {
    "taxa": [
        "human",
        "Escherichia coli",
        "Arabidopsis thaliana",
    ],
    "accessions": ["GCF_000001405.40"],
}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/ncbi-genomes-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 '{
  "taxa": [
    "human",
    "Escherichia coli",
    "Arabidopsis thaliana"
  ],
  "accessions": [
    "GCF_000001405.40"
  ]
}' |
apify call ninhothedev/ncbi-genomes-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/ncbi-genomes-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/5LpZ2t7sLzlKIZY5f/builds/jgzkSDoXK6CPW4NVA/openapi.json
