Upstream quirks
Facts below are verified against the live API.
Search (esearch.fcgi)
- Caller mistakes answer HTTP 200: an unknown
dbreturns{"esearchresult": {"ERROR": "Invalid db name specified: ..."}}, and a missingtermreturns an XML document with anERRORelement. The client raisesConfigurationErrorfor the JSON shape. retmax=0is the documented count query: the answer carriescountand an emptyidlist.client.ids.count()uses it.retstartbeyond the hit count answers an emptyidlistand echoesretmaxas0. The iterator stops on the empty page.- PubMed can retrieve only the first 10,000 records of a query. Past
retstart9998, esearch can answer anesearchresult.ERRORwhose text carries a raw control character, which makes the JSON body unparseable; the client then raisesAPIError. 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 termerror document. The E-utilities read POST bodies only asapplication/x-www-form-urlencoded, so the client sends every search as GET. NCBI recommends POST for very longtermstrings; 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 intoNotFoundError;by_ids()returns the record withSummary.errorset. pmcrefcountarrives as a string for most records and as an int for some, so the model accepts both.referencesentries are usually plain citation strings; some arrive as objects (for example{"refsource": ..., "reftype": "Erratum in", "pmid": ..., "note": ""}). Thereferencesfield ofSummaryaccepts both shapes.
Records (efetch.fcgi)
- A malformed id answers HTTP 400 with an
eFetchResultXML document whoseERRORelement carries the reason, for exampleID list is empty!. The framework raisesAPIErrorfor the status; the body is XML, so its message is generic. retmode=xmlanswers a fullPubmedArticleSetregardless ofrettype; the client always sends plainretmode=xml. Therettype=medlineplain text format is out of scope.- Book records (
PubmedBookArticleelements) 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.
Links (elink.fcgi)
- JSON (
retmode=json) is supported forcmd=neighborandcmd=prlinks. - Input uids that produce identical link results are merged into one
LinkSetwhoseidslist 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
LinkSetwith an empty or missinglinksetdbs. provider_links()returns no URLs for articles that have no provider linkout (for example brand-new records under embargo).
Metadata (einfo.fcgi)
- Without
dbthe answer is a plaindblistof names; withdbit is a one-elementdbinfolist. An unknown database name answers a 200 envelope with nodbinfo, which the client maps toNotFoundError. - The searchable-field flags (
isdate,ishidden, and the like) arrive asY/Nstrings; 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.