Skip to main content

ncbi-datasets-pyclient

NCBI Datasets is a resource that lets you easily gather data from NCBI.

The NCBI Datasets version 2 API is updated often to add new features, fix bugs, and enhance usability.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: v2
  • Package version: v18.37.0
  • Generator version: 7.25.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.10+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/misialq/ncbi-datasets-pyclient.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/misialq/ncbi-datasets-pyclient.git)

Then import the package:

import ncbi.datasets.openapi

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import ncbi.datasets.openapi

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import ncbi.datasets.openapi
from ncbi.datasets.openapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.ncbi.nlm.nih.gov/datasets/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = ncbi.datasets.openapi.Configuration(
    host = "https://api.ncbi.nlm.nih.gov/datasets/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKeyAuthHeader
configuration.api_key['ApiKeyAuthHeader'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuthHeader'] = 'Bearer'


# Enter a context with an instance of the API client
with ncbi.datasets.openapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ncbi.datasets.openapi.BioSampleApi(api_client)
    accessions = ['SAMN15960293'] # List[str] | 

    try:
        # Get BioSample dataset reports by accession(s)
        api_response = api_instance.bio_sample_dataset_report(accessions)
        print("The response of BioSampleApi->bio_sample_dataset_report:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BioSampleApi->bio_sample_dataset_report: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.ncbi.nlm.nih.gov/datasets/v2

Class Method HTTP request Description
BioSampleApi bio_sample_dataset_report GET /biosample/accession/{accessions}/biosample_report Get BioSample dataset reports by accession(s)
GeneApi download_gene_package GET /gene/id/{gene_ids}/download Get a gene data package by GeneID
GeneApi download_gene_package_post POST /gene/download Get a gene data package
GeneApi gene_chromosome_summary GET /gene/taxon/{taxon}/annotation/{annotation_name}/chromosome_summary Get gene counts per chromosome by taxon and annotation name
GeneApi gene_counts_for_taxon GET /gene/taxon/{taxon}/counts Get gene counts by taxon
GeneApi gene_counts_for_taxon_by_post POST /gene/taxon/counts Get gene counts by taxon
GeneApi gene_dataset_report POST /gene/dataset_report Get a gene data report
GeneApi gene_dataset_report_by_accession GET /gene/accession/{accessions}/dataset_report Get a gene data report by RefSeq nucleotide or protein accession
GeneApi gene_dataset_report_by_tax_and_symbol GET /gene/symbol/{symbols}/taxon/{taxon}/dataset_report Get a gene data report by symbol and taxon
GeneApi gene_dataset_reports_by_id GET /gene/id/{gene_ids}/dataset_report Get a gene data report by GeneID
GeneApi gene_dataset_reports_by_locus_tag GET /gene/locus_tag/{locus_tags}/dataset_report Get a gene data report by locus tag
GeneApi gene_dataset_reports_by_taxon GET /gene/taxon/{taxon}/dataset_report Get a gene data report by taxon
GeneApi gene_download_summary_by_id GET /gene/id/{gene_ids}/download_summary Get a download summary of a gene data package by GeneID
GeneApi gene_download_summary_by_post POST /gene/download_summary Get a download summary of a gene data package
GeneApi gene_expression_report POST /gene/expression_report Get a gene expression report
GeneApi gene_expression_reports_by_id GET /gene/id/{gene_ids}/expression_report Get a gene expression report by GeneID
GeneApi gene_links_by_id GET /gene/id/{gene_ids}/links Get gene links by GeneID
GeneApi gene_links_by_id_by_post POST /gene/links Get gene links by GeneID
GeneApi gene_metadata_by_accession GET /gene/accession/{accessions} Get gene metadata by RefSeq Accession
GeneApi gene_metadata_by_post POST /gene Get gene metadata as JSON
GeneApi gene_metadata_by_tax_and_symbol GET /gene/symbol/{symbols}/taxon/{taxon} Get gene metadata by gene symbol
GeneApi gene_orthologs_by_id GET /gene/id/{gene_id}/orthologs Get a gene data report for a gene ortholog set by GeneID
GeneApi gene_orthologs_by_post POST /gene/orthologs Get a gene data report for a gene ortholog set by GeneID
GeneApi gene_product_report POST /gene/product_report Get a gene product report
GeneApi gene_product_report_by_accession GET /gene/accession/{accessions}/product_report Get a gene product report by RefSeq nucleotide or protein accession
GeneApi gene_product_report_by_tax_and_symbol GET /gene/symbol/{symbols}/taxon/{taxon}/product_report Get a gene product report by symbol and taxon
GeneApi gene_product_reports_by_id GET /gene/id/{gene_ids}/product_report Get a gene product report by GeneID
GeneApi gene_product_reports_by_locus_tags GET /gene/locus_tag/{locus_tags}/product_report Get a gene product report by locus tag
GeneApi gene_product_reports_by_taxon GET /gene/taxon/{taxon}/product_report Get a gene product report by taxon
GeneApi gene_reports_by_id GET /gene/id/{gene_ids} Get gene reports by GeneID
GeneApi gene_reports_by_taxon GET /gene/taxon/{taxon} Get gene reports by taxonomic identifier
GenomeApi annotation_report_facets_by_accession GET /genome/accession/{accession}/annotation_summary Get genome annotation report summary information by genome assembly accession
GenomeApi annotation_report_facets_by_post POST /genome/annotation_summary Get genome annotation report summary information by genome assembly accession
GenomeApi assembly_accessions_for_sequence_accession GET /genome/sequence_accession/{accession}/sequence_assemblies Get a genome assembly accession for a nucleotide sequence accession
GenomeApi assembly_accessions_for_sequence_accession_by_post POST /genome/sequence_assemblies Get a genome assembly accession for a nucleotide sequence accession
GenomeApi assembly_revision_history_by_get GET /genome/accession/{accession}/revision_history Get a revision history for a genome assembly by genome assembly accession
GenomeApi assembly_revision_history_by_post POST /genome/revision_history Get a revision history for a genome assembly by genome assembly accession
GenomeApi check_assembly_availability GET /genome/accession/{accessions}/check Check the validity of a genome assembly accession
GenomeApi check_assembly_availability_post POST /genome/check Check the validity of a genome assembly accession
GenomeApi checkm_histogram_by_taxon GET /genome/taxon/{species_taxon}/checkm_histogram Get CheckM histogram data by species taxon
GenomeApi checkm_histogram_by_taxon_by_post POST /genome/checkm_histogram Get CheckM histogram data by species taxon
GenomeApi download_assembly_package GET /genome/accession/{accessions}/download Get a genome data package by genome assembly accession
GenomeApi download_assembly_package_post POST /genome/download Get a genome data package by genome assembly accession
GenomeApi download_genome_annotation_package GET /genome/accession/{accession}/annotation_report/download Get a genome annotation data package by genome assembly accession
GenomeApi download_genome_annotation_package_by_post POST /genome/annotation_report/download Get a genome annotation data package by genome assembly accession
GenomeApi genome_annotation_download_summary GET /genome/accession/{accession}/annotation_report/download_summary Get a download summary (preview) of a genome annotation data package by genome assembly accession
GenomeApi genome_annotation_download_summary_by_post POST /genome/annotation_report/download_summary Get a download summary (preview) of a genome annotation data package by genome assembly accession
GenomeApi genome_annotation_report GET /genome/accession/{accession}/annotation_report Get genome annotation reports by genome assembly accession
GenomeApi genome_annotation_report_by_post POST /genome/annotation_report Get genome annotation reports by genome assembly accession
GenomeApi genome_dataset_report GET /genome/accession/{accessions}/dataset_report Get a genome assembly report by genome assembly accession
GenomeApi genome_dataset_report_by_post POST /genome/dataset_report Get a genome assembly report
GenomeApi genome_dataset_reports_by_assembly_name GET /genome/assembly_name/{assembly_names}/dataset_report Get genome assembly reports by assembly name
GenomeApi genome_dataset_reports_by_bioproject GET /genome/bioproject/{bioprojects}/dataset_report Get genome assembly reports by BioProject accession
GenomeApi genome_dataset_reports_by_biosample_id GET /genome/biosample/{biosample_ids}/dataset_report Get genome assembly reports by BioSample accession
GenomeApi genome_dataset_reports_by_taxon GET /genome/taxon/{taxons}/dataset_report Get a genome assembly report by taxon
GenomeApi genome_dataset_reports_by_wgs GET /genome/wgs/{wgs_accessions}/dataset_report Get a genome assembly data report by WGS accession
GenomeApi genome_download_summary GET /genome/accession/{accessions}/download_summary Get a download summary (preview) of a genome data package by genome assembly accession
GenomeApi genome_download_summary_by_post POST /genome/download_summary Get a download summary (preview) of a genome data package by genome assembly accession
GenomeApi genome_links_by_accession GET /genome/accession/{accessions}/links Get assembly links by genome assembly accession
GenomeApi genome_links_by_accession_by_post POST /genome/links Get assembly links by genome assembly accession
GenomeApi genome_sequence_report GET /genome/accession/{accession}/sequence_reports Get a genome sequence report by genome assembly accession
GenomeApi genome_sequence_report_by_post POST /genome/sequence_reports Get a genome sequence report by genome assembly accession
OrganelleApi download_organelle_package GET /organelle/accession/{accessions}/download Get an organelle data package by nucleotide accession
OrganelleApi download_organelle_package_by_post POST /organelle/download Get an organelle data package
OrganelleApi organelle_datareport_by_accession GET /organelle/accessions/{accessions}/dataset_report Get an organelle data report by nucleotide accession
OrganelleApi organelle_datareport_by_post POST /organelle/dataset_report Get an organelle data report
OrganelleApi organelle_datareport_by_taxon GET /organelle/taxon/{taxons}/dataset_report Get an organelle data report by taxon
ProkaryoteApi download_prokaryote_gene_package GET /protein/accession/{accessions}/download Get a prokaryote gene data package by RefSeq protein accession
ProkaryoteApi download_prokaryote_gene_package_post POST /protein/accession/download Get a prokaryote gene data package by RefSeq protein accession
TaxonomyApi download_taxonomy_package GET /taxonomy/taxon/{tax_ids}/download Get a taxonomy data package by Taxonomy ID
TaxonomyApi download_taxonomy_package_by_post POST /taxonomy/download Get a taxonomy data package by Taxonomy ID
TaxonomyApi get_biocollections POST /taxonomy/biocollections/dataset_report Get a biocollection report by collection ID or code
TaxonomyApi get_biocollections_by_get GET /taxonomy/biocollections/id/{collection_ids}/dataset_report Get a biocollection report by collection ID or code
TaxonomyApi tax_name_query GET /taxonomy/taxon_suggest/{taxon_query} Get a list of taxonomy names and IDs by partial taxonomic name
TaxonomyApi tax_name_query_by_post POST /taxonomy/taxon_suggest Get a list of taxonomy names and IDs by partial taxonomic name
TaxonomyApi taxonomy_data_report GET /taxonomy/taxon/{taxons}/dataset_report Get a taxonomy data report by taxon
TaxonomyApi taxonomy_data_report_post POST /taxonomy/dataset_report Get a taxonomy data report by taxon
TaxonomyApi taxonomy_filtered_subtree GET /taxonomy/taxon/{taxons}/filtered_subtree Get a filtered taxonomic subtree by taxon
TaxonomyApi taxonomy_filtered_subtree_post POST /taxonomy/filtered_subtree Get a filtered taxonomic subtree by taxon
TaxonomyApi taxonomy_image GET /taxonomy/taxon/{taxon}/image Get a taxonomy image by taxon
TaxonomyApi taxonomy_image_metadata GET /taxonomy/taxon/{taxon}/image/metadata Get taxonomy image metadata by Taxonomy ID
TaxonomyApi taxonomy_image_metadata_post POST /taxonomy/image/metadata Get taxonomy image metadata by Taxonomy ID
TaxonomyApi taxonomy_image_post POST /taxonomy/image Get a taxonomy image by taxon
TaxonomyApi taxonomy_links GET /taxonomy/taxon/{taxon}/links Get external links by Taxonomy ID
TaxonomyApi taxonomy_links_by_post POST /taxonomy/links Get external links by Taxonomy ID
TaxonomyApi taxonomy_metadata GET /taxonomy/taxon/{taxons} Use taxonomic identifiers to get taxonomic metadata
TaxonomyApi taxonomy_metadata_post POST /taxonomy Get taxonomy metadata by taxon
TaxonomyApi taxonomy_names GET /taxonomy/taxon/{taxons}/name_report Get a taxonomy names report by taxon
TaxonomyApi taxonomy_names_post POST /taxonomy/name_report Get a taxonomy names report by taxon
TaxonomyApi taxonomy_related_ids GET /taxonomy/taxon/{tax_id}/related_ids Get child nodes, and optionally parent nodes, for a given taxon by Taxonomy ID
TaxonomyApi taxonomy_related_ids_post POST /taxonomy/related_ids Get child nodes, and optionally parent nodes, for a given taxon by Taxonomy ID
VersionApi version GET /version Retrieve service version
VirusApi sars2_protein_download GET /virus/taxon/sars2/protein/{proteins}/download Get a SARS-CoV-2 protein data package by protein name
VirusApi sars2_protein_download_post POST /virus/taxon/sars2/protein/download Get a SARS-CoV-2 protein data package
VirusApi sars2_protein_summary GET /virus/taxon/sars2/protein/{proteins} Get a download summary of a SARS-CoV-2 protein data package by protein name
VirusApi sars2_protein_summary_by_post POST /virus/taxon/sars2/protein Get a download summary of a SARS-CoV-2 protein data package by protein name
VirusApi sars2_protein_table GET /virus/taxon/sars2/protein/{proteins}/table Get SARS-CoV-2 protein metadata in a tabular format by protein name
VirusApi virus_accession_availability GET /virus/accession/{accessions}/check Check the validity of a virus genome nucleotide accession
VirusApi virus_accession_availability_post POST /virus/check Check the validity of a virus genome nucleotide accession
VirusApi virus_annotation_reports_by_acessions GET /virus/accession/{accessions}/annotation_report Get a virus annotation report by nucleotide accession
VirusApi virus_annotation_reports_by_post POST /virus/annotation_report Get a virus annotation report
VirusApi virus_annotation_reports_by_taxon GET /virus/taxon/{taxon}/annotation_report Get a virus annotation report by taxon
VirusApi virus_genome_download GET /virus/taxon/{taxon}/genome/download Get a virus genome data package by taxon
VirusApi virus_genome_download_accession GET /virus/accession/{accessions}/genome/download Get a virus genome data package by nucleotide accession
VirusApi virus_genome_download_post POST /virus/genome/download Get a virus genome data package
VirusApi virus_genome_summary GET /virus/taxon/{taxon}/genome Get a download summary of a virus genome data package by taxon
VirusApi virus_genome_summary_by_post POST /virus/genome Get a download summary of a virus genome data package
VirusApi virus_genome_table GET /virus/taxon/{taxon}/genome/table Get virus genome metadata in a tabular format
VirusApi virus_reports_by_acessions GET /virus/accession/{accessions}/dataset_report Get a virus data report by nucleotide accession
VirusApi virus_reports_by_post POST /virus Get a virus data report
VirusApi virus_reports_by_taxon GET /virus/taxon/{taxon}/dataset_report Get a virus data report by taxon

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: api_key
  • Location: URL query string

ApiKeyAuthHeader

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

Author

Metadata

Release files for ncbi-datasets-pyclient 18.37.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ncbi-datasets-pyclient 18.37.0
File Size Uploaded
ncbi_datasets_pyclient-18.37.0.tar.gz 285.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ncbi-datasets-pyclient 18.37.0
File Interpreter ABI Platform
ncbi_datasets_pyclient-18.37.0-py3-none-any.whl Python 3 none any Details

Total release size: 907.6 kB

Release files / ncbi_datasets_pyclient-18.37.0.tar.gz

Download URL ncbi_datasets_pyclient-18.37.0.tar.gz
Size 285.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3bba8a7fc9e63b5fca00480fbcb74f94dc12b03559f17b08b516dc7b0411c98f
BLAKE2b-256 checksum
How to use checksums
030633793028e1a1ca4f605a870ec6b20a144717928d66959d874232e926a2fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / ncbi_datasets_pyclient-18.37.0-py3-none-any.whl

Download URL ncbi_datasets_pyclient-18.37.0-py3-none-any.whl
Size 622.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6fff2f9db1bd6af35ab3872f1b9b999288b41b2926a4c116492c7f3c4b96e10
BLAKE2b-256 checksum
How to use checksums
fa12bfb380f41b7637c1c491059ebe6d46864f2ff187a27ba48d233cb6e6dd9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page