pubmed-client (Node.js)
    Preparing search index...

    Class PubMedClient

    PubMed/PMC API client

    Index
    • Check if a PubMed article has full-text available in PMC

      Parameters

      • pmid: string

        PubMed ID

      Returns Promise<string | null>

      PMC ID if available, null otherwise

    • Download a PMC article's Open Access files to a directory

      Downloads each of the article's files individually from the PMC OA Cloud (AWS S3) service for the given PMC ID, returning the list of downloaded file paths.

      Parameters

      • pmcid: string

        PMC ID (e.g., "PMC7906746")

      • outputDir: string

        Directory to download files into

      Returns Promise<string[]>

      Array of downloaded file paths

    • Upload a list of PMIDs to the NCBI History server using EPost

      Stores UIDs on the server and returns WebEnv/query_key identifiers that can be used with subsequent API calls.

      Parameters

      • pmids: string[]

        Array of PubMed IDs as strings

      Returns Promise<EPostResult>

      EPostResult containing webenv and query_key

      const client = new PubMedClient();
      const result = await client.epost(["31978945", "33515491", "25760099"]);
      console.log(`WebEnv: ${result.webenv}, Query Key: ${result.queryKey}`);
    • Download a Europe PMC record's supplementary-files ZIP archive

      Europe PMC returns supplementary materials as a single ZIP; unpacking is left to the caller.

      Parameters

      • id: string

        Record id, bare or fully qualified

      • outputPath: string

        Full path of the ZIP file to write

      • Optionalsource: string | null

        Source database (MED, PMC, PPR, AGR, CBA, PAT)

      Returns Promise<string>

      The written path

    • Fetch and parse the full text of a Europe PMC record

      Parsing into an article requires a PMC id, so this supports PMC-sourced records only; use europePmcFetchFullTextXml for other sources.

      Parameters

      • id: string

        Record id, bare or fully qualified

      • Optionalsource: string | null

        Source database (MED, PMC, PPR, AGR, CBA, PAT)

      Returns Promise<FullTextArticle>

      Structured full-text article

    • Fetch the raw JATS XML full text of a Europe PMC record

      Parameters

      • id: string

        Record id, bare or fully qualified

      • Optionalsource: string | null

        Source database (MED, PMC, PPR, AGR, CBA, PAT)

      Returns Promise<string>

      JATS XML

    • List the articles citing a Europe PMC record

      Broader coverage than getCitations, which is PubMed-only: includes preprints and other non-PubMed sources.

      Parameters

      • id: string

        Record id, bare or fully qualified

      • Optionalsource: string | null

        Source database (MED, PMC, PPR, AGR, CBA, PAT)

      Returns Promise<EuropePmcCitationEntry[]>

      Array of citing articles

    • List cross-references from a Europe PMC record to external databases

      Parameters

      • id: string

        Record id, bare or fully qualified

      • Optionalsource: string | null

        Source database (MED, PMC, PPR, AGR, CBA, PAT)

      Returns Promise<EuropePmcDatabaseLinkEntry[]>

      Array of per-database cross-reference groups

    • List the works cited by a Europe PMC record

      Parameters

      • id: string

        Record id, bare or fully qualified

      • Optionalsource: string | null

        Source database (MED, PMC, PPR, AGR, CBA, PAT)

      Returns Promise<EuropePmcReferenceEntry[]>

      Array of cited works

    • Search Europe PMC across every source it indexes

      Parameters

      • query: string

        Europe PMC query (e.g., "TITLE:CRISPR AND SRC:PPR")

      • Optionallimit: number | null

        Maximum number of records to return (default: 10)

      • OptionalresultType: string | null

        "idlist", "lite" (default) or "core"

      • Optionalsort: string | null

        Europe PMC sort expression (e.g., "CITED desc")

      Returns Promise<EuropePmcSearchResult[]>

      Array of Europe PMC records

    • Fetch a single page of Europe PMC search results

      Pass the returned nextCursorMark back as cursorMark to page through a result set; Europe PMC signals the end by returning the same cursor.

      Parameters

      • query: string

        Europe PMC query

      • OptionalresultType: string | null

        "idlist", "lite" (default) or "core"

      • OptionalpageSize: number | null

        Records per page, 1-1000 (default: 25)

      • OptionalcursorMark: string | null

        Cursor for the page to fetch; "*" (default) is the first page

      • Optionalsort: string | null

        Europe PMC sort expression

      Returns Promise<EuropePmcSearchPage>

      One page of records, with the total hit count and next cursor

    • Export articles as BibTeX

      Fetches the given PMIDs and formats them as a BibTeX bibliography.

      Parameters

      • pmids: string[]

        Array of PubMed IDs as strings

      Returns Promise<string>

      BibTeX string

    • Export articles as CSL-JSON

      Parameters

      • pmids: string[]

        Array of PubMed IDs as strings

      Returns Promise<string>

      CSL-JSON string (array of items)

    • Export articles in MEDLINE/NBIB format

      Parameters

      • pmids: string[]

        Array of PubMed IDs as strings

      Returns Promise<string>

      NBIB string

    • Export articles in RIS format

      Parameters

      • pmids: string[]

        Array of PubMed IDs as strings

      Returns Promise<string>

      RIS string

    • Extract figures with their captions from a PMC article

      Downloads the Open Access package, extracts figure image files, and associates them with caption metadata from the article XML.

      Parameters

      • pmcid: string

        PMC ID (e.g., "PMC7906746")

      • outputDir: string

        Directory to extract figure files into

      Returns Promise<ExtractedFigure[]>

      Array of extracted figures with file metadata

    • Fetch all articles for a list of PMIDs using EPost and the History server

      Uploads the PMID list via EPost (HTTP POST), then fetches articles in paginated batches. Recommended for large PMID lists (hundreds or thousands).

      Parameters

      • pmids: string[]

        Array of PubMed IDs as strings

      Returns Promise<Article[]>

      Array of article metadata

      const client = new PubMedClient();
      const articles = await client.fetchAllByPmids(["31978945", "33515491", "25760099"]);
      articles.forEach(a => console.log(a.title));
    • Fetch a single article by PMID

      Parameters

      • pmid: string

        PubMed ID

      Returns Promise<Article>

      Article metadata

    • Fetch multiple articles by PMIDs in a single batch request

      This is significantly more efficient than fetching articles one by one. For large numbers of PMIDs, requests are automatically batched (200 per request).

      Parameters

      • pmids: string[]

        Array of PubMed IDs

      Returns Promise<Article[]>

      Array of article metadata

    • Fetch full-text article from PMC

      Parameters

      • pmcid: string

        PMC ID (e.g., "PMC7906746")

      Returns Promise<FullTextArticle>

      Full-text article data

    • Fetch PMC article and convert to Markdown

      Parameters

      • pmcid: string

        PMC ID (e.g., "PMC7906746")

      • Optionaloptions: MarkdownOptions | null

        Markdown conversion options

      Returns Promise<string>

      Markdown string

    • Fetch lightweight article summaries by PMIDs using the ESummary API

      Returns basic metadata (title, authors, journal, dates, DOI) without abstracts, MeSH terms, or chemical lists. Faster than fetchArticles().

      Parameters

      • pmids: string[]

        Array of PubMed IDs

      Returns Promise<Summary[]>

      Array of article summaries

    • Get citing articles for the given PMIDs using the ELink API

      Parameters

      • pmids: number[]

        Array of PubMed IDs

      Returns Promise<Citations>

      Citing articles

    • Get detailed information about a specific NCBI database using the EInfo API

      Parameters

      • database: string

        Database name (e.g., "pubmed", "pmc")

      Returns Promise<DatabaseInfo>

      Database information

    • List all available NCBI databases using the EInfo API

      Returns Promise<string[]>

      Array of database names

    • Get PMC links for the given PMIDs (check full-text availability)

      Parameters

      • pmids: number[]

        Array of PubMed IDs

      Returns Promise<PmcLinks>

      PMC links

    • Get related articles for the given PMIDs using the ELink API

      Parameters

      • pmids: number[]

        Array of PubMed IDs

      Returns Promise<RelatedArticles>

      Related articles

    • Check if a PMC article is in the OA (Open Access) subset

      The OA subset contains articles with programmatic access to full-text XML. Some publishers restrict programmatic access even though the article may be viewable on the PMC website.

      Parameters

      • pmcid: string

        PMC ID (e.g., "PMC7906746")

      Returns Promise<OaSubsetInfo>

      OaSubsetInfo containing detailed information about OA availability

      const client = new PubMedClient();
      const info = await client.isOaSubset("PMC7906746");

      if (info.isOaSubset) {
      console.log("Article is in OA subset");
      console.log("Download:", info.downloadLink);
      } else {
      console.log("Not in OA subset:", info.errorCode);
      }
    • Search PubMed and fetch article metadata

      Parameters

      • query: string

        Search query string (PubMed syntax supported)

      • Optionallimit: number | null

        Maximum number of results to return

      Returns Promise<Article[]>

      Array of article metadata

    • Search PubMed and fetch lightweight summaries

      Combines search and ESummary fetch. Faster than search() when you only need basic metadata.

      Parameters

      • query: string

        Search query string

      • Optionallimit: number | null

        Maximum number of results

      Returns Promise<Summary[]>

      Array of article summaries

    • Check spelling of a search term using the ESpell API

      Provides spelling suggestions for terms within a single text query. Uses the PubMed database by default.

      Parameters

      • term: string

        The search term to spell-check

      Returns Promise<SpellCheckResult>

      Spelling suggestions with corrected query

    • Check spelling of a search term against a specific database using the ESpell API

      Spelling suggestions are database-specific, so use the same database you plan to search.

      Parameters

      • term: string

        The search term to spell-check

      • db: string

        The NCBI database to check against (e.g., "pubmed", "pmc")

      Returns Promise<SpellCheckResult>

      Spelling suggestions with corrected query