Federation

Lemmy uses the ActivityPub protocol for communication between servers. If you are unfamiliar with the protocol, you can start by reading the resource links. This document explains how to interact with it from other projects.

In Lemmy we use some specific terms to refer to ActivityPub items. They are essentially our specific implementations of well-known ActivityPub concepts:

  • Community: Group
  • User: Person
  • Post: Page
  • Comment: Note

Almost every action in Lemmy happens inside a group. The Federation Enhancement Proposal Group Federation gives a high-level overview how this works. The generic federation logic is implemented in the activitypub-federation library. It can also be used by other Rust projects.

Sometimes you will see a notation like Create/Note. This refers to a Create activity with a Note as object.

Below are explanations and examples for all actors, objects and activities from Lemmy. These include many optional fields which you can safely ignore.

If you have trouble to make your project federate with Lemmy, feel free to open an issue. Make sure to include the specific federation messages you are sending, and any errors returned by Lemmy.

Context

[
  "https://www.w3.org/ns/activitystreams",
  "https://w3id.org/security/v1",
  {
    "lemmy": "https://join-lemmy.org/ns#",
    "litepub": "http://litepub.social/ns#",
    "pt": "https://joinpeertube.org/ns#",
    "sc": "http://schema.org/",
    "ChatMessage": "litepub:ChatMessage",
    "commentsEnabled": "pt:commentsEnabled",
    "sensitive": "as:sensitive",
    "matrixUserId": "lemmy:matrixUserId",
    "postingRestrictedToMods": "lemmy:postingRestrictedToMods",
    "removeData": "lemmy:removeData",
    "stickied": "lemmy:stickied",
    "moderators": {
      "@type": "@id",
      "@id": "lemmy:moderators"
    },
    "expires": "as:endTime",
    "distinguished": "lemmy:distinguished",
    "language": "sc:inLanguage",
    "identifier": "sc:identifier"
  }
]

The context is identical for all activities and objects.

Actors

Community

An automated actor. Users can send posts or comments to it, which the community forwards to its followers in the form of Announce.

