Abstract
The software presented is reviewed in https://doi.org/10.1177/20501579231176674
Solution: Access the Mastodon Application Program Interface (API)
Mastodon is a free and open-source software which allows to run a self-hosted microblogging service, like Twitter. Servers running Mastodon can interoperate, meaning that their users can communicate across different instances. Together, all Mastodon instances form a large decentralized federation of social networking sites. Mastodon was first released in late 2016 but has not attracted as much attention by users and researchers compared to centralized social media platforms such as Twitter. Previous studies on Mastodon (e.g., La Cava et al., 2022; Zulli et al., 2020) classify it as an “alternative social media” platform, in contrast to “corporate social media” platforms such as Twitter. Due to the open-source nature, Mastodon is also famous for being the technology behind far-right social media platforms such as Gab and Donald Trump's Truth Social. These far-right platforms have also captured certain academic attention (e.g., Zannettou et al., 2018; Zhou et al., 2019).
The Twitter takeover by Elon Musk in 2022, however, has changed this alternative—if not fringe—status of the technology and sparked a huge wave of new registrations for instances running Mastodon (Huang, 2022). Mastodon will become increasingly more relevant for communication scholars who study online behavior and phenomena. It is important to note that Mastodon also is a mobile platform. Official mobile apps for the platform are recently released, although third-party mobile apps such as Tusky (Android) and Amaroq (iPhone operating system (iOS)) have long been available.
Data collection from instances running Mastodon can be facilitated through the official Mastodon API (Mastodon developers, 2022)
1
. The R package
Functionality
Many endpoints of the Mastodon API do not require authentication and calls can be made anonymously. However, instances can decide to require authentication for some endpoints and user action endpoints, such as sending a post, that require an access token. Setting up a token only needs to be done once and the function
Most other functions in
For instance, the following obtains a user access token from the “emacs.ch” instance. One can also obtain a public access token, which can only access public information:
The following obtains information about the peers of the instance (other instances that this instance is aware of):
The activity of an instance can be obtained via:
All
The following obtains the content published by that account:
The tibble returned from
This auxiliary function allows to filter out statuses that were posted via a mobile device or directly compare mobile with web-based posts. For example, one can visualize the length of toots from a mobile device (iOS) and the web interface (Figure 1):
More information can be found in the GitHub wiki (https://github.com/schochastics/rtoot/wiki/application).

Length of Toots from Different Interfaces.

