User:Citation bot

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

User interaction[edit]

Find out how you can use the Citation bot on your own pages here.
Please report any bugs, ideas or suggestions, here. You can get the bot's source code from Github.
Emergency shutoff

Administrators: Click here to understand how to block this bot with minimal disruption.

Non-administrators can report misbehaving bots to Wikipedia:Administrators' noticeboard/Incidents.

Function summary[edit]

This bot was originally designed to add digital object identifiers (DOIs) to references; it now does much more, adding other identifiers (PMIDs, ISBNs), links to open access repositories, and fixing common formatting errors.

The bot obtains citation data from a range of sources including Google Books, Google Books API Family, CrossRef, AdsAbs, arXiv, oaDOI and PubMed. Because scraping data from web pages is unreliable and resource-intensive, these databases are the main source of data; unfortunately the bot is unable to tell when these databases contain errors or incomplete information. Any such error or omission should be reported directly to the data repository maintainer.

Data sources[edit]

ISBN, LCCN, and OLCN data is expanded from the Google Books API Family.

JSTOR data is expanded using Citoid, which then queries

DOI data is expanded using CrossRef.

Google Books is used for Google Books URL expansion.

PMC and PMID data comes from and is expanded from PubMed.

arXiv data is from arXiv of course.

Bibcode data is from AdsAbs.

Open source links are from mostly oaDOI.


A stable version of the bot is always available at

Time commitments preclude regular updates; maintenance is attempted every few months. The source code can be found at

Stopping the bot from editing[edit]

  • To prevent the Citation bot from editing a page, include the text
    {{bots|deny=Citation bot}}
    anywhere on the page. Please also leave a note here explaining why the action has become necessary, so that it can be resolved!
  • If the bot is erroneously adding a DOI, author, etc to a citation, and you want to stop it adding the data again, you need to put a comment in place of the appropriate parameter – because the bot will not overwrite existing data. So use something along the lines of
    |doi = <!-- this comment stops Citation bot adding the wrong DOI here-->
    or words to that effect. Again, it may be possible for me to fix the underlying problem if you let me know about it – but there are a few, rare instances (such as false positives and editor preference) where it is impossible to implement an automatic fix.

False positives[edit]

If the bot is adding seemingly-unrelated data to a citation, it is probably receiving a false positive from the citation databases it consults. Unfortunately, there's no way for the bot to know this, so there are two ways of avoiding it:

  • Change the citation template to one which the bot doesn't modify, such as cite news, etc;
  • Add a comment into one or more of the parameters – these comments will not be over-ridden by the bot, and will reduce the chance of the citation databases throwing false positives.
  • If the journal title has non-standard Case (Such as PLOS One), then special code should be requested on the bug report page, or better yet, make a pull request on

Page numbers with hyphens[edit]

The bot replaces hyphens with en dash in page number ranges. On rare occasions when a hyphen is right and an en dash is wrong (hyphen in the page number itself, often because the page number includes the chapter too), manually use the {{hyphen}} template instead of the dash/hyphen character. An alternative is to use the template's |at= parameter.

Valid parameters[edit]

The bot draws all parameters specified in Module:Citation/CS1/Whitelist with the format "['parameter_name'] = true", and treats these as valid spellings. The bot maintains its own copy at


There have been a number of requests for the bot to be adapted to foreign-language wikipedias. When time permits, I will be happy to work towards this. For me to adapt the bot for a foreign wiki I first need:

  • A valid bot account on that wiki with the appropriate permission for its edits
  • A translation of each of the template names and parameters used.

If you have both of these available, please let me know and I will set to work on the necessary coding.

Reading the edit summaries[edit]

To assist debugging, the bot's edit summaries begin with a code in [square brackets]. This identifies how the bot was initiated (letter), and what revision of the code was used (number). When major development is underway, the publicly accessible interface to the bot may use an older version of the code that has been established to be bug-free.

  • Pu – Initiated from the server. May be operating supervised or unsupervised.
  • Nothing (previously U) – Initiated by a user whose name is usually listed in the edit summary
  • Ax - {{Cite arXiv}} maintenance, activated when blank template detected
  • C - {{cite doi}} family maintenance, activated when blank template detected

If a bug is marked as 'fixed in r50' and you notice the bug in an edit beginning [U40], then there is no need to report the bug again. If you see it in an edit starting [Pu60], however, then please do report that it wasn't fixed as expected.


Automatic or manually Assisted: Automatic

Programming language(s): PHP w/ Snoopy & BasicBot

Function summary: Maintains and expands citations; ensures standards are complied to.

Edit period(s) (e.g. continuous, daily, one time run): Visits each article every few months; can be used on specific articles whenever requested by a user.

Function details: Citation bot only amends the parameters of citation templates.

  1. Replaces "id=identifier" or "url= with "identifier=#"
  2. Fixes common typos in parameter names (not values), using the closest match if the typo is not in a list of frequent mistakes
  3. Removes redundant parameters
  4. Searches for missing parameters (including URL), then adds them if available. This is especially convenient when only an identifier is included within the template
    • The bot uses a range of databases including Google Books API, PubMed, CrossRef, AdsAbs and JSTOR
  5. Converts an endnote citation to a Wikipedia citation — Example
  6. Adds names to references and combines duplicates
  7. Expands {{cite arXiv}} templates with an eprint parameter, and updates them to use {{cite journal}} where appropriate
  8. Where a mixture of {{citation}} and {{cite xxx}} family templates are used in an article, standardizes to the dominant format

Bot approval[edit]

External links[edit]

Bot Recognitions[edit]

Original Barnstar Hires.png The Original Barnstar
Thank you, you have been very helpful to me as a new user and contributor. Tonythetiger89 (talk) 16:29, 15 August 2013 (UTC)
Cute grey kitten.jpg

This kitten is Fixed


Kashment (talk) 20:51, 20 July 2014 (UTC)
Face-smile.svg Martin (Smith609 – Talk) 05:13, 29 July 2014 (UTC)

Citation Barnstar Hires.png The Citation Barnstar
For all of your citation fixes! Quinton Feldberg (talk) 05:49, 24 August 2017 (UTC)