{
  "id": "https://enterprise.lemmy.ml/c/tenforward",
  "type": "Group",
  "preferredUsername": "main",
  "name": "Ten Forward",
  "summary": "<p>Lounge and recreation facility</p>\n<hr />\n<p>Welcome to the <a href=\"https://memory-alpha.fandom.com/wiki/USS_Enterprise_(NCC-1701-D)\">Enterprise</a>!.</p>\n",
  "source": {
    "content": "Lounge and recreation facility\n\n---\n\nWelcome to the [Enterprise](https://memory-alpha.fandom.com/wiki/USS_Enterprise_(NCC-1701-D))!.",
    "mediaType": "text/markdown"
  },
  "sensitive": false,
  "icon": {
    "type": "Image",
    "url": "https://enterprise.lemmy.ml/pictrs/image/waqyZwLAy4.webp"
  },
  "image": {
    "type": "Image",
    "url": "https://enterprise.lemmy.ml/pictrs/image/Wt8zoMcCmE.jpg"
  },
  "inbox": "https://enterprise.lemmy.ml/c/tenforward/inbox",
  "followers": "https://enterprise.lemmy.ml/c/tenforward/followers",
  "attributedTo": "https://enterprise.lemmy.ml/c/tenforward/moderators",
  "featured": "https://enterprise.lemmy.ml/c/tenforward//featured",
  "postingRestrictedToMods": false,
  "endpoints": {
    "sharedInbox": "https://enterprise.lemmy.ml/inbox"
  },
  "outbox": "https://enterprise.lemmy.ml/c/tenforward/outbox",
  "publicKey": {
    "id": "https://enterprise.lemmy.ml/c/tenforward#main-key",
    "owner": "https://enterprise.lemmy.ml/c/tenforward",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzRjKTNtvDCmugplwEh+g\nx1bhKm6BHUZfXfpscgMMm7tXFswSDzUQirMgfkxa9ubfr1PDFKffA2vQ9x6CyuO/\n70xTafdOHyV1tSqzgKz0ZvFZ/VCOo6qy1mYWVkrtBm/fKzM+87MdkKYB/zI4VyEJ\nLfLQgjwxBAEYUH3CBG71U0gO0TwbimWNN0vqlfp0QfThNe1WYObF88ZVzMLgFbr7\nRHBItZjlZ/d8foPDidlIR3l2dJjy0EsD8F9JM340jtX7LXqFmU4j1AQKNHTDLnUF\nwYVhzuQGNJ504l5LZkFG54XfIFT7dx2QwuuM9bSnfPv/98RYrq1Si6tCkxEt1cVe\n4wIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "language": [
    {
      "identifier": "fr",
      "name": "Français"
    },
    {
      "identifier": "de",
      "name": "Deutsch"
    }
  ],
  "published": "2019-06-02T16:43:50.799554+00:00",
  "updated": "2021-03-10T17:18:10.498868+00:00"
}
Field NameDescription
preferredUsernameName of the actor
nameTitle of the community
sensitiveTrue indicates that all posts in the community are nsfw
attributedToFirst the community creator, then all the remaining moderators
summaryText for the community sidebar, usually containing a description and rules
iconIcon, shown next to the community name
imageBanner image, shown on top of the community page
inboxActivityPub inbox URL
outboxActivityPub outbox URL, only contains up to 20 latest posts, no comments, votes or other activities
followersFollower collection URL, only contains the number of followers, no references to individual followers
endpointsContains URL of shared inbox
publishedDatetime when the community was first created
updatedDatetime when the community was last changed
publicKeyThe public key used to verify signatures from this actor

User

A person, interacts primarily with the community where it sends and receives posts/comments. Can also create and moderate communities, and send private messages to other users. Can be followed from other platforms.

{
  "id": "https://enterprise.lemmy.ml/u/picard",
  "type": "Person",
  "preferredUsername": "picard",
  "name": "Jean-Luc Picard",
  "summary": "<p>Captain of the starship <strong>Enterprise</strong>.</p>\n",
  "source": {
    "content": "Captain of the starship **Enterprise**.",
    "mediaType": "text/markdown"
  },
  "icon": {
    "type": "Image",
    "url": "https://enterprise.lemmy.ml/pictrs/image/ed9ej7.jpg"
  },
  "image": {
    "type": "Image",
    "url": "https://enterprise.lemmy.ml/pictrs/image/XenaYI5hTn.png"
  },
  "matrixUserId": "@picard:matrix.org",
  "inbox": "https://enterprise.lemmy.ml/u/picard/inbox",
  "outbox": "https://enterprise.lemmy.ml/u/picard/outbox",
  "endpoints": {
    "sharedInbox": "https://enterprise.lemmy.ml/inbox"
  },
  "published": "2020-01-17T01:38:22.348392+00:00",
  "updated": "2021-08-13T00:11:15.941990+00:00",
  "publicKey": {
    "id": "https://enterprise.lemmy.ml/u/picard#main-key",
    "owner": "https://enterprise.lemmy.ml/u/picard",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0lP99/s5Vv+XbPdkeqIJ\nwoD4GFnHmBnBHdEKChEUWfWj1TtioC/rGNoXFQeXQA3Amhy4nxSceiDnUgwkkuQY\nv0MtIW58NzgknEavtllxL+LSds5pg3gANaDIk8UiWTkqXTg0GnlJMpCK1Chen0l/\nszL6DEvUyTSuS5ZYDXFgewF89Pe7U0S15V5U2Harv7AgJYDyxmUL0D1pGuUCRqcE\nl5MTHJjrXeNnH1w2g8aly8YlO/Cr0L51rFg/lBF23vni7ZLv8HbmWh6YpaAf1R8h\nE45zKR7OHqymdjzrg1ITBwovefpwMkVgnJ+Wdr4HPnFlBSkXPoZeM11+Z8L0anzA\nXwIDAQAB\n-----END PUBLIC KEY-----\n"
  }
}
Field NameDescription
preferredUsernameName of the actor
nameThe user's displayname
summaryUser bio
iconThe user's avatar, shown next to the username
imageThe user's banner, shown on top of the profile
inboxActivityPub inbox URL
endpointsContains URL of shared inbox
publishedDatetime when the user signed up
updatedDatetime when the user profile was last changed
publicKeyThe public key used to verify signatures from this actor

Instance

Represents a Lemmy instance, and is used to federate global data like the instance description or site bans. It can be fetched from the root path.

{
  "type": "Application",
  "id": "https://enterprise.lemmy.ml/",
  "name": "Enterprise",
  "summary": "A test instance",
  "content": "<p>Enterprise sidebar</p>\\n",
  "mediaType": "text/html",
  "source": {
    "content": "Enterprise sidebar",
    "mediaType": "text/markdown"
  },
  "inbox": "https://enterprise.lemmy.ml/inbox",
  "outbox": "https://enterprise.lemmy.ml/outbox",
  "publicKey": {
    "id": "https://enterprise.lemmy.ml/#main-key",
    "owner": "https://enterprise.lemmy.ml/",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAupcK0xTw5yQb/fnztAmb\n9LfPbhJJP1+1GwUaOXGYiDJD6uYJhl9CLmgztLl3RyV9ltOYoN8/NLNDfOMmgOjd\nrsNWEjDI9IcVPmiZnhU7hsi6KgQvJzzv8O5/xYjAGhDfrGmtdpL+lyG0B5fQod8J\n/V5VWvTQ0B0qFrLSBBuhOrp8/fTtDskdtElDPtnNfH2jn6FgtLOijidWwf9ekFo4\n0I1JeuEw6LuD/CzKVJTPoztzabUV1DQF/DnFJm+8y7SCJa9jEO56Uf9eVfa1jF6f\ndH6ZvNJMiafstVuLMAw7C/eNJy3ufXgtZ4403oOKA0aRSYf1cc9pHSZ9gDE/mevH\nLwIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "language": [
    {
      "identifier": "fr",
      "name": "Français"
    },
    {
      "identifier": "es",
      "name": "Español"
    }
  ],
  "published": "2022-01-19T21:52:11.110741+00:00"
}
Field NameDescription
nameInstance name
summaryShort description
contentLong description (sidebar)
iconInstance icon
imageInstance banner
inboxActivityPub inbox URL
endpointsContains URL of shared inbox
publishedDatetime when the instance was created
updatedDatetime when the instance metadata
publicKeyThe public key used to verify signatures from this actor

Objects

Post

A page with title, and optional URL and text content. The attachment URL often leads to an image, in which case a thumbnail is included. Each post belongs to exactly one community. Sent out as Page, but for receiving the types Article, Note, Video and Event are also accepted.

{
  "id": "https://enterprise.lemmy.ml/post/55143",
  "type": "Page",
  "attributedTo": "https://enterprise.lemmy.ml/u/picard",
  "to": [
    "https://enterprise.lemmy.ml/c/tenforward",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "name": "Post title",
  "content": "<p>This is a post in the /c/tenforward community</p>\n",
  "mediaType": "text/html",
  "source": {
    "content": "This is a post in the /c/tenforward community",
    "mediaType": "text/markdown"
  },
  "attachment": [
    {
      "type": "Link",
      "href": "https://enterprise.lemmy.ml/pictrs/image/eOtYb9iEiB.png"
    }
  ],
  "image": {
    "type": "Image",
    "url": "https://enterprise.lemmy.ml/pictrs/image/eOtYb9iEiB.png"
  },
  "sensitive": false,
  "commentsEnabled": true,
  "language": {
    "identifier": "fr",
    "name": "Français"
  },
  "published": "2021-02-26T12:35:34.292626+00:00"
}
Field NameDescription
attributedToID of the user which created this post
toID of the community where it was posted to
nameTitle of the post (mandatory)
contentBody of the post
attachmentA single website or image link
imageThumbnail for url, only present if it is an image link
commentsEnabledFalse indicates that the post is locked, and no comments can be added
sensitiveTrue marks the post as NSFW, blurs the thumbnail and hides it from users with NSFW setting disabled
stickiedTrue means that it is shown on top of the community
publishedDatetime when the post was created
updatedDatetime when the post was edited (not present if it was never edited)

Comment

A reply to a post, or reply to another comment. Contains only text (including references to other users or communities). Lemmy displays comments in a tree structure.

{
  "id": "https://enterprise.lemmy.ml/comment/38741",
  "type": "Note",
  "attributedTo": "https://enterprise.lemmy.ml/u/picard",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "cc": [
    "https://enterprise.lemmy.ml/c/tenforward",
    "https://enterprise.lemmy.ml/u/picard"
  ],
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "inReplyTo": "https://enterprise.lemmy.ml/post/55143",
  "content": "<p>first comment!</p>\n",
  "mediaType": "text/html",
  "source": {
    "content": "first comment!",
    "mediaType": "text/markdown"
  },
  "tag": [
    {
      "href": "https://enterprise.lemmy.ml/u/picard",
      "type": "Mention",
      "name": "@picard@enterprise.lemmy.ml"
    }
  ],
  "distinguished": false,
  "language": {
    "identifier": "fr",
    "name": "Français"
  },
  "published": "2021-03-01T13:42:43.966208+00:00",
  "updated": "2021-03-01T13:43:03.955787+00:00"
}
Field NameDescription
attributedToID of the user who created the comment
toCommunity where the comment was made
contentThe comment text
inReplyToID of the parent object. In case of a top-level comment this is the post ID, in case of a nested comment it is the parent comment ID.
publishedDatetime when the comment was created
updatedDatetime when the comment was edited (not present if it was never edited)

Private Message

A direct message from one user to another. Can not include additional users. Threading is not implemented yet, so the inReplyTo field is missing.

{
  "id": "https://enterprise.lemmy.ml/private_message/1621",
  "type": "ChatMessage",
  "attributedTo": "https://enterprise.lemmy.ml/u/picard",
  "to": ["https://queer.hacktivis.me/users/lanodan"],
  "content": "<p>Hello hello, testing</p>\n",
  "mediaType": "text/html",
  "source": {
    "content": "Hello hello, testing",
    "mediaType": "text/markdown"
  },
  "published": "2021-10-21T10:13:14.597721+00:00"
}
Field NameDescription
attributedToID of the user who created this private message
toID of the recipient
contentThe text of the private message
publishedDatetime when the message was created
updatedDatetime when the message was edited (not present if it was never edited)

Collections

Community Outbox

{
  "type": "OrderedCollection",
  "id": "https://ds9.lemmy.ml/c/testcom/outbox",
  "totalItems": 2,
  "orderedItems": [
    {
      "actor": "https://ds9.lemmy.ml/c/testcom",
      "to": ["https://www.w3.org/ns/activitystreams#Public"],
      "object": {
        "actor": "https://ds9.lemmy.ml/u/nutomic",
        "to": ["https://www.w3.org/ns/activitystreams#Public"],
        "cc": ["https://ds9.lemmy.ml/c/testcom"],
        "type": "Create",
        "id": "http://ds9.lemmy.ml/activities/create/eee6a57a-622f-464d-b560-73ae1fcd3ddf",
        "object": {
          "type": "Page",
          "id": "https://ds9.lemmy.ml/post/2328",
          "attributedTo": "https://ds9.lemmy.ml/u/nutomic",
          "to": [
            "https://ds9.lemmy.ml/c/testcom",
            "https://www.w3.org/ns/activitystreams#Public"
          ],
          "name": "another outbox test",
          "mediaType": "text/html",
          "commentsEnabled": true,
          "sensitive": false,
          "stickied": false,
          "published": "2021-11-18T17:19:45.895163+00:00"
        }
      },
      "cc": ["https://ds9.lemmy.ml/c/testcom/followers"],
      "type": "Announce",
      "id": "https://ds9.lemmy.ml/activities/announce/b204fe9f-b13d-4af2-9d22-239ac2d892e6"
    },
    {
      "actor": "https://ds9.lemmy.ml/c/testcom",
      "to": ["https://www.w3.org/ns/activitystreams#Public"],
      "object": {
        "actor": "https://ds9.lemmy.ml/u/nutomic",
        "to": ["https://www.w3.org/ns/activitystreams#Public"],
        "cc": ["https://ds9.lemmy.ml/c/testcom"],
        "type": "Create",
        "id": "http://ds9.lemmy.ml/activities/create/eee6a57a-622f-464d-b560-73ae1fcd3ddf",
        "object": {
          "type": "Page",
          "id": "https://ds9.lemmy.ml/post/2327",
          "attributedTo": "https://ds9.lemmy.ml/u/nutomic",
          "to": [
            "https://ds9.lemmy.ml/c/testcom",
            "https://www.w3.org/ns/activitystreams#Public"
          ],
          "name": "outbox test",
          "mediaType": "text/html",
          "commentsEnabled": true,
          "sensitive": false,
          "stickied": false,
          "published": "2021-11-18T17:19:05.763109+00:00"
        }
      },
      "cc": ["https://ds9.lemmy.ml/c/testcom/followers"],
      "type": "Announce",
      "id": "https://ds9.lemmy.ml/activities/announce/c6c960ce-c8d8-4231-925e-3ba367468f18"
    }
  ]
}

The outbox only contains Create/Post activities for now.

Community Followers

{
  "id": "http://enterprise.lemmy.ml/c/main/followers",
  "type": "Collection",
  "totalItems": 3,
  "items": []
}

The followers collection is only used to expose the number of followers. Actor IDs are not included, to protect user privacy.

Community Moderators

List of moderators who can perform actions like removing posts or banning users.

{
  "type": "OrderedCollection",
  "id": "https://enterprise.lemmy.ml/c/tenforward/moderators",
  "orderedItems": ["https://enterprise.lemmy.ml/u/picard"]
}

List of posts which are stickied in the community.

{
  "type": "OrderedCollection",
  "id": "https://ds9.lemmy.ml/c/main/featured",
  "totalItems": 2,
  "orderedItems": [
    {
      "type": "Page",
      "id": "https://ds9.lemmy.ml/post/2",
      "attributedTo": "https://ds9.lemmy.ml/u/lemmy_alpha",
      "to": [
        "https://ds9.lemmy.ml/c/main",
        "https://www.w3.org/ns/activitystreams#Public"
      ],
      "name": "test 2",
      "cc": [],
      "mediaType": "text/html",
      "attachment": [],
      "commentsEnabled": true,
      "sensitive": false,
      "published": "2023-02-06T06:42:41.939437+00:00",
      "language": {
        "identifier": "de",
        "name": "Deutsch"
      },
      "audience": "https://ds9.lemmy.ml/c/main"
    },
    {
      "type": "Page",
      "id": "https://ds9.lemmy.ml/post/1",
      "attributedTo": "https://ds9.lemmy.ml/u/lemmy_alpha",
      "to": [
        "https://ds9.lemmy.ml/c/main",
        "https://www.w3.org/ns/activitystreams#Public"
      ],
      "name": "test 1",
      "cc": [],
      "mediaType": "text/html",
      "attachment": [],
      "commentsEnabled": true,
      "sensitive": false,
      "published": "2023-02-06T06:42:37.119567+00:00",
      "language": {
        "identifier": "de",
        "name": "Deutsch"
      },
      "audience": "https://ds9.lemmy.ml/c/main"
    }
  ]
}

User Outbox

Only contains totalItems count, but no actual items for privacy reasons.

{
  "type": "OrderedCollection",
  "id": "http://ds9.lemmy.ml/u/lemmy_alpha/outbox",
  "orderedItems": [],
  "totalItems": 0
}

Activities

User to Community

Follow

Each Community page has a "Follow" button. Clicking this triggers a Follow activity to be sent from the user to the Community inbox. The Community will automatically respond with an Accept/Follow activity to the user inbox. It will also add the user to its list of followers, and deliver any activities about Posts/Comments in the Community to the user.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["http://enterprise.lemmy.ml/c/main"],
  "object": "http://enterprise.lemmy.ml/c/main",
  "type": "Follow",
  "id": "http://ds9.lemmy.ml/activities/follow/6abcd50b-b8ca-4952-86b0-a6dd8cc12866"
}

Unfollow

After following a Community, the "Follow" button is replaced by "Unfollow". Clicking this sends an Undo/Follow activity to the Community inbox. The Community removes the User from its followers list and doesn't send any activities to it anymore.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["http://enterprise.lemmy.ml/c/main"],
  "object": {
    "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "to": ["http://enterprise.lemmy.ml/c/main"],
    "object": "http://enterprise.lemmy.ml/c/main",
    "type": "Follow",
    "id": "http://ds9.lemmy.ml/activities/follow/dc2f1bc5-f3a0-4daa-a46b-428cbfbd023c"
  },
  "type": "Undo",
  "id": "http://ds9.lemmy.ml/activities/undo/dd83c482-8ebd-4b6c-9008-c8373bd1a86a"
}

Create or Update Post

When a user creates a new post, it is sent to the respective community as Create/Page. Editing a previously created post sends an almost identical activity, except the type being Update.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "type": "Page",
    "id": "http://ds9.lemmy.ml/post/1",
    "attributedTo": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "to": [
      "http://enterprise.lemmy.ml/c/main",
      "https://www.w3.org/ns/activitystreams#Public"
    ],
    "audience": "https://enterprise.lemmy.ml/c/main",
    "name": "test post",
    "content": "<p>test body</p>\n",
    "mediaType": "text/html",
    "source": {
      "content": "test body",
      "mediaType": "text/markdown"
    },
    "attachment": [
      {
        "type": "Link",
        "href": "https://lemmy.ml/pictrs/image/xl8W7FZfk9.jpg"
      }
    ],
    "commentsEnabled": true,
    "sensitive": false,
    "language": {
      "identifier": "ko",
      "name": "한국어"
    },
    "published": "2021-10-29T15:10:51.557399+00:00"
  },
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "https://enterprise.lemmy.ml/c/main",
  "type": "Create",
  "id": "http://ds9.lemmy.ml/activities/create/eee6a57a-622f-464d-b560-73ae1fcd3ddf"
}

