logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

admin_api.md (40284B)


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