logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

Admin-API.md (3519B)


      1 # Admin API
      2 
      3 Authentication is required and the user must be an admin.
      4 
      5 ## `/api/pleroma/admin/users`
      6 
      7 ### List users
      8 
      9 - Method `GET`
     10 - Query Params:
     11   - *optional* `query`: **string** search term
     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     - `deactivated`: only deactivated users
     17   - *optional* `page`: **integer** page number
     18   - *optional* `page_size`: **integer** number of users per page (default is `50`)
     19 - Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10`
     20 - Response:
     21 
     22 ```JSON
     23 {
     24   "page_size": integer,
     25   "count": integer,
     26   "users": [
     27     {
     28       "deactivated": bool,
     29       "id": integer,
     30       "nickname": string,
     31       "roles": {
     32         "admin": bool,
     33         "moderator": bool
     34       },
     35       "local": bool,
     36       "tags": array
     37     },
     38     ...
     39   ]
     40 }
     41 ```
     42 
     43 ## `/api/pleroma/admin/user`
     44 
     45 ### Remove a user
     46 
     47 - Method `DELETE`
     48 - Params:
     49   - `nickname`
     50 - Response: User’s nickname
     51 
     52 ### Create a user
     53 
     54 - Method: `POST`
     55 - Params:
     56   - `nickname`
     57   - `email`
     58   - `password`
     59 - Response: User’s nickname
     60 
     61 ## `/api/pleroma/admin/users/:nickname/toggle_activation`
     62 
     63 ### Toggle user activation
     64 
     65 - Method: `PATCH`
     66 - Params:
     67   - `nickname`
     68 - Response: User’s object
     69 
     70 ```JSON
     71 {
     72   "deactivated": bool,
     73   "id": integer,
     74   "nickname": string
     75 }
     76 ```
     77 
     78 ## `/api/pleroma/admin/users/tag`
     79 
     80 ### Tag a list of users
     81 
     82 - Method: `PUT`
     83 - Params:
     84   - `nickname`
     85   - `tags`
     86 
     87 ### Untag a list of users
     88 
     89 - Method: `DELETE`
     90 - Params:
     91   - `nickname`
     92   - `tags`
     93 
     94 ## `/api/pleroma/admin/permission_group/:nickname`
     95 
     96 ### Get user user permission groups membership
     97 
     98 - Method: `GET`
     99 - Params: none
    100 - Response:
    101 
    102 ```JSON
    103 {
    104   "is_moderator": bool,
    105   "is_admin": bool
    106 }
    107 ```
    108 
    109 ## `/api/pleroma/admin/permission_group/:nickname/:permission_group`
    110 
    111 Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
    112 
    113 ### Get user user permission groups membership per permission group
    114 
    115 - Method: `GET`
    116 - Params: none
    117 - Response:
    118 
    119 ```JSON
    120 {
    121   "is_moderator": bool,
    122   "is_admin": bool
    123 }
    124 ```
    125 
    126 ### Add user in permission group
    127 
    128 - Method: `POST`
    129 - Params: none
    130 - Response:
    131   - On failure: `{"error": "…"}`
    132   - On success: JSON of the `user.info`
    133 
    134 ### Remove user from permission group
    135 
    136 - Method: `DELETE`
    137 - Params: none
    138 - Response:
    139   - On failure: `{"error": "…"}`
    140   - On success: JSON of the `user.info`
    141 - Note: An admin cannot revoke their own admin status.
    142 
    143 ## `/api/pleroma/admin/activation_status/:nickname`
    144 
    145 ### Active or deactivate a user
    146 
    147 - Method: `PUT`
    148 - Params:
    149   - `nickname`
    150   - `status` BOOLEAN field, false value means deactivation.
    151 
    152 ## `/api/pleroma/admin/relay`
    153 
    154 ### Follow a Relay
    155 
    156 - Methods: `POST`
    157 - Params:
    158   - `relay_url`
    159 - Response:
    160   - On success: URL of the followed relay
    161 
    162 ### Unfollow a Relay
    163 
    164 - Methods: `DELETE`
    165 - Params:
    166   - `relay_url`
    167 - Response:
    168   - On success: URL of the unfollowed relay
    169 
    170 ## `/api/pleroma/admin/invite_token`
    171 
    172 ### Get a account registeration invite token
    173 
    174 - Methods: `GET`
    175 - Params: none
    176 - Response: invite token (base64 string)
    177 
    178 ## `/api/pleroma/admin/email_invite`
    179 
    180 ### Sends registration invite via email
    181 
    182 - Methods: `POST`
    183 - Params:
    184   - `email`
    185   - `name`, optionnal
    186 
    187 ## `/api/pleroma/admin/password_reset`
    188 
    189 ### Get a password reset token for a given nickname
    190 
    191 - Methods: `GET`
    192 - Params: none
    193 - Response: password reset token (base64 string)