Create or Update Comment

A reply to a post, or to another comment as Create/Note. Can contain mentions of other users. Editing a previously created post sends an almost identical activity, except the type being Update.

The origin instance also scans the Comment for any User mentions, and sends the Create/Note to those Users as well.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "type": "Note",
    "id": "http://ds9.lemmy.ml/comment/1",
    "attributedTo": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "to": ["https://www.w3.org/ns/activitystreams#Public"],
    "cc": [
      "http://enterprise.lemmy.ml/c/main",
      "http://ds9.lemmy.ml/u/lemmy_alpha"
    ],
    "audience": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "content": "hello",
    "mediaType": "text/html",
    "source": {
      "content": "hello",
      "mediaType": "text/markdown"
    },
    "inReplyTo": "http://ds9.lemmy.ml/post/1",
    "published": "2021-11-01T11:45:49.794920+00:00"
  },
  "cc": [
    "http://enterprise.lemmy.ml/c/main",
    "http://ds9.lemmy.ml/u/lemmy_alpha"
  ],
  "audience": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "tag": [
    {
      "href": "http://ds9.lemmy.ml/u/lemmy_alpha",
      "type": "Mention",
      "name": "@lemmy_alpha@ds9.lemmy.ml"
    }
  ],
  "type": "Create",
  "id": "http://ds9.lemmy.ml/activities/create/1e77d67c-44ac-45ed-bf2a-460e21f60236"
}

