211b5e736c5e4682e111b2211c68e7898092d782
[akkoma] / docs / docs / development / API / admin_api.md
1 # Admin API
2
3 Authentication is required and the user must be an admin.
4
5 The `/api/v1/pleroma/admin/*` path is backwards compatible with `/api/pleroma/admin/*` (`/api/pleroma/admin/*` will be deprecated in the future).
6
7 ## `GET /api/v1/pleroma/admin/users`
8
9 ### List users
10
11 - Query Params:
12 - *optional* `query`: **string** search term (e.g. nickname, domain, nickname@domain)
13 - *optional* `filters`: **string** comma-separated string of filters:
14 - `local`: only local users
15 - `external`: only external users
16 - `active`: only active users
17 - `need_approval`: only unapproved users
18 - `unconfirmed`: only unconfirmed users
19 - `deactivated`: only deactivated users
20 - `is_admin`: users with admin role
21 - `is_moderator`: users with moderator role
22 - *optional* `page`: **integer** page number
23 - *optional* `page_size`: **integer** number of users per page (default is `50`)
24 - *optional* `tags`: **[string]** tags list
25 - *optional* `actor_types`: **[string]** actor type list (`Person`, `Service`, `Application`)
26 - *optional* `name`: **string** user display name
27 - *optional* `email`: **string** user email
28 - Example: `https://mypleroma.org/api/v1/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com`
29 - Response:
30
31 ```json
32 {
33 "page_size": integer,
34 "count": integer,
35 "users": [
36 {
37 "deactivated": bool,
38 "id": integer,
39 "nickname": string,
40 "roles": {
41 "admin": bool,
42 "moderator": bool
43 },
44 "local": bool,
45 "tags": array,
46 "avatar": string,
47 "display_name": string,
48 "confirmation_pending": bool,
49 "approval_pending": bool,
50 "registration_reason": string,
51 },
52 ...
53 ]
54 }
55 ```
56
57 ## DEPRECATED `DELETE /api/v1/pleroma/admin/users`
58
59 ### Remove a user
60
61 - Params:
62 - `nickname`
63 - Response: User’s nickname
64
65 ## `DELETE /api/v1/pleroma/admin/users`
66
67 ### Remove a user
68
69 - Params:
70 - `nicknames`
71 - Response: Array of user nicknames
72
73 ### Create a user
74
75 - Method: `POST`
76 - Params:
77 `users`: [
78 {
79 `nickname`,
80 `email`,
81 `password`
82 }
83 ]
84 - Response: User’s nickname
85
86 ## `POST /api/v1/pleroma/admin/users/follow`
87
88 ### Make a user follow another user
89
90 - Params:
91 - `follower`: The nickname of the follower
92 - `followed`: The nickname of the followed
93 - Response:
94 - "ok"
95
96 ## `POST /api/v1/pleroma/admin/users/unfollow`
97
98 ### Make a user unfollow another user
99
100 - Params:
101 - `follower`: The nickname of the follower
102 - `followed`: The nickname of the followed
103 - Response:
104 - "ok"
105
106 ## `PATCH /api/v1/pleroma/admin/users/:nickname/toggle_activation`
107
108 ### Toggle user activation
109
110 - Params:
111 - `nickname`
112 - Response: User’s object
113
114 ```json
115 {
116 "deactivated": bool,
117 "id": integer,
118 "nickname": string
119 }
120 ```
121
122 ## `PUT /api/v1/pleroma/admin/users/tag`
123
124 ### Tag a list of users
125
126 - Params:
127 - `nicknames` (array)
128 - `tags` (array)
129
130 ## `DELETE /api/v1/pleroma/admin/users/tag`
131
132 ### Untag a list of users
133
134 - Params:
135 - `nicknames` (array)
136 - `tags` (array)
137
138 ## `GET /api/v1/pleroma/admin/users/:nickname/permission_group`
139
140 ### Get user user permission groups membership
141
142 - Params: none
143 - Response:
144
145 ```json
146 {
147 "is_moderator": bool,
148 "is_admin": bool
149 }
150 ```
151
152 ## `GET /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
153
154 Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
155
156 ### Get user user permission groups membership per permission group
157
158 - Params: none
159 - Response:
160
161 ```json
162 {
163 "is_moderator": bool,
164 "is_admin": bool
165 }
166 ```
167
168 ## DEPRECATED `POST /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
169
170 ### Add user to permission group
171
172 - Params: none
173 - Response:
174 - On failure: `{"error": "…"}`
175 - On success: JSON of the user
176
177 ## `POST /api/v1/pleroma/admin/users/permission_group/:permission_group`
178
179 ### Add users to permission group
180
181 - Params:
182 - `nicknames`: nicknames array
183 - Response:
184 - On failure: `{"error": "…"}`
185 - On success: JSON of the user
186
187 ## DEPRECATED `DELETE /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
188
189 ## `DELETE /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
190
191 ### Remove user from permission group
192
193 - Params: none
194 - Response:
195 - On failure: `{"error": "…"}`
196 - On success: JSON of the user
197 - Note: An admin cannot revoke their own admin status.
198
199 ## `DELETE /api/v1/pleroma/admin/users/permission_group/:permission_group`
200
201 ### Remove users from permission group
202
203 - Params:
204 - `nicknames`: nicknames array
205 - Response:
206 - On failure: `{"error": "…"}`
207 - On success: JSON of the user
208 - Note: An admin cannot revoke their own admin status.
209
210 ## `PATCH /api/v1/pleroma/admin/users/activate`
211
212 ### Activate user
213
214 - Params:
215 - `nicknames`: nicknames array
216 - Response:
217
218 ```json
219 {
220 users: [
221 {
222 // user object
223 }
224 ]
225 }
226 ```
227
228 ## `PATCH /api/v1/pleroma/admin/users/deactivate`
229
230 ### Deactivate user
231
232 - Params:
233 - `nicknames`: nicknames array
234 - Response:
235
236 ```json
237 {
238 users: [
239 {
240 // user object
241 }
242 ]
243 }
244 ```
245
246 ## `PATCH /api/v1/pleroma/admin/users/approve`
247
248 ### Approve user
249
250 - Params:
251 - `nicknames`: nicknames array
252 - Response:
253
254 ```json
255 {
256 users: [
257 {
258 // user object
259 }
260 ]
261 }
262 ```
263
264 ## `PATCH /api/v1/pleroma/admin/users/suggest`
265
266 ### Suggest a user
267
268 Adds the user(s) to follower recommendations.
269
270 - Params:
271 - `nicknames`: nicknames array
272 - Response:
273
274 ```json
275 {
276 users: [
277 {
278 // user object
279 }
280 ]
281 }
282 ```
283
284 ## `PATCH /api/v1/pleroma/admin/users/unsuggest`
285
286 ### Unsuggest a user
287
288 Removes the user(s) from follower recommendations.
289
290 - Params:
291 - `nicknames`: nicknames array
292 - Response:
293
294 ```json
295 {
296 users: [
297 {
298 // user object
299 }
300 ]
301 }
302 ```
303
304 ## `GET /api/v1/pleroma/admin/users/:nickname_or_id`
305
306 ### Retrive the details of a user
307
308 - Params:
309 - `nickname` or `id`
310 - Response:
311 - On failure: `Not found`
312 - On success: JSON of the user
313
314 ## `GET /api/v1/pleroma/admin/users/:nickname_or_id/statuses`
315
316 ### Retrive user's latest statuses
317
318 - Params:
319 - `nickname` or `id`
320 - *optional* `page_size`: number of statuses to return (default is `20`)
321 - *optional* `godmode`: `true`/`false` – allows to see private statuses
322 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
323 - Response:
324 - On failure: `Not found`
325 - On success: JSON, where:
326 - `total`: total count of the statuses for the user
327 - `activities`: list of the statuses for the user
328
329 ```json
330 {
331 "total" : 1,
332 "activities": [
333 // activities list
334 ]
335 }
336 ```
337
338 ## `GET /api/v1/pleroma/admin/instances/:instance/statuses`
339
340 ### Retrive instance's latest statuses
341
342 - Params:
343 - `instance`: instance name
344 - *optional* `page_size`: number of statuses to return (default is `20`)
345 - *optional* `godmode`: `true`/`false` – allows to see private statuses
346 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
347 - Response:
348 - On failure: `Not found`
349 - On success: JSON, where:
350 - `total`: total count of the statuses for the instance
351 - `activities`: list of the statuses for the instance
352
353 ```json
354 {
355 "total" : 1,
356 "activities": [
357 // activities list
358 ]
359 }
360 ```
361
362 ## `DELETE /api/v1/pleroma/admin/instances/:instance`
363
364 ### Delete all users and activities from a remote instance
365
366 Note: this will trigger a job to remove instance content in the background.
367 It may take some time.
368
369 - Params:
370 - `instance`: remote instance host
371 - Response:
372 - The `instance` name as a string
373
374 ```json
375 "lain.com"
376 ```
377
378 ## `GET /api/v1/pleroma/admin/statuses`
379
380 ### Retrives all latest statuses
381
382 - Params:
383 - *optional* `page_size`: number of statuses to return (default is `20`)
384 - *optional* `local_only`: excludes remote statuses
385 - *optional* `godmode`: `true`/`false` – allows to see private statuses
386 - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
387 - Response:
388 - On failure: `Not found`
389 - On success: JSON array of user's latest statuses
390
391 ## `GET /api/v1/pleroma/admin/relay`
392
393 ### List Relays
394
395 Params: none
396 Response:
397
398 * On success: JSON array of relays
399
400 ```json
401 [
402 {"actor": "https://example.com/relay", "followed_back": true},
403 {"actor": "https://example2.com/relay", "followed_back": false}
404 ]
405 ```
406
407 ## `POST /api/v1/pleroma/admin/relay`
408
409 ### Follow a Relay
410
411 Params:
412
413 * `relay_url`
414
415 Response:
416
417 * On success: relay json object
418
419 ```json
420 {"actor": "https://example.com/relay", "followed_back": true}
421 ```
422
423 ## `DELETE /api/v1/pleroma/admin/relay`
424
425 ### Unfollow a Relay
426
427 - Params:
428 - `relay_url`
429 - *optional* `force`: forcefully unfollow a relay even when the relay is not available. (default is `false`)
430
431 Response:
432
433 * On success: URL of the unfollowed relay
434
435 ```json
436 {"https://example.com/relay"}
437 ```
438
439 ## `POST /api/v1/pleroma/admin/users/invite_token`
440
441 ### Create an account registration invite token
442
443 - Params:
444 - *optional* `max_use` (integer)
445 - *optional* `expires_at` (date string e.g. "2019-04-07")
446 - Response:
447
448 ```json
449 {
450 "id": integer,
451 "token": string,
452 "used": boolean,
453 "expires_at": date,
454 "uses": integer,
455 "max_use": integer,
456 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
457 }
458 ```
459
460 ## `GET /api/v1/pleroma/admin/users/invites`
461
462 ### Get a list of generated invites
463
464 - Params: none
465 - Response:
466
467 ```json
468 {
469
470 "invites": [
471 {
472 "id": integer,
473 "token": string,
474 "used": boolean,
475 "expires_at": date,
476 "uses": integer,
477 "max_use": integer,
478 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
479 },
480 ...
481 ]
482 }
483 ```
484
485 ## `POST /api/v1/pleroma/admin/users/revoke_invite`
486
487 ### Revoke invite by token
488
489 - Params:
490 - `token`
491 - Response:
492
493 ```json
494 {
495 "id": integer,
496 "token": string,
497 "used": boolean,
498 "expires_at": date,
499 "uses": integer,
500 "max_use": integer,
501 "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
502
503 }
504 ```
505
506 ## `POST /api/v1/pleroma/admin/users/email_invite`
507
508 ### Sends registration invite via email
509
510 - Params:
511 - `email`
512 - `name`, optional
513
514 - Response:
515 - On success: `204`, empty response
516 - On failure:
517 - 400 Bad Request, JSON:
518
519 ```json
520 [
521 {
522 "error": "Appropriate error message here"
523 }
524 ]
525 ```
526
527 ## `GET /api/v1/pleroma/admin/users/:nickname/password_reset`
528
529 ### Get a password reset token for a given nickname
530
531
532 - Params: none
533 - Response:
534
535 ```json
536 {
537 "token": "base64 reset token",
538 "link": "https://pleroma.social/api/v1/pleroma/password_reset/url-encoded-base64-token"
539 }
540 ```
541
542 ## `PATCH /api/v1/pleroma/admin/users/force_password_reset`
543
544 ### Force passord reset for a user with a given nickname
545
546 - Params:
547 - `nicknames`
548 - Response: none (code `204`)
549
550 ## PUT `/api/v1/pleroma/admin/users/disable_mfa`
551
552 ### Disable mfa for user's account.
553
554 - Params:
555 - `nickname`
556 - Response: User’s nickname
557
558 ## `GET /api/v1/pleroma/admin/users/:nickname/credentials`
559
560 ### Get the user's email, password, display and settings-related fields
561
562 - Params:
563 - `nickname`
564
565 - Response:
566
567 ```json
568 {
569 "actor_type": "Person",
570 "allow_following_move": true,
571 "avatar": "https://pleroma.social/media/7e8e7508fd545ef580549b6881d80ec0ff2c81ed9ad37b9bdbbdf0e0d030159d.jpg",
572 "background": "https://pleroma.social/media/4de34c0bd10970d02cbdef8972bef0ebbf55f43cadc449554d4396156162fe9a.jpg",
573 "banner": "https://pleroma.social/media/8d92ba2bd244b613520abf557dd448adcd30f5587022813ee9dd068945986946.jpg",
574 "bio": "bio",
575 "default_scope": "public",
576 "discoverable": false,
577 "email": "user@example.com",
578 "fields": [
579 {
580 "name": "example",
581 "value": "<a href=\"https://example.com\" rel=\"ugc\">https://example.com</a>"
582 }
583 ],
584 "hide_favorites": false,
585 "hide_followers": false,
586 "hide_followers_count": false,
587 "hide_follows": false,
588 "hide_follows_count": false,
589 "id": "9oouHaEEUR54hls968",
590 "locked": true,
591 "name": "user",
592 "no_rich_text": true,
593 "pleroma_settings_store": {},
594 "raw_fields": [
595 {
596 "id": 1,
597 "name": "example",
598 "value": "https://example.com"
599 },
600 ],
601 "show_role": true,
602 "skip_thread_containment": false
603 }
604 ```
605
606 ## `PATCH /api/v1/pleroma/admin/users/:nickname/credentials`
607
608 ### Change the user's email, password, display and settings-related fields
609
610 * Params:
611 * `email`
612 * `password`
613 * `name`
614 * `bio`
615 * `avatar`
616 * `locked`
617 * `no_rich_text`
618 * `default_scope`
619 * `banner`
620 * `hide_follows`
621 * `hide_followers`
622 * `hide_followers_count`
623 * `hide_follows_count`
624 * `hide_favorites`
625 * `allow_following_move`
626 * `background`
627 * `show_role`
628 * `skip_thread_containment`
629 * `fields`
630 * `is_discoverable`
631 * `actor_type`
632
633 * Responses:
634
635 Status: 200
636
637 ```json
638 {"status": "success"}
639 ```
640
641 Status: 400
642
643 ```json
644 {"errors":
645 {"actor_type": "is invalid"},
646 {"email": "has invalid format"},
647 ...
648 }
649 ```
650
651 Status: 404
652
653 ```json
654 {"error": "Not found"}
655 ```
656
657 ## `GET /api/v1/pleroma/admin/reports`
658
659 ### Get a list of reports
660
661 - Params:
662 - *optional* `state`: **string** the state of reports. Valid values are `open`, `closed` and `resolved`
663 - *optional* `limit`: **integer** the number of records to retrieve
664 - *optional* `page`: **integer** page number
665 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
666 - Response:
667 - On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin
668 - On success: JSON, returns a list of reports, where:
669 - `account`: the user who has been reported
670 - `actor`: the user who has sent the report
671 - `statuses`: list of statuses that have been included to the report
672
673 ```json
674 {
675 "total" : 1,
676 "reports": [
677 {
678 "account": {
679 "acct": "user",
680 "avatar": "https://pleroma.example.org/images/avi.png",
681 "avatar_static": "https://pleroma.example.org/images/avi.png",
682 "bot": false,
683 "created_at": "2019-04-23T17:32:04.000Z",
684 "display_name": "User",
685 "emojis": [],
686 "fields": [],
687 "followers_count": 1,
688 "following_count": 1,
689 "header": "https://pleroma.example.org/images/banner.png",
690 "header_static": "https://pleroma.example.org/images/banner.png",
691 "id": "9i6dAJqSGSKMzLG2Lo",
692 "locked": false,
693 "note": "",
694 "pleroma": {
695 "confirmation_pending": false,
696 "hide_favorites": true,
697 "hide_followers": false,
698 "hide_follows": false,
699 "is_admin": false,
700 "is_moderator": false,
701 "relationship": {},
702 "tags": []
703 },
704 "source": {
705 "note": "",
706 "pleroma": {},
707 "sensitive": false
708 },
709 "tags": ["force_unlisted"],
710 "statuses_count": 3,
711 "url": "https://pleroma.example.org/users/user",
712 "username": "user"
713 },
714 "actor": {
715 "acct": "lain",
716 "avatar": "https://pleroma.example.org/images/avi.png",
717 "avatar_static": "https://pleroma.example.org/images/avi.png",
718 "bot": false,
719 "created_at": "2019-03-28T17:36:03.000Z",
720 "display_name": "Roger Braun",
721 "emojis": [],
722 "fields": [],
723 "followers_count": 1,
724 "following_count": 1,
725 "header": "https://pleroma.example.org/images/banner.png",
726 "header_static": "https://pleroma.example.org/images/banner.png",
727 "id": "9hEkA5JsvAdlSrocam",
728 "locked": false,
729 "note": "",
730 "pleroma": {
731 "confirmation_pending": false,
732 "hide_favorites": false,
733 "hide_followers": false,
734 "hide_follows": false,
735 "is_admin": false,
736 "is_moderator": false,
737 "relationship": {},
738 "tags": []
739 },
740 "source": {
741 "note": "",
742 "pleroma": {},
743 "sensitive": false
744 },
745 "tags": ["force_unlisted"],
746 "statuses_count": 1,
747 "url": "https://pleroma.example.org/users/lain",
748 "username": "lain"
749 },
750 "content": "Please delete it",
751 "created_at": "2019-04-29T19:48:15.000Z",
752 "id": "9iJGOv1j8hxuw19bcm",
753 "state": "open",
754 "statuses": [
755 {
756 "account": { ... },
757 "application": {
758 "name": "Web",
759 "website": null
760 },
761 "bookmarked": false,
762 "card": null,
763 "content": "<span class=\"h-card\"><a data-user=\"9hEkA5JsvAdlSrocam\" class=\"u-url mention\" href=\"https://pleroma.example.org/users/lain\">@<span>lain</span></a></span> click on my link <a href=\"https://www.google.com/\">https://www.google.com/</a>",
764 "created_at": "2019-04-23T19:15:47.000Z",
765 "emojis": [],
766 "favourited": false,
767 "favourites_count": 0,
768 "id": "9i6mQ9uVrrOmOime8m",
769 "in_reply_to_account_id": null,
770 "in_reply_to_id": null,
771 "language": null,
772 "media_attachments": [],
773 "mentions": [
774 {
775 "acct": "lain",
776 "id": "9hEkA5JsvAdlSrocam",
777 "url": "https://pleroma.example.org/users/lain",
778 "username": "lain"
779 },
780 {
781 "acct": "user",
782 "id": "9i6dAJqSGSKMzLG2Lo",
783 "url": "https://pleroma.example.org/users/user",
784 "username": "user"
785 }
786 ],
787 "muted": false,
788 "pinned": false,
789 "pleroma": {
790 "content": {
791 "text/plain": "@lain click on my link https://www.google.com/"
792 },
793 "conversation_id": 28,
794 "in_reply_to_account_acct": null,
795 "local": true,
796 "spoiler_text": {
797 "text/plain": ""
798 }
799 },
800 "reblog": null,
801 "reblogged": false,
802 "reblogs_count": 0,
803 "replies_count": 0,
804 "sensitive": false,
805 "spoiler_text": "",
806 "tags": [],
807 "uri": "https://pleroma.example.org/objects/8717b90f-8e09-4b58-97b0-e3305472b396",
808 "url": "https://pleroma.example.org/notice/9i6mQ9uVrrOmOime8m",
809 "visibility": "direct"
810 }
811 ]
812 }
813 ]
814 }
815 ```
816
817 ## `GET /api/v1/pleroma/admin/grouped_reports`
818
819 ### Get a list of reports, grouped by status
820
821 - Params: none
822 - On success: JSON, returns a list of reports, where:
823 - `date`: date of the latest report
824 - `account`: the user who has been reported (see `/api/v1/pleroma/admin/reports` for reference)
825 - `status`: reported status (see `/api/v1/pleroma/admin/reports` for reference)
826 - `actors`: users who had reported this status (see `/api/v1/pleroma/admin/reports` for reference)
827 - `reports`: reports (see `/api/v1/pleroma/admin/reports` for reference)
828
829 ```json
830 "reports": [
831 {
832 "date": "2019-10-07T12:31:39.615149Z",
833 "account": { ... },
834 "status": { ... },
835 "actors": [{ ... }, { ... }],
836 "reports": [{ ... }]
837 }
838 ]
839 ```
840
841 ## `GET /api/v1/pleroma/admin/reports/:id`
842
843 ### Get an individual report
844
845 - Params:
846 - `id`
847 - Response:
848 - On failure:
849 - 403 Forbidden `{"error": "error_msg"}`
850 - 404 Not Found `"Not found"`
851 - On success: JSON, Report object (see above)
852
853 ## `PATCH /api/v1/pleroma/admin/reports`
854
855 ### Change the state of one or multiple reports
856
857 - Params:
858
859 ```json
860 `reports`: [
861 {
862 `id`, // required, report id
863 `state` // required, the new state. Valid values are `open`, `closed` and `resolved`
864 },
865 ...
866 ]
867 ```
868
869 - Response:
870 - On failure:
871 - 400 Bad Request, JSON:
872
873 ```json
874 [
875 {
876 `id`, // report id
877 `error` // error message
878 }
879 ]
880 ```
881
882 - On success: `204`, empty response
883
884 ## `POST /api/v1/pleroma/admin/reports/:id/notes`
885
886 ### Create report note
887
888 - Params:
889 - `id`: required, report id
890 - `content`: required, the message
891 - Response:
892 - On failure:
893 - 400 Bad Request `"Invalid parameters"` when `status` is missing
894 - On success: `204`, empty response
895
896 ## `DELETE /api/v1/pleroma/admin/reports/:report_id/notes/:id`
897
898 ### Delete report note
899
900 - Params:
901 - `report_id`: required, report id
902 - `id`: required, note id
903 - Response:
904 - On failure:
905 - 400 Bad Request `"Invalid parameters"` when `status` is missing
906 - On success: `204`, empty response
907
908 ## `GET /api/v1/pleroma/admin/statuses/:id`
909
910 ### Show status by id
911
912 - Params:
913 - `id`: required, status id
914 - Response:
915 - On failure:
916 - 404 Not Found `"Not Found"`
917 - On success: JSON, Mastodon Status entity
918
919 ## `PUT /api/v1/pleroma/admin/statuses/:id`
920
921 ### Change the scope of an individual reported status
922
923 - Params:
924 - `id`
925 - `sensitive`: optional, valid values are `true` or `false`
926 - `visibility`: optional, valid values are `public`, `private` and `unlisted`
927 - Response:
928 - On failure:
929 - 400 Bad Request `"Unsupported visibility"`
930 - 403 Forbidden `{"error": "error_msg"}`
931 - 404 Not Found `"Not found"`
932 - On success: JSON, Mastodon Status entity
933
934 ## `DELETE /api/v1/pleroma/admin/statuses/:id`
935
936 ### Delete an individual reported status
937
938 - Params:
939 - `id`
940 - Response:
941 - On failure:
942 - 403 Forbidden `{"error": "error_msg"}`
943 - 404 Not Found `"Not found"`
944 - On success: 200 OK `{}`
945
946 ## `GET /api/v1/pleroma/admin/restart`
947
948 ### Restarts pleroma application
949
950 **Only works when configuration from database is enabled.**
951
952 - Params: none
953 - Response:
954 - On failure:
955 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
956
957 ```json
958 {}
959 ```
960
961 ## `GET /api/v1/pleroma/admin/need_reboot`
962
963 ### Returns the flag whether the pleroma should be restarted
964
965 - Params: none
966 - Response:
967 - `need_reboot` - boolean
968 ```json
969 {
970 "need_reboot": false
971 }
972 ```
973
974 ## `GET /api/v1/pleroma/admin/config`
975
976 ### Get list of merged default settings with saved in database.
977
978 *If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
979
980 **Only works when configuration from database is enabled.**
981
982 - Params:
983 - `only_db`: true (*optional*, get only saved in database settings)
984 - Response:
985 - On failure:
986 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
987
988 ```json
989 {
990 "configs": [
991 {
992 "group": ":pleroma",
993 "key": "Pleroma.Upload",
994 "value": []
995 }
996 ],
997 "need_reboot": true
998 }
999 ```
1000
1001 ## `POST /api/v1/pleroma/admin/config`
1002
1003 ### Update config settings
1004
1005 *If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
1006
1007 **Only works when configuration from database is enabled.**
1008
1009 Some modifications are necessary to save the config settings correctly:
1010
1011 - strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules;
1012 ```
1013 "Pleroma.Upload" -> Pleroma.Upload
1014 "Oban" -> Oban
1015 ```
1016 - strings starting with `:` will be converted to atoms;
1017 ```
1018 ":pleroma" -> :pleroma
1019 ```
1020 - objects with `tuple` key and array value will be converted to tuples;
1021 ```
1022 {"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []}
1023 ```
1024 - arrays with *tuple objects* will be converted to keywords;
1025 ```
1026 [{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"]
1027 ```
1028
1029 Most of the settings will be applied in `runtime`, this means that you don't need to restart the instance. But some settings are applied in `compile time` and require a reboot of the instance, such as:
1030 - all settings inside these keys:
1031 - `:hackney_pools`
1032 - `:connections_pool`
1033 - `:pools`
1034 - partially settings inside these keys:
1035 - `:seconds_valid` in `Pleroma.Captcha`
1036 - `:proxy_remote` in `Pleroma.Upload`
1037 - `:upload_limit` in `:instance`
1038
1039 - Params:
1040 - `configs` - array of config objects
1041 - config object params:
1042 - `group` - string (**required**)
1043 - `key` - string (**required**)
1044 - `value` - string, [], {} or {"tuple": []} (**required**)
1045 - `delete` - true (*optional*, if setting must be deleted)
1046 - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored)
1047
1048 *When a value have several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.*
1049 ```
1050 [subkey: val1, subkey2: val2, subkey3: val3] \\ initial value
1051 {"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion
1052 [subkey2: val2] \\ value after deletion
1053 ```
1054
1055 *Most of the settings can be partially updated through merge old values with new values, except settings value of which is list or is not keyword.*
1056
1057 Example of setting without keyword in value:
1058 ```elixir
1059 config :tesla, :adapter, Tesla.Adapter.Hackney
1060 ```
1061
1062 List of settings which support only full update by key:
1063 ```elixir
1064 @full_key_update [
1065 {:pleroma, :ecto_repos},
1066 {:mime, :types},
1067 {:cors_plug, [:max_age, :methods, :expose, :headers]},
1068 {:auto_linker, :opts},
1069 {:swarm, :node_blacklist},
1070 {:logger, :backends}
1071 ]
1072 ```
1073
1074 List of settings which support only full update by subkey:
1075 ```elixir
1076 @full_subkey_update [
1077 {:pleroma, :assets, :mascots},
1078 {:pleroma, :emoji, :groups},
1079 {:pleroma, :workers, :retries},
1080 {:pleroma, :mrf_subchain, :match_actor},
1081 {:pleroma, :mrf_keyword, :replace}
1082 ]
1083 ```
1084
1085 - Request:
1086
1087 ```json
1088 {
1089 "configs": [
1090 {
1091 "group": ":pleroma",
1092 "key": "Pleroma.Upload",
1093 "value": [
1094 {"tuple": [":uploader", "Pleroma.Uploaders.Local"]},
1095 {"tuple": [":filters", ["Pleroma.Upload.Filter.Dedupe"]]},
1096 {"tuple": [":link_name", true]},
1097 {"tuple": [":proxy_remote", false]},
1098 {"tuple": [":proxy_opts", [
1099 {"tuple": [":redirect_on_failure", false]},
1100 {"tuple": [":max_body_length", 1048576]},
1101 {"tuple": [":http", [
1102 {"tuple": [":follow_redirect", true]},
1103 {"tuple": [":pool", ":upload"]},
1104 ]]}
1105 ]
1106 ]},
1107 {"tuple": [":dispatch", {
1108 "tuple": ["/api/v1/streaming", "Pleroma.Web.MastodonAPI.WebsocketHandler", []]
1109 }]}
1110 ]
1111 }
1112 ]
1113 }
1114 ```
1115
1116 - Response:
1117 - On failure:
1118 - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
1119 ```json
1120 {
1121 "configs": [
1122 {
1123 "group": ":pleroma",
1124 "key": "Pleroma.Upload",
1125 "value": [...]
1126 }
1127 ],
1128 "need_reboot": true
1129 }
1130 ```
1131
1132 ## ` GET /api/v1/pleroma/admin/config/descriptions`
1133
1134 ### Get JSON with config descriptions.
1135 Loads json generated from `config/descriptions.exs`.
1136
1137 - Params: none
1138 - Response:
1139
1140 ```json
1141 [{
1142 "group": ":pleroma", // string
1143 "key": "ModuleName", // string
1144 "type": "group", // string or list with possible values,
1145 "description": "Upload general settings", // string
1146 "children": [
1147 {
1148 "key": ":uploader", // string or module name `Pleroma.Upload`
1149 "type": "module",
1150 "description": "Module which will be used for uploads",
1151 "suggestions": ["module1", "module2"]
1152 },
1153 {
1154 "key": ":filters",
1155 "type": ["list", "module"],
1156 "description": "List of filter modules for uploads",
1157 "suggestions": [
1158 "module1", "module2", "module3"
1159 ]
1160 }
1161 ]
1162 }]
1163 ```
1164
1165 ## `GET /api/v1/pleroma/admin/moderation_log`
1166
1167 ### Get moderation log
1168
1169 - Params:
1170 - *optional* `page`: **integer** page number
1171 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
1172 - *optional* `start_date`: **datetime (ISO 8601)** filter logs by creation date, start from `start_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. `2005-08-09T18:31:42`
1173 - *optional* `end_date`: **datetime (ISO 8601)** filter logs by creation date, end by from `end_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. 2005-08-09T18:31:42
1174 - *optional* `user_id`: **integer** filter logs by actor's id
1175 - *optional* `search`: **string** search logs by the log message
1176 - Response:
1177
1178 ```json
1179 [
1180 {
1181 "id": 1234,
1182 "data": {
1183 "actor": {
1184 "id": 1,
1185 "nickname": "lain"
1186 },
1187 "action": "relay_follow"
1188 },
1189 "time": 1502812026, // timestamp
1190 "message": "[2017-08-15 15:47:06] @nick0 followed relay: https://example.org/relay" // log message
1191 }
1192 ]
1193 ```
1194
1195 ## `POST /api/v1/pleroma/admin/reload_emoji`
1196
1197 ### Reload the instance's custom emoji
1198
1199 - Authentication: required
1200 - Params: None
1201 - Response: JSON, "ok" and 200 status
1202
1203 ## `PATCH /api/v1/pleroma/admin/users/confirm_email`
1204
1205 ### Confirm users' emails
1206
1207 - Params:
1208 - `nicknames`
1209 - Response: Array of user nicknames
1210
1211 ## `PATCH /api/v1/pleroma/admin/users/resend_confirmation_email`
1212
1213 ### Resend confirmation email
1214
1215 - Params:
1216 - `nicknames`
1217 - Response: Array of user nicknames
1218
1219 ## `GET /api/v1/pleroma/admin/stats`
1220
1221 ### Stats
1222
1223 - Query Params:
1224 - *optional* `instance`: **string** instance hostname (without protocol) to get stats for
1225 - Example: `https://mypleroma.org/api/v1/pleroma/admin/stats?instance=lain.com`
1226
1227 - Response:
1228
1229 ```json
1230 {
1231 "status_visibility": {
1232 "direct": 739,
1233 "private": 9,
1234 "public": 17,
1235 "unlisted": 14
1236 }
1237 }
1238 ```
1239
1240 ## `GET /api/v1/pleroma/admin/oauth_app`
1241
1242 ### List OAuth app
1243
1244 - Params:
1245 - *optional* `name`
1246 - *optional* `client_id`
1247 - *optional* `page`
1248 - *optional* `page_size`
1249 - *optional* `trusted`
1250
1251 - Response:
1252
1253 ```json
1254 {
1255 "apps": [
1256 {
1257 "id": 1,
1258 "name": "App name",
1259 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1260 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1261 "redirect_uri": "https://example.com/oauth-callback",
1262 "website": "https://example.com",
1263 "trusted": true
1264 }
1265 ],
1266 "count": 17,
1267 "page_size": 50
1268 }
1269 ```
1270
1271
1272 ## `POST /api/v1/pleroma/admin/oauth_app`
1273
1274 ### Create OAuth App
1275
1276 - Params:
1277 - `name`
1278 - `redirect_uris`
1279 - `scopes`
1280 - *optional* `website`
1281 - *optional* `trusted`
1282
1283 - Response:
1284
1285 ```json
1286 {
1287 "id": 1,
1288 "name": "App name",
1289 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1290 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1291 "redirect_uri": "https://example.com/oauth-callback",
1292 "website": "https://example.com",
1293 "trusted": true
1294 }
1295 ```
1296
1297 - On failure:
1298 ```json
1299 {
1300 "redirect_uris": "can't be blank",
1301 "name": "can't be blank"
1302 }
1303 ```
1304
1305 ## `PATCH /api/v1/pleroma/admin/oauth_app/:id`
1306
1307 ### Update OAuth App
1308
1309 - Params:
1310 - *optional* `name`
1311 - *optional* `redirect_uris`
1312 - *optional* `scopes`
1313 - *optional* `website`
1314 - *optional* `trusted`
1315
1316 - Response:
1317
1318 ```json
1319 {
1320 "id": 1,
1321 "name": "App name",
1322 "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk",
1323 "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY",
1324 "redirect_uri": "https://example.com/oauth-callback",
1325 "website": "https://example.com",
1326 "trusted": true
1327 }
1328 ```
1329
1330 ## `DELETE /api/v1/pleroma/admin/oauth_app/:id`
1331
1332 ### Delete OAuth App
1333
1334 - Params: None
1335
1336 - Response:
1337 - On success: `204`, empty response
1338 - On failure:
1339 - 400 Bad Request `"Invalid parameters"` when `status` is missing
1340
1341 ## `GET /api/v1/pleroma/admin/media_proxy_caches`
1342
1343 ### Get a list of all banned MediaProxy URLs in Cachex
1344
1345 - Authentication: required
1346 - Params:
1347 - *optional* `page`: **integer** page number
1348 - *optional* `page_size`: **integer** number of log entries per page (default is `50`)
1349 - *optional* `query`: **string** search term
1350
1351 - Response:
1352
1353 ``` json
1354 {
1355 "page_size": integer,
1356 "count": integer,
1357 "urls": [
1358 "http://example.com/media/a688346.jpg",
1359 "http://example.com/media/fb1f4d.jpg"
1360 ]
1361 }
1362
1363 ```
1364
1365 ## `POST /api/v1/pleroma/admin/media_proxy_caches/delete`
1366
1367 ### Remove a banned MediaProxy URL from Cachex
1368
1369 - Authentication: required
1370 - Params:
1371 - `urls` (array)
1372
1373 - Response:
1374
1375 ``` json
1376 { }
1377
1378 ```
1379
1380 ## `POST /api/v1/pleroma/admin/media_proxy_caches/purge`
1381
1382 ### Purge a MediaProxy URL
1383
1384 - Authentication: required
1385 - Params:
1386 - `urls` (array)
1387 - `ban` (boolean)
1388
1389 - Response:
1390
1391 ``` json
1392 { }
1393
1394 ```
1395
1396 ## `GET /api/v1/pleroma/admin/instance_document/:document_name`
1397
1398 ### Get an instance document
1399
1400 - Authentication: required
1401
1402 - Response:
1403
1404 Returns the content of the document
1405
1406 ```html
1407 <h1>Instance panel</h1>
1408 ```
1409
1410 ## `PATCH /api/v1/pleroma/admin/instance_document/:document_name`
1411 - Params:
1412 - `file` (the file to be uploaded, using multipart form data.)
1413
1414 ### Update an instance document
1415
1416 - Authentication: required
1417
1418 - Response:
1419
1420 ``` json
1421 {
1422 "url": "https://example.com/instance/panel.html"
1423 }
1424 ```
1425
1426 ## `DELETE /api/v1/pleroma/admin/instance_document/:document_name`
1427
1428 ### Delete an instance document
1429
1430 - Response:
1431
1432 ``` json
1433 {
1434 "url": "https://example.com/instance/panel.html"
1435 }
1436 ```
1437
1438 ## `GET /api/v1/pleroma/admin/frontends
1439
1440 ### List available frontends
1441
1442 - Response:
1443
1444 ```json
1445 [
1446 {
1447 "build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
1448 "git": "https://git.pleroma.social/pleroma/fedi-fe",
1449 "installed": true,
1450 "name": "fedi-fe",
1451 "ref": "master"
1452 },
1453 {
1454 "build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build",
1455 "git": "https://git.pleroma.social/lambadalambda/kenoma",
1456 "installed": false,
1457 "name": "kenoma",
1458 "ref": "master"
1459 }
1460 ]
1461 ```
1462
1463 ## `POST /api/v1/pleroma/admin/frontends/install`
1464
1465 ### Install a frontend
1466
1467 - Params:
1468 - `name`: frontend name, required
1469 - `ref`: frontend ref
1470 - `file`: path to a frontend zip file
1471 - `build_url`: build URL
1472 - `build_dir`: build directory
1473
1474 - Response:
1475
1476 ```json
1477 [
1478 {
1479 "build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
1480 "git": "https://git.pleroma.social/pleroma/fedi-fe",
1481 "installed": true,
1482 "name": "fedi-fe",
1483 "ref": "master"
1484 },
1485 {
1486 "build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build",
1487 "git": "https://git.pleroma.social/lambadalambda/kenoma",
1488 "installed": false,
1489 "name": "kenoma",
1490 "ref": "master"
1491 }
1492 ]
1493 ```
1494
1495 ```json
1496 {
1497 "error": "Could not install frontend"
1498 }
1499 ```
1500
1501 ## `GET /api/v1/pleroma/admin/announcements`
1502
1503 ### List announcements
1504
1505 - Params: `offset`, `limit`
1506
1507 - Response: JSON, list of announcements
1508
1509 ```json
1510 [
1511 {
1512 "id": "AHDp0GBdRn1EPN5HN2",
1513 "content": "some content",
1514 "starts_at": null,
1515 "ends_at": null,
1516 "all_day": false,
1517 "published_at": "2022-03-09T02:13:05",
1518 "reactions": [],
1519 "statuses": [],
1520 "tags": [],
1521 "emojis": [],
1522 "updated_at": "2022-03-09T02:13:05"
1523 }
1524 ]
1525 ```
1526
1527 Note that this differs from the Mastodon API variant: Mastodon API only returns *active* announcements, while this returns all.
1528
1529 ## `GET /api/v1/pleroma/admin/announcements/:id`
1530
1531 ### Display one announcement
1532
1533 - Response: JSON, one announcement
1534
1535 ```json
1536 {
1537 "id": "AHDp0GBdRn1EPN5HN2",
1538 "content": "some content",
1539 "starts_at": null,
1540 "ends_at": null,
1541 "all_day": false,
1542 "published_at": "2022-03-09T02:13:05",
1543 "reactions": [],
1544 "statuses": [],
1545 "tags": [],
1546 "emojis": [],
1547 "updated_at": "2022-03-09T02:13:05"
1548 }
1549 ```
1550
1551 ## `POST /api/v1/pleroma/admin/announcements`
1552
1553 ### Create an announcement
1554
1555 - Params:
1556 - `content`: string, required, announcement content
1557 - `starts_at`: datetime, optional, default to null, the time when the announcement will become active (displayed to users); if it is null, the announcement will be active immediately
1558 - `ends_at`: datetime, optional, default to null, the time when the announcement will become inactive (no longer displayed to users); if it is null, the announcement will be active until an admin deletes it
1559 - `all_day`: boolean, optional, default to false, tells the client whether to only display dates for `starts_at` and `ends_at`
1560
1561 - Response: JSON, created announcement
1562
1563 ```json
1564 {
1565 "id": "AHDp0GBdRn1EPN5HN2",
1566 "content": "some content",
1567 "starts_at": null,
1568 "ends_at": null,
1569 "all_day": false,
1570 "published_at": "2022-03-09T02:13:05",
1571 "reactions": [],
1572 "statuses": [],
1573 "tags": [],
1574 "emojis": [],
1575 "updated_at": "2022-03-09T02:13:05"
1576 }
1577 ```
1578
1579 ## `PATCH /api/v1/pleroma/admin/announcements/:id`
1580
1581 ### Change an announcement
1582
1583 - Params: same as `POST /api/v1/pleroma/admin/announcements`, except no param is required.
1584
1585 - Updates the announcement according to params. Missing params are kept as-is.
1586
1587 - Response: JSON, updated announcement
1588
1589 ```json
1590 {
1591 "id": "AHDp0GBdRn1EPN5HN2",
1592 "content": "some content",
1593 "starts_at": null,
1594 "ends_at": null,
1595 "all_day": false,
1596 "published_at": "2022-03-09T02:13:05",
1597 "reactions": [],
1598 "statuses": [],
1599 "tags": [],
1600 "emojis": [],
1601 "updated_at": "2022-03-09T02:13:05"
1602 }
1603 ```
1604
1605 ## `DELETE /api/v1/pleroma/admin/announcements/:id`
1606
1607 ### Delete an announcement
1608
1609 - Response: JSON, empty object
1610
1611 ```json
1612 {}
1613 ```