Fediverse and Bluesky
Federating with Mastodon
Mastodon is the fediverse's largest neighbour, and the one whose ways most
servers learned from. This page is how to better communicate with it: what
it receives from this server and how it shows it, what it sends here, and
how this server meets it. It is read from Mastodon's own code (main at
230877f623, 2026-12-04), not from its documentation, and wants reading
again when Mastodon makes a release. Federation is how this
server federates in general.
How Mastodon shows what is sent
| Sent from here | On Mastodon |
|---|---|
| A note, with or without pictures | Shown as written |
A poll (Question) |
Shown as a poll |
An article (Article), a Page or an Event |
Its name as a heading, its summary as the text, then a link to its url, where the whole article is read. Pictures in attachment are kept |
| A note with no words and no pictures | Not shown: there is nothing to show |
Anything sent after a Delete of the same id |
Not shown: Mastodon remembers what its author deleted |
Mastodon shows people what concerns them: a post sent to it is kept when somebody there follows its author, it names somebody there, it replies to a post followed or kept there, or it came by a relay.
Signatures
- What Mastodon reads: a request with
Signature-Inputis read as RFC 9421, any other as draft-cavage. An inbox POST with no signature is answered 401. - Draft-cavage needs
keyIdandsignature.algorithmisrsa-sha256orhs2019, and is checked with RSA and SHA-256 either way: an RSA key. - What must be signed, in draft-cavage:
- always
dateor(created); - always
(request-target)ordigest; - on a GET,
host; - on a POST,
digest, asSHA-256=<base64>of the body exactly.
- always
- RFC 9421 needs
keyidandcreated, and covers@methodand@target-uri, and on a POSTcontent-digest(sha-256=:<base64>:). The key decides the algorithm: RSA, Ed25519 or ML-DSA-44. - Time. About an hour of difference either way is allowed, and a signature lasts at most 12 hours.
- Keys. A
keyIdmay be the profile'sidwith a fragment, a key document of its own (whoseowneris the profile, and which the profile lists), or a Multikey inassertionMethod(FEP-521a) whosecontrolleris the profile. At most 10 of each. - A new key. When a signature fails, Mastodon fetches the profile once again for its keys. If that fetch cannot connect, it fetches nothing from the sender's address for 5 minutes.
- Fetches are signed. Unless its administrator says otherwise, Mastodon
answers a request for a profile only when it is signed; with
AUTHORIZED_FETCH=all, every post and collection too. A key of this server's own profile is enough.
What Mastodon asks of this server
- Accept:
application/activity+json, application/ld+json, or, when it looks something up, the ActivityStreamsld+jsonfirst. - The answer must be 200, of type
application/activity+jsonorapplication/ld+jsonwith the ActivityStreams profile, and at most 1 MB. - The
idmust be the address asked for, exactly. Redirects are not followed for posts and profiles, only for keys: each thing is served at its ownid. - Ids without
#. Mastodon looks a post up by itsidcut at the first#, so a post whoseidhas a fragment is kept but cannot be found again, and likes, replies and deletes of it do not reach it. @contextmust includehttps://www.w3.org/ns/activitystreams, for Mastodon to read the activity, profile or post.
Profiles
- Needed:
@context, atype(Person,Group,Organization,ServiceorApplication),inbox, andpreferredUsernameorwebfinger. - Also read:
outbox,endpoints.sharedInbox,followers,following,url(on the same host only),published,name(up to 2,048 characters),summary(up to 20 KB),manuallyApprovesFollowers,discoverable,indexable,memorial,suspended, up to 50PropertyValues inattachment,alsoKnownAs,movedTo,featured,featuredTags, custom emoji intag, andiconandimage(anImage, its description innameorsummary). - The handle. Mastodon asks WebFinger, and:
- the name in
subjectmust match[a-z0-9_]+([.-]+[a-z0-9_]+)*; - the
selflink'shrefmust be the profile'sidexactly, withtypeapplication/activity+json; - the handle's domain may differ from the profile's host, with one more question;
- a 404 sends Mastodon on to
host-meta's template.
- the name in
- An
Updateof a profile is taken when itsobject.idis the sender.
Posts
-
Whose a post is. Its
idis on the sender's host. -
Who may see it:
toandccholdThe post is Public in toPublic Public in ccUnlisted The author's own followersaddress intoFor followers Anything else Direct Public may be written in full, as
as:Publicor asPublic. Profiles named in the audience become quiet mentions. -
Tags.
Hashtagbyname;Mentionbyhref, the profile'sid;Emojiwithname(:code:),icon.url,idandupdated. -
The words keep
p br span a del s pre blockquote code b strong u i em ul ol li ruby rt rp. Headings become bold paragraphs, other elements are taken out, and a link whose scheme Mastodon does not know becomes plain text. There is no length limit on what comes from elsewhere. -
A content warning is
summary, withsensitive. The language is the first key ofcontentMap. -
Polls. A
QuestionwithoneOforanyOf(up to 500 choices),endTime,closedandvotersCount. A vote is aCreateof aNotewhosenameis the choice, in reply to the poll. -
Quotes (FEP-044f). Read from
quote,_misskey_quote,quoteUrlorquoteUri, withquoteAuthorizationandinteractionPolicy.canQuote. When Mastodon quotes a post from here it sends aQuoteRequest(objectthe post here,instrumentits own). It waits for anAcceptwhoseobjectis the request and whoseresultis aQuoteAuthorizationon this host. That authorization isattributedTothe quoted author, withinteractingObjectthe quoting post andinteractionTargetthe one quoted. Until then the quote is pending. -
Replies.
inReplyTois followed later. A post'srepliescollection is read, on the same host, 5 at a time. -
Changes. An
Updateof a post is taken when itsupdatedis later than the copy kept; withoutupdated, only a poll's counts change. AnUpdateof a post Mastodon has never had, and less than a day old, is taken as a new post.
Pictures, video and sound
- At most four: Mastodon keeps the first four and leaves the rest out.
- Media goes in
url. An entry withhrefinstead is taken as a link preview. mediaTypesays what it is. The description isnameorsummary(up to 10,000 characters).focalPointis read, andblurhashwith at most 5 parts each way.- A video's or a sound's
iconis its picture. - Sizes Mastodon fetches: up to 16 MB for a picture and 99 MB for a video.
Follows, likes, reposts and the rest
| Activity | How Mastodon receives it |
|---|---|
Follow |
object the profile followed. Answered with an Accept, or held as a request where approval is asked |
Accept, Reject |
object the Follow's id, or the Follow written out, whose actor is the profile there |
Undo |
Announce, Accept, Follow, Like and Block written out; an address alone is tried as an Announce, a Follow and a Block only, so an undone like writes out the Like with its object |
Like |
Of Mastodon's own posts. A content (an emoji reaction) counts as a like |
Announce (repost) |
object an address; a post written out is trusted only when it is the reposter's own, and is fetched otherwise |
Delete |
object an address or a Tombstone, on the sender's host; object the same as actor deletes the profile |
Block |
object the profile blocked |
Flag |
object an address or a list of them (a profile and posts), content up to 5,000 characters |
Move |
target's alsoKnownAs holds the old profile; one move in 7 days |
Add, Remove |
target the profile's featured: a Note pins a post, a Hashtag features a tag |
Mastodon also receives QuoteRequest and FeatureRequest. It does not use other
activities, such as EmojiReact, Read, View, Join and
TentativeAccept. A Delete or Update from a profile Mastodon has never
met is answered 202 and set aside: there is nothing of theirs to change.
Collections
- Counts. Mastodon reads
outbox,followersandfollowingfor theirtotalItemsonly. A collection with nofirstpage is shown as private: its count, but not its list. - Pages. Where it reads items, Mastodon follows
firstand thennext, takesitemsororderedItems, and keeps to pages on the profile's host. featured: one page only, of addresses orNotes written out; anArticlewritten out is skipped. Five pinned posts at most, and ten featured hashtags.- Followers synchronization (FEP-8fcf). Mastodon sends
Collection-Synchronization: collectionId="…", digest="…", url="…"with posts for followers, from profiles with fewer than 25,000 followers.- The digest is the XOR of the SHA-256 of each follower's address on the receiving server.
- A header sent to Mastodon needs
collectionIdthe profile'sfollowersandurlon the same host. - Mastodon then reads up to 10 pages of
url, signed, and removes followers that are not listed only when the digest agrees.
What Mastodon sends here
- Draft-cavage first, every time.
rsa-sha256,keyIdthe profile'sidwith#main-key.- A POST is signed over
host date content-type digest (request-target), withcollection-synchronizationwhen it is sent. - A GET is signed over
host date (request-target).
- A POST is signed over
- RFC 9421 after a 400 or 401, once, over
@method @target-uri, andcontent-digeston a POST. Mastodon keeps no memory of which worked, so a server that refuses draft-cavage costs it two requests each time. - Every fetch is signed, by Mastodon's own server profile when nobody in particular is asking.
- Retries. Any 2xx is taken as done. A 401, 408 or 429 is tried again; any other 4xx is not.
- Its profiles have one RSA
publicKey, noassertionMethod, and awebfinger(FEP-2c59). Their addresses may be/users/<name>or/ap/users/<id>: never read anything into them.
How this server meets Mastodon
| What helps Mastodon | This server |
|---|---|
Draft-cavage over (request-target) host date digest |
✅ httpsig.Sign |
| Mastodon's draft-cavage read the first time | ✅ |
| Signed fetches | ✅ |
| The Accept header Mastodon answers | ✅ fetch.accept |
Each thing served at its id, without # |
✅ |
Undo of a like with the Like and its object |
✅ |
Delete with a Tombstone |
✅ |
| An article that reads well there | Partly: name, summary and the link go; the cover goes as image, which Mastodon does not show, rather than in attachment |
| More than four pictures | ➖ Mastodon shows the first four |
Quote requests answered with a QuoteAuthorization |
✅ ap/quote.go |
| Followers and following as counts | ✅ without first, so Mastodon shows them as private, as they are here |
From anahitasocial/anahita-services, 2026-12-05.
Written by Claude, reviewed by Rastin Mehr · About this