Like Post or Comment

An upvote for a post or comment.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "object": "http://ds9.lemmy.ml/comment/1",
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "type": "Like",
  "id": "http://ds9.lemmy.ml/activities/like/fd61d070-7382-46a9-b2b7-6bb253732877"
}

Dislike Post or Comment

A downvote for a post or comment.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "object": "http://ds9.lemmy.ml/post/1",
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "type": "Dislike",
  "id": "http://enterprise.lemmy.ml/activities/dislike/64d40d40-a829-43a5-8247-1fb595b3ca1c"
}

Undo Like or Dislike Post or Comment

Revert a vote that was previously done by the same user.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "object": {
    "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "object": "http://ds9.lemmy.ml/comment/1",
    "audience": "https://enterprise.lemmy.ml/c/tenforward",
    "type": "Like",
    "id": "http://ds9.lemmy.ml/activities/like/efcf7ae2-dfcc-4ff4-9ce4-6adf251ff004"
  },
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "type": "Undo",
  "id": "http://ds9.lemmy.ml/activities/undo/3518565c-24a7-4d9e-8e0a-f7a2f45ac618"
}

Delete Post or Comment

Mods can remove Posts and Comments from their Communities. Admins can remove any Posts or Comments on the entire site. Communities can also be removed by admins. The item is then hidden from all users.

