Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

The Insider's Guide to Accessing NLM Data

efetch


As new Insider's Guide classes are no longer being offered, this site is not currently being updated. Please refer to NCBI's E-utilities documentation for more up-to-date information.


The efetch command uses the EFetch utility to download records from an NCBI database in a specified format.

Input

One or more unique identifiers (UIDs; when fetching from PubMed, PMIDs). These UIDs can be specified in the -id argument (see below), or can be retrieved from the History server.

Output

One or more records displayed in a chosen format:

  • A list of UIDs (i.e. PMIDs).
  • Abstract view, formatted in plain text.
  • MEDLINE view, including the field indicators.
  • The full XML of the record.

Arguments

The efetch command allows the following arguments:

  • -db: The database from which you wish to retrieve records.
    • Example: -db pubmed
  • -id: One or more UIDs (PMIDs, if your -db argument is pubmed), separated by commas.
    • Example: -id 24102982,21171099,17150207
    • Example: -id 26287646
  • -format: Specifies the format in which you wish to display the records.
    • For PubMed, the valid formats include:
      • uid: displays a list of UIDs (i.e. PMIDs).
      • abstract: displays the Abstract view, formatted in plain text.
      • medline: displays the MEDLINE view, including the field indicators.
      • xml: displays the full PubMed XML.
    • Example: -format uid
    • Example: -format xml

Examples:

Retrieve the record for PMID 25359968 in MEDLINE format:

efetch -db pubmed -id 25359968 -format medline

Retrieve the record for PMID 26287646 in XML format:

efetch -db pubmed -id 26287646 -format xml

Retrieve the records for PMIDs 24102982, 21171099, and 17150207 in abstract view:

efetch -db pubmed -id 24102982,21171099,17150207 -format abstract

Last Reviewed: August 9, 2021