ActivityPub - Mastodon documentation
ActivityPub
A decentralized social networking protocol based upon the ActivityStreams 2.0 data format and JSON-LD.
Status federation
app/lib/activitypub/activity.rb
Supported activities for statuses
Create
Transformed into a status and saved into database
Delete
Removes a status from the database
Like
Transformed into a favourite on a status
Announce
Transformed into a boost on a status
Update
Refresh vote count on polls. As of Mastodon 3.5.0: edit statuses when the
updated
timestamp is present.
Undo
Undo a previous Like or Announce.
Flag
Transformed into a report to the moderation team. See the
Reports
extension for more information.
QuoteRequest
Request approval for a quote post. See the
Quote posts
extension for more information.
Payloads
The first-class Object types supported by Mastodon are
Note
and
Question
Notes are transformed into regular statuses.
Questions are transformed into a poll status. See the
Polls
extension for more information.
Some other Object types are converted as best as possible:
Article
Page
Image
Audio
Video
Event
The transformer uses
content
if available, or
name
if not, in order to generate status text. The
url
will be appended. The
summary
property will be used as the CW text. The
icon
will be used as a thumbnail.
HTML sanitization
lib/sanitize_ext/sanitize_config.rb
Mastodon sanitizes incoming HTML in order to not break assumptions for API client developers. Supported elements will be kept as-is, and unsupported elements will be converted or removed. Supported attributes will be kept, and all other attributes will be stripped. The following elements and attributes are supported:



class



href
rel
class
lists will be converted to


, and list items will be separated with


Since Mastodon v4.2, the following elements and attributes are supported:



class



href
rel
class