Removals are sent to all followers of the Community, so that they also take effect there. The exception is if an admin removes an item from a Community which is hosted on a different instance. In this case, the removal only takes effect locally.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://ds9.lemmy.ml/post/1",
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "type": "Delete",
  "id": "http://ds9.lemmy.ml/activities/delete/f2abee48-c7bb-41d5-9e27-8775ff32db12"
}

Undo Delete

Post or comment deletions can be reverted by the same user.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "to": ["https://www.w3.org/ns/activitystreams#Public"],
    "object": "http://ds9.lemmy.ml/post/1",
    "cc": ["http://enterprise.lemmy.ml/c/main"],
    "audience": "http://enterprise.lemmy.ml/u/main",
    "type": "Delete",
    "id": "http://ds9.lemmy.ml/activities/delete/b13cca96-7737-41e1-9769-8fbf972b3509"
  },
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "type": "Undo",
  "id": "http://ds9.lemmy.ml/activities/undo/5e939cfb-b8a1-4de8-950f-9d684e9162b9"
}

Report Post, comment or private message

Reports content for rule violation, so that mods/admins can review it.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "object": "http://enterprise.lemmy.ml/post/7",
  "summary": "report this post",
  "type": "Flag",
  "id": "http://ds9.lemmy.ml/activities/flag/98b0933f-5e45-4a95-a15f-e0dc86361ba4"
}

