Skip to content

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

  1. What Mastodon reads: a request with Signature-Input is read as RFC 9421, any other as draft-cavage. An inbox POST with no signature is answered 401.
  2. Draft-cavage needs keyId and signature. algorithm is rsa-sha256 or hs2019, and is checked with RSA and SHA-256 either way: an RSA key.
  3. What must be signed, in draft-cavage:
    1. always date or (created);
    2. always (request-target) or digest;
    3. on a GET, host;
    4. on a POST, digest, as SHA-256=<base64> of the body exactly.
  4. RFC 9421 needs keyid and created, and covers @method and @target-uri, and on a POST content-digest (sha-256=:<base64>:). The key decides the algorithm: RSA, Ed25519 or ML-DSA-44.
  5. Time. About an hour of difference either way is allowed, and a signature lasts at most 12 hours.
  6. Keys. A keyId may be the profile's id with a fragment, a key document of its own (whose owner is the profile, and which the profile lists), or a Multikey in assertionMethod (FEP-521a) whose controller is the profile. At most 10 of each.
  7. 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.
  8. 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

  1. Accept: application/activity+json, application/ld+json, or, when it looks something up, the ActivityStreams ld+json first.
  2. The answer must be 200, of type application/activity+json or application/ld+json with the ActivityStreams profile, and at most 1 MB.
  3. The id must be the address asked for, exactly. Redirects are not followed for posts and profiles, only for keys: each thing is served at its own id.
  4. Ids without #. Mastodon looks a post up by its id cut at the first #, so a post whose id has a fragment is kept but cannot be found again, and likes, replies and deletes of it do not reach it.
  5. @context must include https://www.w3.org/ns/activitystreams, for Mastodon to read the activity, profile or post.

Profiles

  1. Needed: @context, a type (Person, Group, Organization, Service or Application), inbox, and preferredUsername or webfinger.
  2. 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 50 PropertyValues in attachment, alsoKnownAs, movedTo, featured, featuredTags, custom emoji in tag, and icon and image (an Image, its description in name or summary).
  3. The handle. Mastodon asks WebFinger, and:
    1. the name in subject must match [a-z0-9_]+([.-]+[a-z0-9_]+)*;
    2. the self link's href must be the profile's id exactly, with type application/activity+json;
    3. the handle's domain may differ from the profile's host, with one more question;
    4. a 404 sends Mastodon on to host-meta's template.
  4. An Update of a profile is taken when its object.id is the sender.

Posts

  1. Whose a post is. Its id is on the sender's host.

  2. Who may see it:

    to and cc hold The post is
    Public in to Public
    Public in cc Unlisted
    The author's own followers address in to For followers
    Anything else Direct

    Public may be written in full, as as:Public or as Public. Profiles named in the audience become quiet mentions.

  3. Tags. Hashtag by name; Mention by href, the profile's id; Emoji with name (:code:), icon.url, id and updated.

  4. 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.

  5. A content warning is summary, with sensitive. The language is the first key of contentMap.

  6. Polls. A Question with oneOf or anyOf (up to 500 choices), endTime, closed and votersCount. A vote is a Create of a Note whose name is the choice, in reply to the poll.

  7. Quotes (FEP-044f). Read from quote, _misskey_quote, quoteUrl or quoteUri, with quoteAuthorization and interactionPolicy.canQuote. When Mastodon quotes a post from here it sends a QuoteRequest (object the post here, instrument its own). It waits for an Accept whose object is the request and whose result is a QuoteAuthorization on this host. That authorization is attributedTo the quoted author, with interactingObject the quoting post and interactionTarget the one quoted. Until then the quote is pending.

  8. Replies. inReplyTo is followed later. A post's replies collection is read, on the same host, 5 at a time.

  9. Changes. An Update of a post is taken when its updated is later than the copy kept; without updated, only a poll's counts change. An Update of a post Mastodon has never had, and less than a day old, is taken as a new post.

Pictures, video and sound

  1. At most four: Mastodon keeps the first four and leaves the rest out.
  2. Media goes in url. An entry with href instead is taken as a link preview.
  3. mediaType says what it is. The description is name or summary (up to 10,000 characters). focalPoint is read, and blurhash with at most 5 parts each way.
  4. A video's or a sound's icon is its picture.
  5. 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

  1. Counts. Mastodon reads outbox, followers and following for their totalItems only. A collection with no first page is shown as private: its count, but not its list.
  2. Pages. Where it reads items, Mastodon follows first and then next, takes items or orderedItems, and keeps to pages on the profile's host.
  3. featured: one page only, of addresses or Notes written out; an Article written out is skipped. Five pinned posts at most, and ten featured hashtags.
  4. 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 collectionId the profile's followers and url on 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

  1. Draft-cavage first, every time. rsa-sha256, keyId the profile's id with #main-key.
    • A POST is signed over host date content-type digest (request-target), with collection-synchronization when it is sent.
    • A GET is signed over host date (request-target).
  2. RFC 9421 after a 400 or 401, once, over @method @target-uri, and content-digest on a POST. Mastodon keeps no memory of which worked, so a server that refuses draft-cavage costs it two requests each time.
  3. Every fetch is signed, by Mastodon's own server profile when nobody in particular is asking.
  4. Retries. Any 2xx is taken as done. A 401, 408 or 429 is tried again; any other 4xx is not.
  5. Its profiles have one RSA publicKey, no assertionMethod, and a webfinger (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