Skip to content

Upstream quirks

Facts below are verified against the live API.

Search (esearch.fcgi)

  • Caller mistakes answer HTTP 200: an unknown db returns {"esearchresult": {"ERROR": "Invalid db name specified: ..."}}, and a missing term returns an XML document with an ERROR element. The client raises ConfigurationError for the JSON shape.
  • retmax=0 is the documented count query: the answer carries count and an empty idlist. client.ids.count() uses it.
  • retstart beyond the hit count answers an empty idlist and echoes retmax as 0. The iterator stops on the empty page.
  • PubMed can retrieve only the first 10,000 records of a query. Past retstart 9998, esearch can answer an esearchresult.ERROR whose text carries a raw control character, which makes the JSON body unparseable; the client then raises APIError. Iterating more than 10,000 records of one query therefore fails instead of wrapping around.
  • A JSON body sent by POST is ignored: the answer is the XML Empty term error document. The E-utilities read POST bodies only as application/x-www-form-urlencoded, so the client sends every search as GET. NCBI recommends POST for very long term strings; pass them through your own HTTP client in that case.

Summaries (esummary.fcgi)

  • A uid the database does not know answers HTTP 200 with a per-uid record {"uid": "...", "error": "cannot get document summary"}. client.summaries.get() turns that into NotFoundError; by_ids() returns the record with Summary.error set.
  • pmcrefcount arrives as a string for most records and as an int for some, so the model accepts both.
  • references entries are usually plain citation strings; some arrive as objects (for example {"refsource": ..., "reftype": "Erratum in", "pmid": ..., "note": ""}). The references field of Summary accepts both shapes.

Records (efetch.fcgi)

  • A malformed id answers HTTP 400 with an eFetchResult XML document whose ERROR element carries the reason, for example ID list is empty!. The framework raises APIError for the status; the body is XML, so its message is generic.
  • retmode=xml answers a full PubmedArticleSet regardless of rettype; the client always sends plain retmode=xml. The rettype=medline plain text format is out of scope.
  • Book records (PubmedBookArticle elements) are not modeled and are skipped by the parser.
  • Titles and abstracts carry inline markup (<i>, <sub>); the parser flattens each to its character data with whitespace collapsed.
  • JSON (retmode=json) is supported for cmd=neighbor and cmd=prlinks.
  • Input uids that produce identical link results are merged into one LinkSet whose ids list carries several uids; the number of link sets can be smaller than the number of input uids.
  • An article with no links to the target database answers a LinkSet with an empty or missing linksetdbs.
  • provider_links() returns no URLs for articles that have no provider linkout (for example brand-new records under embargo).

Metadata (einfo.fcgi)

  • Without db the answer is a plain dblist of names; with db it is a one-element dbinfo list. An unknown database name answers a 200 envelope with no dbinfo, which the client maps to NotFoundError.
  • The searchable-field flags (isdate, ishidden, and the like) arrive as Y/N strings; the models map them to booleans.

Other

  • The PMC OA Web Service (https://www.ncbi.nlm.nih.gov/pmc/utils/oa/oa.fcgi) is retired: NCBI announced the shutdown on 2026-08-25 with the PMC Article Dataset changes, and the endpoint answers HTTP 404. This client therefore does not wrap it. Bulk PubMed Central content ships as the PMC Article Datasets distribution instead.
  • Rate-limit answers carry no rate-limit headers; the documented limits are 3 requests per second without an API key and 10 with one.