Delete User

Sent when a user deletes his own account.

{
  "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "type": "Delete",
  "id": "http://ds9.lemmy.ml/activities/delete/f2abee48-c7bb-41d5-9e27-8775ff32db12"
}

Community to User

Accept Follow

Automatically sent by the community in response to a Follow. At the same time, the community adds this user to its followers list.

{
  "actor": "http://enterprise.lemmy.ml/c/main",
  "to": ["http://ds9.lemmy.ml/u/lemmy_alpha"],
  "object": {
    "actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "to": ["http://enterprise.lemmy.ml/c/main"],
    "object": "http://enterprise.lemmy.ml/c/main",
    "type": "Follow",
    "id": "http://ds9.lemmy.ml/activities/follow/6abcd50b-b8ca-4952-86b0-a6dd8cc12866"
  },
  "type": "Accept",
  "id": "http://enterprise.lemmy.ml/activities/accept/75f080cc-3d45-4654-8186-8f3bb853fa27"
}

Announce

If the Community receives any Post or Comment related activity (Create, Update, Like, Dislike, Remove, Delete, Undo etc.), it will forward this to its followers. For this, an Announce is created with the Community as actor, and the received activity as object. This is sent to all followers, so they get updated in real time.

{
  "actor": "http://enterprise.lemmy.ml/c/main",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
    "to": ["https://www.w3.org/ns/activitystreams#Public"],
    "object": {
      "type": "Page",
      "id": "http://enterprise.lemmy.ml/post/7",
      "attributedTo": "http://enterprise.lemmy.ml/u/lemmy_beta",
      "to": [
        "http://enterprise.lemmy.ml/c/main",
        "https://www.w3.org/ns/activitystreams#Public"
      ],
      "name": "post 4",
      "mediaType": "text/html",
      "commentsEnabled": true,
      "sensitive": false,
      "stickied": false,
      "published": "2021-11-01T12:11:22.871846+00:00"
    },
    "cc": ["http://enterprise.lemmy.ml/c/main"],
    "type": "Create",
    "id": "http://enterprise.lemmy.ml/activities/create/2807c9ec-3ad8-4859-a9e0-28b59b6e499f"
  },
  "cc": ["http://enterprise.lemmy.ml/c/main/followers"],
  "type": "Announce",
  "id": "http://enterprise.lemmy.ml/activities/announce/8030b171-803a-4108-94b1-342688f375cf"
}

