logo

pleroma

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

admin_api.md (35611B)


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