]> Untitled Git - lemmy.git/blob - docs/src/contributing_apub_api_outline.md
Merge remote-tracking branch 'yerba/main' into main
[lemmy.git] / docs / src / contributing_apub_api_outline.md
1 # Activitypub API outline
2
3 This document is targeted at developers who are familiar with the ActivityPub and ActivityStreams protocols. It gives a detailed outline of the actors, objects and activities used by Lemmy.
4
5 Before reading this, have a look at our [Federation Overview](contributing_federation_overview.md) to get an idea how Lemmy federation works on a high level.
6
7 Lemmy does not yet follow the ActivityPub spec in all regards. For example, we don't set a valid context indicating our context fields. We also ignore fields like `inbox`, `outbox` or `endpoints` for remote actors, and assume that everything is Lemmy. For an overview of deviations, read [#698](https://github.com/LemmyNet/lemmy/issues/698). They will be fixed in the near future.
8
9 Lemmy is also really inflexible when it comes to incoming activities and objects. They need to be exactly identical to the examples below. Things like having an array instead of a single value, or an object ID instead of the full object will result in an error.
10
11 In the following tables, "mandatory" refers to whether or not Lemmy will accept an incoming activity without this field. Lemmy itself will always include all non-empty fields.
12
13 <!-- toc -->
14
15 - [Actors](#actors)
16   * [Community](#community)
17   * [User](#user)
18 - [Objects](#objects)
19   * [Post](#post)
20   * [Comment](#comment)
21   * [Private Message](#private-message)
22 - [Activities](#activities)
23   * [Follow](#follow)
24   * [Accept Follow](#accept-follow)
25   * [Unfollow](#unfollow)
26   * [Create or Update Post](#create-or-update-post)
27   * [Create or Update Comment](#create-or-update-comment)
28   * [Like Post or Comment](#like-post-or-comment)
29   * [Dislike Post or Comment](#dislike-post-or-comment)
30   * [Delete Post or Comment](#delete-post-or-comment)
31   * [Remove Post or Comment](#remove-post-or-comment)
32   * [Undo](#undo)
33   * [Announce](#announce)
34   * [Create or Update Private message](#create-or-update-private-message)
35   * [Delete Private Message](#delete-private-message)
36   * [Undo Delete Private Message](#undo-delete-private-message)
37
38 <!-- tocstop -->
39
40 ## Actors
41
42 ### Community
43
44 An automated actor. Users can send posts or comments to it, which the community forwards to its followers in the form of `Announce`.
45
46 Sends activities to user: `Accept/Follow`, `Announce`
47
48 Receives activities from user: `Follow`, `Undo/Follow`, `Create`, `Update`, `Like`, `Dislike`, `Remove` (only admin/mod), `Delete` (only creator), `Undo` (only for own actions)
49
50 ```json
51 {
52     "@context": "https://www.w3.org/ns/activitystreams",
53     "id": "https://enterprise.lemmy.ml/c/main",
54     "type": "Group",
55     "preferredUsername": "main",
56     "name": "The Main Community",
57     "category": { 
58         "identifier": "1",
59         "name": "Discussion"
60     },
61     "sensitive": false,
62     "attributedTo": [
63         "https://enterprise.lemmy.ml/u/picard",
64         "https://enterprise.lemmy.ml/u/riker"
65     ],
66     "content": "Welcome to the default community!",
67     "source": {
68         "content": "Welcome to the default community!",
69         "mediaType": "text/markdown"
70     },
71     "icon": {
72         "type": "Image",
73         "url": "https://enterprise.lemmy.ml/pictrs/image/Z8pFFb21cl.png"
74     },
75     "image": {
76         "type": "Image",
77         "url": "https://enterprise.lemmy.ml/pictrs/image/Wt8zoMcCmE.jpg"
78     },
79     "inbox": "https://enterprise.lemmy.ml/c/main/inbox",
80     "outbox": "https://enterprise.lemmy.ml/c/main/outbox",
81     "followers": "https://enterprise.lemmy.ml/c/main/followers",
82     "endpoints": {
83         "sharedInbox": "https://enterprise.lemmy.ml/inbox"
84     },
85     "published": "2020-10-06T17:27:43.282386+00:00",
86     "updated": "2020-10-08T11:57:50.545821+00:00",
87     "publicKey": {
88         "id": "https://enterprise.lemmy.ml/c/main#main-key",
89         "owner": "https://enterprise.lemmy.ml/c/main",
90         "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9JJ7Ybp/H7iXeLkWFepg\ny4PHyIXY1TO9rK3lIBmAjNnkNywyGXMgUiiVhGyN9yU7Km8aWayQsNHOkPL7wMZK\nnY2Q+CTQv49kprEdcDVPGABi6EbCSOcRFVaUjjvRHf9Olod2QP/9OtX0oIFKN2KN\nPIUjeKK5tw4EWB8N1i5HOuOjuTcl2BXSemCQLAlXerLjT8xCarGi21xHPaQvAuns\nHt8ye7fUZKPRT10kwDMapjQ9Tsd+9HeBvNa4SDjJX1ONskNh2j4bqHHs2WUymLpX\n1cgf2jmaXAsz6jD9u0wfrLPelPJog8RSuvOzDPrtwX6uyQOl5NK00RlBZwj7bMDx\nzwIDAQAB\n-----END PUBLIC KEY-----\n"
91     }
92 }
93 ```
94
95 | Field Name | Mandatory | Description |
96 |---|---|---|
97 | `preferredUsername` | yes | Name of the actor |
98 | `name` | yes | Title of the community |
99 | `category` | yes | Hardcoded list of categories, see https://lemmy.ml/api/v1/categories |
100 | `sensitive` | yes | True indicates that all posts in the community are nsfw |
101 | `attributedTo` | yes | First the community creator, then all the remaining moderators |
102 | `content` | no | Text for the community sidebar, usually containing a description and rules |
103 | `icon` | no | Icon, shown next to the community name |
104 | `image` | no | Banner image, shown on top of the community page |
105 | `inbox` | no | ActivityPub inbox URL |
106 | `outbox` | no | ActivityPub outbox URL, only contains up to 20 latest posts, no comments, votes or other activities |
107 | `followers` | no | Follower collection URL, only contains the number of followers, no references to individual followers |
108 | `endpoints` | no | Contains URL of shared inbox |
109 | `published` | no | Datetime when the community was first created |
110 | `updated` | no | Datetime when the community was last changed |
111 | `publicKey` | yes | The public key used to verify signatures from this actor |
112    
113 ### User
114
115 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.
116
117 Sends activities to Community: `Follow`, `Undo/Follow`, `Create`, `Update`, `Like`, `Dislike`, `Remove` (only admin/mod), `Delete` (only creator), `Undo` (only for own actions)
118
119 Receives activities from Community: `Accept/Follow`, `Announce`
120
121 Sends and receives activities from/to other users: `Create/Note`, `Update/Note`, `Delete/Note`, `Undo/Delete/Note` (all those related to private messages)
122
123 ```json
124 {
125     "@context": "https://www.w3.org/ns/activitystreams",
126     "id": "https://enterprise.lemmy.ml/u/picard",
127     "type": "Person",
128     "preferredUsername": "picard",
129     "name": "Jean-Luc Picard",
130     "content": "The user bio",
131     "source": {
132         "content": "The user bio",
133         "mediaType": "text/markdown"
134     },
135     "icon": {
136         "type": "Image",
137         "url": "https://enterprise.lemmy.ml/pictrs/image/DS3q0colRA.jpg"
138     },
139     "image": {
140         "type": "Image",
141         "url": "https://enterprise.lemmy.ml/pictrs/image/XenaYI5hTn.png"
142     },
143     "inbox": "https://enterprise.lemmy.ml/u/picard/inbox",
144     "endpoints": {
145         "sharedInbox": "https://enterprise.lemmy.ml/inbox"
146     },
147     "published": "2020-10-06T17:27:43.234391+00:00",
148     "updated": "2020-10-08T11:27:17.905625+00:00",
149     "publicKey": {
150         "id": "https://enterprise.lemmy.ml/u/picard#main-key",
151         "owner": "https://enterprise.lemmy.ml/u/picard",
152         "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyH9iH83+idw/T4QpuRSY\n5YgQ/T5pJCNxvQWb6qcCu3gEVigfbreqZKJpOih4YT36wu4GjPfoIkbWJXcfcEzq\nMEQoYbPStuwnklpN2zj3lRIPfGLht9CAlENLWikTUoW5kZLyU6UQtOGdT2b1hDuK\nsUEn67In6qYx6pal8fUbO6X3O2BKzGeofnXgHCu7QNIuH4RPzkWsLhvwqEJYP0zG\nodao2j+qmhKFsI4oNOUCGkdJejO7q+9gdoNxAtNNKilIOwUFBYXeZJb+XGlzo0X+\n70jdJ/xQCPlPlItU4pD/0FwPLtuReoOpMzLi20oDsPXJBvn+/NJaxqDINuywcN5p\n4wIDAQAB\n-----END PUBLIC KEY-----\n"
153     }
154 }
155 ```
156
157 | Field Name | Mandatory | Description |
158 |---|---|---|
159 | `preferredUsername` | yes | Name of the actor |
160 | `name` | no | The user's displayname |
161 | `content` | no | User bio |
162 | `icon` | no | The user's avatar, shown next to the username |
163 | `image` | no | The user's banner, shown on top of the profile |
164 | `inbox` | no | ActivityPub inbox URL |
165 | `endpoints` | no | Contains URL of shared inbox |
166 | `published` | no | Datetime when the user signed up |
167 | `updated` | no | Datetime when the user profile was last changed |
168 | `publicKey` | yes | The public key used to verify signatures from this actor |
169
170 ## Objects
171
172 ### Post
173
174 A page with title, and optional URL and text content. The URL often leads to an image, in which case a thumbnail is included. Each post belongs to exactly one community.
175
176 ```json
177 {
178     "@context": "https://www.w3.org/ns/activitystreams",
179     "id": "https://voyager.lemmy.ml/post/29",
180     "type": "Page",
181     "attributedTo": "https://voyager.lemmy.ml/u/picard",
182     "to": "https://voyager.lemmy.ml/c/main",
183     "summary": "Test thumbnail 2",
184     "content": "blub blub",
185     "source": {
186         "content": "blub blub",
187         "mediaType": "text/markdown"
188     },
189     "url": "https://voyager.lemmy.ml:/pictrs/image/fzGwCsq7BJ.jpg",
190     "image": {
191         "type": "Image",
192         "url": "https://voyager.lemmy.ml/pictrs/image/UejwBqrJM2.jpg"
193     },
194     "commentsEnabled": true,
195     "sensitive": false,
196     "stickied": false,
197     "published": "2020-09-24T17:42:50.396237+00:00",
198     "updated": "2020-09-24T18:31:14.158618+00:00"
199 }
200 ```
201
202 | Field Name | Mandatory | Description |
203 |---|---|---|
204 | `attributedTo` | yes | ID of the user which created this post |
205 | `to` | yes | ID of the community where it was posted to |
206 | `summary` | yes | Title of the post |
207 | `content` | no | Body of the post |
208 | `url` | no | An arbitrary link to be shared |
209 | `image` | no | Thumbnail for `url`, only present if it is an image link |
210 | `commentsEnabled` | yes | False indicates that the post is locked, and no comments can be added |
211 | `sensitive` | yes | True marks the post as NSFW, blurs the thumbnail and hides it from users with NSFW settign disabled |
212 | `stickied` | yes | True means that it is shown on top of the community |
213 | `published` | no | Datetime when the post was created |
214 | `updated` | no | Datetime when the post was edited (not present if it was never edited) |
215
216 ### Comment
217
218 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.
219
220 ```json
221 {
222     "@context": "https://www.w3.org/ns/activitystreams",
223     "id": "https://enterprise.lemmy.ml/comment/95",
224     "type": "Note",
225     "attributedTo": "https://enterprise.lemmy.ml/u/picard",
226     "to": "https://enterprise.lemmy.ml/c/main",
227     "content": "mmmk",
228     "source": {
229         "content": "mmmk",
230         "mediaType": "text/markdown"
231     },
232     "inReplyTo": [
233         "https://enterprise.lemmy.ml/post/38",
234         "https://voyager.lemmy.ml/comment/73"
235     ],
236     "published": "2020-10-06T17:53:22.174836+00:00",
237     "updated": "2020-10-06T17:53:22.174836+00:00"
238 }
239 ```
240
241 | Field Name | Mandatory | Description |
242 |---|---|---|
243 | `attributedTo` | yes | ID of the user who created the comment |
244 | `to` | yes | Community where the comment was made |
245 | `content` | yes | The comment text |
246 | `inReplyTo` | yes | IDs of the post where this comment was made, and the parent comment. If this is a top-level comment, `inReplyTo` only contains the post |
247 | `published` | no | Datetime when the comment was created |
248 | `updated` | no | Datetime when the comment was edited (not present if it was never edited) |
249
250 ### Private Message
251
252 A direct message from one user to another. Can not include additional users. Threading is not implemented yet, so the `inReplyTo` field is missing.
253
254 ```json
255 {
256     "@context": "https://www.w3.org/ns/activitystreams",
257     "id": "https://enterprise.lemmy.ml/private_message/34",
258     "type": "Note",
259     "attributedTo": "https://enterprise.lemmy.ml/u/picard",
260     "to": "https://voyager.lemmy.ml/u/janeway",
261     "content": "test",
262     "source": {
263         "content": "test",
264         "mediaType": "text/markdown"
265     },
266     "mediaType": "text/markdown",
267     "published": "2020-10-08T19:10:46.542820+00:00",
268     "updated": "2020-10-08T20:13:52.547156+00:00"
269 }
270 ```
271
272 | Field Name | Mandatory | Description |
273 |---|---|---|
274 | `attributedTo` | ID of the user who created this private message |
275 | `to` | ID of the recipient |
276 | `content` | yes | The text of the private message |
277 | `published` | no | Datetime when the message was created |
278 | `updated` | no | Datetime when the message was edited (not present if it was never edited) |
279
280 ## Activities
281
282 ### Follow
283
284 When the user clicks "Subscribe" in a community, a `Follow` is sent. The community automatically responds with an `Accept/Follow`.
285
286 Sent by: User
287
288 Sent to: Community
289
290 ```json
291 {
292     "@context": "https://www.w3.org/ns/activitystreams",
293     "id": "https://enterprise.lemmy.ml/activities/follow/2e4784b7-4edf-4fa1-a352-674d5d5f8891",
294     "type": "Follow",
295     "actor": "https://enterprise.lemmy.ml/u/picard",
296     "to": "https://ds9.lemmy.ml/c/main",
297     "object": "https://ds9.lemmy.ml/c/main"
298 }
299 ```
300
301 | Field Name | Mandatory | Description |
302 |---|---|---|
303 | `actor` | yes | The user that is sending the follow request |
304 | `object` | yes | The community to be followed |
305
306 ### Accept Follow
307
308 Automatically sent by the community in response to a `Follow`. At the same time, the community adds this user to its followers list.
309
310 Sent by: Community
311
312 Sent to: User
313
314 ```json
315 {
316     "@context": "https://www.w3.org/ns/activitystreams",
317     "id": "https://ds9.lemmy.ml/activities/accept/5314bf7c-dab8-4b01-baf2-9be11a6a812e",
318     "type": "Accept",
319     "actor": "https://ds9.lemmy.ml/c/main",
320     "to": "https://enterprise.lemmy.ml/u/picard",
321     "object": {
322         "@context": "https://www.w3.org/ns/activitystreams",
323         "id": "https://enterprise.lemmy.ml/activities/follow/2e4784b7-4edf-4fa1-a352-674d5d5f8891",
324         "type": "Follow",
325         "object": "https://ds9.lemmy.ml/c/main",
326         "actor": "https://enterprise.lemmy.ml/u/picard"
327     }
328 }
329 ```
330
331 | Field Name | Mandatory | Description |
332 |---|---|---|
333 | `actor` | yes | The same community as in the `Follow` activity |
334 | `to` | no | ID of the user which sent the `Follow` |
335 | `object` | yes | The previously sent `Follow` activity |
336
337 ### Unfollow
338
339 Clicking on the unsubscribe button in a community causes an `Undo/Follow` to be sent. The community removes the user from its follower list after receiving it.
340
341 Sent by: User
342
343 Sent to: Community
344
345 ```json
346 {
347     "@context": "https://www.w3.org/ns/activitystreams",
348     "id": "http://lemmy-alpha:8541/activities/undo/2c624a77-a003-4ed7-91cb-d502eb01b8e8",
349     "type": "Undo",
350     "actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
351     "to": "http://lemmy-beta:8551/c/main",
352     "object": {
353         "@context": "https://www.w3.org/ns/activitystreams",
354         "id": "http://lemmy-alpha:8541/activities/follow/f0d732e7-b1e7-4857-a5e0-9dc83c3f7ee8",
355         "type": "Follow",
356         "actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
357         "object": "http://lemmy-beta:8551/c/main"
358     }
359 }
360 ```
361 ### Create or Update Post
362
363 When a user creates a new post, it is sent to the respective community. Editing a previously created post sends an almost identical activity, except the `type` being `Update`. We don't support mentions in posts yet.
364
365 Sent by: User
366
367 Sent to: Community
368
369 ```json
370 {
371     "@context": "https://www.w3.org/ns/activitystreams",
372     "id": "https://enterprise.lemmy.ml/activities/create/6e11174f-501a-4531-ac03-818739bfd07d",
373     "type": "Create",
374     "actor": "https://enterprise.lemmy.ml/u/riker",
375     "to": "https://www.w3.org/ns/activitystreams#Public",
376     "cc": [
377       "https://ds9.lemmy.ml/c/main/"
378     ],
379     "object": ...
380 }
381 ```
382
383 | Field Name | Mandatory | Description |
384 |---|---|---|
385 | `type` | yes | either `Create` or `Update` |
386 | `cc` | yes | Community where the post is being made |
387 | `object` | yes | The post being created |
388
389 ### Create or Update Comment
390
391 A reply to a post, or to another comment. Can contain mentions of other users. Editing a previously created post sends an almost identical activity, except the `type` being `Update`.
392
393 Sent by: User
394
395 Sent to: Community
396
397 ```json
398 {
399     "@context": "https://www.w3.org/ns/activitystreams",
400     "id": "https://enterprise.lemmy.ml/activities/create/6f52d685-489d-4989-a988-4faedaed1a70",
401     "type": "Create",
402     "actor": "https://enterprise.lemmy.ml/u/riker",
403     "to": "https://www.w3.org/ns/activitystreams#Public",
404     "tag": [{
405         "type": "Mention",
406         "name": "@sisko@ds9.lemmy.ml",
407         "href": "https://ds9.lemmy.ml/u/sisko"
408     }],
409     "cc": [
410         "https://ds9.lemmy.ml/c/main/",
411         "https://ds9.lemmy.ml/u/sisko"
412     ],
413     "object": ...
414 }
415 ```
416
417 | Field Name | Mandatory | Description |
418 |---|---|---|
419 | `tag` | no | List of users which are mentioned in the comment (like `@user@example.com`) |
420 | `cc` | yes | Community where the post is being made, the user being replied to (creator of the parent post/comment), as well as any mentioned users |
421 | `object` | yes | The comment being created |
422
423 ### Like Post or Comment
424
425 An upvote for a post or comment.
426
427 Sent by: User
428
429 Sent to: Community
430
431 ```json
432 {
433     "@context": "https://www.w3.org/ns/activitystreams",
434     "id": "https://enterprise.lemmy.ml/activities/like/8f3f48dd-587d-4624-af3d-59605b7abad3",
435     "type": "Like",
436     "actor": "https://enterprise.lemmy.ml/u/riker",
437     "to": "https://www.w3.org/ns/activitystreams#Public",
438     "cc": [
439         "https://ds9.lemmy.ml/c/main/"
440     ],
441     "object": ...
442 }
443 ```
444
445 | Field Name | Mandatory | Description |
446 |---|---|---|
447 | `cc` | yes | ID of the community where the post/comment is |
448 | `object` | yes | The post or comment being upvoted |
449
450 ### Dislike Post or Comment
451
452 A downvote for a post or comment.
453
454 Sent by: User
455
456 Sent to: Community
457
458 ```json
459 {
460     "@context": "https://www.w3.org/ns/activitystreams",
461     "id": "https://enterprise.lemmy.ml/activities/dislike/fd2b8e1d-719d-4269-bf6b-2cadeebba849",
462     "type": "Dislike",
463     "actor": "https://enterprise.lemmy.ml/u/riker",
464     "to": "https://www.w3.org/ns/activitystreams#Public",
465     "cc": [
466       "https://ds9.lemmy.ml/c/main/"
467     ],
468     "object": ...
469 }
470 ```
471
472 | Field Name | Mandatory | Description |
473 |---|---|---|
474 | `cc` | yes | ID of the community where the post/comment is |
475 | `object` | yes | The post or comment being upvoted |
476
477 ### Delete Post or Comment
478
479 Deletes a previously created post or comment. This can only be done by the original creator of that post/comment.
480
481 Sent by: User
482
483 Sent to: Community
484
485 ```json
486 {
487     "@context": "https://www.w3.org/ns/activitystreams",
488     "id": "https://enterprise.lemmy.ml/activities/delete/f1b5d57c-80f8-4e03-a615-688d552e946c",
489     "type": "Delete",
490     "actor": "https://enterprise.lemmy.ml/u/riker",
491     "to": "https://www.w3.org/ns/activitystreams#Public",
492     "cc": [
493         "https://enterprise.lemmy.ml/c/main/"
494     ],
495     "object": "https://enterprise.lemmy.ml/post/32"
496 }
497 ```
498
499 | Field Name | Mandatory | Description |
500 |---|---|---|
501 | `cc` | yes | ID of the community where the post/comment is |
502 | `object` | yes | ID of the post or comment being deleted |
503
504 ### Remove Post or Comment
505
506 Removes a post or comment. This can only be done by a community mod, or by an admin on the instance where the community is hosted.
507
508 Sent by: User
509
510 Sent to: Community
511
512 ```json
513 {
514     "@context": "https://www.w3.org/ns/activitystreams",
515     "id": "https://ds9.lemmy.ml/activities/remove/aab93b8e-3688-4ea3-8212-d00d29519218",
516     "type": "Remove",
517     "actor": "https://ds9.lemmy.ml/u/sisko",
518     "to": "https://www.w3.org/ns/activitystreams#Public",
519     "cc": [
520         "https://ds9.lemmy.ml/c/main/"
521     ],
522     "object": "https://enterprise.lemmy.ml/comment/32"
523 }
524 ```
525
526 | Field Name | Mandatory | Description |
527 |---|---|---|
528 | `cc` | yes | ID of the community where the post/comment is |
529 | `object` | yes | ID of the post or comment being removed |
530
531 ### Undo
532
533 Reverts a previous activity, can only be done by the `actor` of `object`. In case of a `Like` or `Dislike`, the vote count is changed back. In case of a `Delete` or `Remove`, the post/comment is restored. The `object` is regenerated from scratch, as such the activity ID and other fields are different.
534
535 Sent by: User
536
537 Sent to: Community
538
539 ```json
540 {
541   "@context": "https://www.w3.org/ns/activitystreams",
542   "id": "https://ds9.lemmy.ml/activities/undo/70ca5fb2-e280-4fd0-a593-334b7f8a5916",
543   "type": "Undo",
544   "actor": "https://ds9.lemmy.ml/u/sisko",
545   "to": "https://www.w3.org/ns/activitystreams#Public",
546   "cc": [
547     "https://ds9.lemmy.ml/c/main/"
548   ],
549   "object": ...
550 }
551 ```
552
553 | Field Name | Mandatory | Description |
554 |---|---|---|
555 | `object` | yes | Any `Like`, `Dislike`, `Delete` or `Remove` activity as described above |
556
557 ### Announce
558
559 When the community receives a post or comment activity, it wraps that into an `Announce` and sends it to all followers.
560
561 Sent by: Community
562
563 Sent to: User
564
565 ```json
566 {
567   "@context": "https://www.w3.org/ns/activitystreams",
568   "id": "https://ds9.lemmy.ml/activities/announce/b98382e8-6cb1-469e-aa1f-65c5d2c31cc4",
569   "type": "Announce",
570   "actor": "https://ds9.lemmy.ml/c/main",
571   "to": "https://www.w3.org/ns/activitystreams#Public",
572   "cc": [
573     "https://ds9.lemmy.ml/c/main/followers"
574   ],
575   "object": ...
576 }
577 ```
578
579 | Field Name | Mandatory | Description |
580 |---|---|---|
581 | `object` | yes | Any `Create`, `Update`, `Like`, `Dislike`, `Delete` `Remove` or `Undo` activity as described above |
582
583 ### Remove or Delete Community
584
585 ```json
586 {
587   "@context": "https://www.w3.org/ns/activitystreams",
588   "id": "http://ds9.lemmy.ml/activities/remove/e4ca7688-af9d-48b7-864f-765e7f9f3591",
589   "type": "Remove",
590   "actor": "http://ds9.lemmy.ml/c/some_community",
591   "cc": [
592     "http://ds9.lemmy.ml/c/some_community/followers"
593   ],
594   "to": "https://www.w3.org/ns/activitystreams#Public",
595   "object": "http://ds9.lemmy.ml/c/some_community"
596 }
597 ```
598
599 | Field Name | Mandatory | Description |
600 |---|---|---|
601 | `type` | yes | Either `Remove` or `Delete` |
602
603 ### Restore Removed or Deleted Community 
604
605 ```json
606 {
607   "@context": "https://www.w3.org/ns/activitystreams",
608   "id": "http://ds9.lemmy.ml/activities/like/0703668c-8b09-4a85-aa7a-f93621936901",
609   "type": "Undo",
610   "actor": "http://ds9.lemmy.ml/c/some_community",
611   "to": "https://www.w3.org/ns/activitystreams#Public",
612   "cc": [
613     "http://ds9.lemmy.ml/c/testcom/followers"
614   ],
615   "object": {
616     "@context": "https://www.w3.org/ns/activitystreams",
617     "id": "http://ds9.lemmy.ml/activities/remove/1062b5e0-07e8-44fc-868c-854209935bdd",
618     "type": "Remove",
619     "actor": "http://ds9.lemmy.ml/c/some_community",
620     "object": "http://ds9.lemmy.ml/c/testcom",
621     "to": "https://www.w3.org/ns/activitystreams#Public",
622     "cc": [
623       "http://ds9.lemmy.ml/c/testcom/followers"
624     ]
625   }
626 }
627
628 ```
629 | Field Name | Mandatory | Description |
630 |---|---|---|
631 | `object.type` | yes | Either `Remove` or `Delete` |
632
633 ### Create or Update Private message 
634
635 Creates a new private message between two users.
636
637 Sent by: User
638
639 Sent to: User
640
641 ```json
642 {
643     "@context": "https://www.w3.org/ns/activitystreams",
644     "id": "https://ds9.lemmy.ml/activities/create/202daf0a-1489-45df-8d2e-c8a3173fed36",
645     "type": "Create",
646     "actor": "https://ds9.lemmy.ml/u/sisko",
647     "to": "https://enterprise.lemmy.ml/u/riker/inbox",
648     "object": ...
649 }
650 ```
651
652 | Field Name | Mandatory | Description |
653 |---|---|---|
654 | `type` | yes | Either `Create` or `Update` |
655
656 ### Delete Private Message
657
658 Deletes a previous private message.
659
660 Sent by: User
661
662 Sent to: User
663
664 ```json
665 {
666     "@context": "https://www.w3.org/ns/activitystreams",
667     "id": "https://ds9.lemmy.ml/activities/delete/2de5a5f3-bf26-4949-a7f5-bf52edfca909",
668     "type": "Delete",
669     "actor": "https://ds9.lemmy.ml/u/sisko",
670     "to": "https://enterprise.lemmy.ml/u/riker/inbox",
671     "object": "https://ds9.lemmy.ml/private_message/341"
672 }
673 ```
674
675 ### Undo Delete Private Message
676
677 Restores a previously deleted private message. The `object` is regenerated from scratch, as such the activity ID and other fields are different.
678
679 Sent by: User
680
681 Sent to: User
682
683 ```json
684 {
685     "@context": "https://www.w3.org/ns/activitystreams",
686     "id": "https://ds9.lemmy.ml/activities/undo/b24bc56d-5db1-41dd-be06-3f1db8757842",
687     "type": "Undo",
688     "actor": "https://ds9.lemmy.ml/u/sisko",
689     "to": "https://enterprise.lemmy.ml/u/riker/inbox",
690     "object": ...
691 }
692 ```