Moderation

These actions can only be done by instance admins or community moderators. They are sent to the community and announced by it. See for a general overview how moderation works in Lemmy. Communities can only be created on the same instance where a user is registered. After that, mods from other instances can be added with Add/User activity.

Remove Post or Comment

Removes a post or comment. The difference to delete is that remove activities have a summary field, which contains the reason for removal, as provided by the mod/admin.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://ds9.lemmy.ml/comment/1",
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "type": "Delete",
  "summary": "bad comment",
  "id": "http://enterprise.lemmy.ml/activities/delete/42ca1a79-f99e-4518-a2ca-ba2df221eb5e"
}

Block User

Blocks a user so he can't participate anymore. The scope is determined by the target field: either a community, or a whole instance. The removeData field can optionally be set to indicate that all previous posts of the user should be deleted.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "target": "http://enterprise.lemmy.ml/c/main",
  "type": "Block",
  "removeData": true,
  "summary": "spam post",
  "expires": "2021-11-01T12:23:50.151874+00:00",
  "id": "http://enterprise.lemmy.ml/activities/block/5d42fffb-0903-4625-86d4-0b39bb344fc2"
}

Lock post

Posts can be locked so that no new comments can be created.

{
  "id": "http://lemmy-alpha:8541/activities/lock/cb48761d-9e8c-42ce-aacb-b4bbe6408db2",
  "actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://lemmy-alpha:8541/post/2",
  "cc": ["http://lemmy-alpha:8541/c/main"],
  "type": "Lock",
  "audience": "http://lemmy-alpha:8541/c/main"
}

Undo mod actions

All previously listed mod actions can be reverted by wrapping the original activity in Undo. Note that Lemmy regenerates the inner activity with a new ID.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
    "to": ["https://www.w3.org/ns/activitystreams#Public"],
    "object": "http://ds9.lemmy.ml/comment/1",
    "cc": ["http://enterprise.lemmy.ml/c/main"],
    "audience": "http://enterprise.lemmy.ml/u/main",
    "type": "Delete",
    "summary": "bad comment",
    "id": "http://enterprise.lemmy.ml/activities/delete/2598435c-87a3-49cd-81f3-a44b03b7af9d"
  },
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "type": "Undo",
  "id": "http://enterprise.lemmy.ml/activities/undo/a850cf21-3866-4b3a-b80b-56aa00997fee"
}
{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": {
    "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
    "to": ["https://www.w3.org/ns/activitystreams#Public"],
    "object": "http://ds9.lemmy.ml/u/lemmy_alpha",
    "cc": ["http://enterprise.lemmy.ml/c/main"],
    "audience": "http://enterprise.lemmy.ml/u/main",
    "target": "http://enterprise.lemmy.ml/c/main",
    "type": "Block",
    "removeData": true,
    "summary": "spam post",
    "expires": "2021-11-01T12:23:50.151874+00:00",
    "id": "http://enterprise.lemmy.ml/activities/block/726f43ab-bd0e-4ab3-89c8-627e976f553c"
  },
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "type": "Undo",
  "id": "http://enterprise.lemmy.ml/activities/undo/06a20ffb-3e32-42fb-8f4c-674b36d7c557"
}

Add or remove featured post

Posts can be pinned so that they are always shown on top of the community. This is federated with the Community featured posts collection.

{
  "cc": ["https://ds9.lemmy.ml/c/main"],
  "id": "https://ds9.lemmy.ml/activities/add/47d911f5-52c5-4659-b2fd-0e58c451a427",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "type": "Add",
  "actor": "https://ds9.lemmy.ml/u/lemmy_alpha",
  "object": "https://ds9.lemmy.ml/post/2",
  "target": "https://ds9.lemmy.ml/c/main/featured",
  "audience": "https://ds9.lemmy.ml/c/main"
}
{
  "cc": ["https://ds9.lemmy.ml/c/main"],
  "id": "https://ds9.lemmy.ml/activities/add/47d911f5-52c5-4659-b2fd-0e58c451a427",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "type": "Remove",
  "actor": "https://ds9.lemmy.ml/u/lemmy_alpha",
  "object": "https://ds9.lemmy.ml/post/2",
  "target": "https://ds9.lemmy.ml/c/main/featured",
  "audience": "https://ds9.lemmy.ml/c/main"
}

Add or remove mod

Add a new mod to the community. Has to be sent by an existing community mod, or an admin of the community's instance.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "target": "http://enterprise.lemmy.ml/c/main/moderators",
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "audience": "http://enterprise.lemmy.ml/u/main",
  "type": "Add",
  "id": "http://enterprise.lemmy.ml/activities/add/ec069147-77c3-447f-88c8-0ef1df10403f"
}

An existing mod can be removed in the same way.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "object": "http://ds9.lemmy.ml/u/lemmy_alpha",
  "cc": ["http://enterprise.lemmy.ml/c/main"],
  "type": "Remove",
  "target": "http://enterprise.lemmy.ml/c/main/moderators",
  "audience": "http://enterprise.lemmy.ml/u/main",
  "id": "http://enterprise.lemmy.ml/activities/remove/aab114f8-cfbd-4935-a5b7-e1a64603650d"
}

User to User

Follow a user

Users from other platforms can follow Lemmy users and receive all of their posts to the inbox. Note that users who are registered on Lemmy can only follow groups, not other users.

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://mycrowd.ca/schemas/litepub-0.1.jsonld",
    {
      "@language": "und"
    }
  ],
  "actor": "https://mycrowd.ca/users/kinetix",
  "cc": [],
  "id": "https://mycrowd.ca/activities/dab6a4d3-0db0-41ee-8aab-7bfa4929b4fd",
  "object": "https://lemmy.ca/u/kinetix",
  "state": "pending",
  "to": ["https://lemmy.ca/u/kinetix"],
  "type": "Follow"
}

Create or Update Private message

User profiles have a "Send Message" button, which opens a dialog permitting to send a private message to this user. It is sent as a Create/ChatMessage to the user inbox. Private messages can only be directed at a single User. They can also be edited with Update/ChatMessage.

{
  "id": "http://enterprise.lemmy.ml/activities/create/987d05fa-f637-46d7-85be-13d112bc269f",
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["http://ds9.lemmy.ml/u/lemmy_alpha"],
  "object": {
    "type": "ChatMessage",
    "id": "http://enterprise.lemmy.ml/private_message/1",
    "attributedTo": "http://enterprise.lemmy.ml/u/lemmy_beta",
    "to": ["http://ds9.lemmy.ml/u/lemmy_alpha"],
    "content": "hello",
    "mediaType": "text/html",
    "source": {
      "content": "hello",
      "mediaType": "text/markdown"
    },
    "published": "2021-10-29T15:31:56.058289+00:00"
  },
  "type": "Create"
}

Delete Private Message

Deletes a previous private message.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["http://enterprise.lemmy.ml/u/lemmy_beta"],
  "object": "http://enterprise.lemmy.ml/private_message/1",
  "type": "Delete",
  "id": "http://enterprise.lemmy.ml/activities/delete/041d9858-5eef-4ad9-84ae-7455b4d87ed9"
}

Undo Delete Private Message

Restores a previously deleted private message. The object is regenerated from scratch, as such the activity ID and other fields are different.

{
  "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
  "to": ["http://ds9.lemmy.ml/u/lemmy_alpha"],
  "object": {
    "actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
    "to": ["http://enterprise.lemmy.ml/u/lemmy_beta"],
    "object": "http://enterprise.lemmy.ml/private_message/1",
    "type": "Delete",
    "id": "http://enterprise.lemmy.ml/activities/delete/616c41be-04ed-4bd4-b865-30712186b122"
  },
  "type": "Undo",
  "id": "http://enterprise.lemmy.ml/activities/undo/35e5b337-014c-4bbe-8d63-6fac96f51409"
}