2018-12-31 12:13:17 +01:00
|
|
|
|
# Admin API
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
Authentication is required and the user must be an admin.
|
|
|
|
|
|
2019-03-06 03:01:38 +01:00
|
|
|
|
## `/api/pleroma/admin/users`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
### List users
|
|
|
|
|
|
|
|
|
|
- Method `GET`
|
2019-03-06 03:01:38 +01:00
|
|
|
|
- Query Params:
|
2019-05-08 16:34:36 +02:00
|
|
|
|
- *optional* `query`: **string** search term (e.g. nickname, domain, nickname@domain)
|
2019-03-26 23:51:59 +01:00
|
|
|
|
- *optional* `filters`: **string** comma-separated string of filters:
|
|
|
|
|
- `local`: only local users
|
|
|
|
|
- `external`: only external users
|
|
|
|
|
- `active`: only active users
|
|
|
|
|
- `deactivated`: only deactivated users
|
2019-05-08 16:34:36 +02:00
|
|
|
|
- `is_admin`: users with admin role
|
|
|
|
|
- `is_moderator`: users with moderator role
|
2019-03-26 23:51:59 +01:00
|
|
|
|
- *optional* `page`: **integer** page number
|
|
|
|
|
- *optional* `page_size`: **integer** number of users per page (default is `50`)
|
2019-05-08 16:34:36 +02:00
|
|
|
|
- *optional* `tags`: **[string]** tags list
|
|
|
|
|
- *optional* `name`: **string** user display name
|
|
|
|
|
- *optional* `email`: **string** user email
|
|
|
|
|
- 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`
|
2019-03-01 15:34:14 +01:00
|
|
|
|
- Response:
|
|
|
|
|
|
|
|
|
|
```JSON
|
2019-03-02 15:32:46 +01:00
|
|
|
|
{
|
|
|
|
|
"page_size": integer,
|
|
|
|
|
"count": integer,
|
|
|
|
|
"users": [
|
2019-03-01 15:34:14 +01:00
|
|
|
|
{
|
2019-03-02 15:32:46 +01:00
|
|
|
|
"deactivated": bool,
|
|
|
|
|
"id": integer,
|
2019-03-26 23:51:59 +01:00
|
|
|
|
"nickname": string,
|
|
|
|
|
"roles": {
|
|
|
|
|
"admin": bool,
|
|
|
|
|
"moderator": bool
|
|
|
|
|
},
|
|
|
|
|
"local": bool,
|
|
|
|
|
"tags": array
|
2019-03-01 15:34:14 +01:00
|
|
|
|
},
|
|
|
|
|
...
|
2019-03-02 15:32:46 +01:00
|
|
|
|
]
|
|
|
|
|
}
|
2019-03-01 15:34:14 +01:00
|
|
|
|
```
|
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Remove a user
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method `DELETE`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- Response: User’s nickname
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Create a user
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `POST`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- `email`
|
|
|
|
|
- `password`
|
|
|
|
|
- Response: User’s nickname
|
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/follow`
|
2019-04-05 18:29:34 +02:00
|
|
|
|
### Make a user follow another user
|
|
|
|
|
|
|
|
|
|
- Methods: `POST`
|
|
|
|
|
- Params:
|
|
|
|
|
- `follower`: The nickname of the follower
|
|
|
|
|
- `followed`: The nickname of the followed
|
|
|
|
|
- Response:
|
|
|
|
|
- "ok"
|
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/unfollow`
|
2019-04-05 18:29:34 +02:00
|
|
|
|
### Make a user unfollow another user
|
|
|
|
|
|
|
|
|
|
- Methods: `POST`
|
|
|
|
|
- Params:
|
|
|
|
|
- `follower`: The nickname of the follower
|
|
|
|
|
- `followed`: The nickname of the followed
|
|
|
|
|
- Response:
|
|
|
|
|
- "ok"
|
|
|
|
|
|
2019-02-27 01:08:03 +01:00
|
|
|
|
## `/api/pleroma/admin/users/:nickname/toggle_activation`
|
|
|
|
|
|
|
|
|
|
### Toggle user activation
|
|
|
|
|
|
|
|
|
|
- Method: `PATCH`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- Response: User’s object
|
|
|
|
|
|
|
|
|
|
```JSON
|
|
|
|
|
{
|
2019-03-02 15:32:46 +01:00
|
|
|
|
"deactivated": bool,
|
|
|
|
|
"id": integer,
|
|
|
|
|
"nickname": string
|
2019-02-27 01:08:03 +01:00
|
|
|
|
}
|
|
|
|
|
```
|
2018-12-31 12:13:17 +01:00
|
|
|
|
|
|
|
|
|
## `/api/pleroma/admin/users/tag`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Tag a list of users
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `PUT`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- `tags`
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Untag a list of users
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `DELETE`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- `tags`
|
2018-12-31 12:13:17 +01:00
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/:nickname/permission_group`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Get user user permission groups membership
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `GET`
|
|
|
|
|
- Params: none
|
|
|
|
|
- Response:
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
```JSON
|
|
|
|
|
{
|
2019-03-02 15:32:46 +01:00
|
|
|
|
"is_moderator": bool,
|
|
|
|
|
"is_admin": bool
|
2018-12-31 12:13:17 +01:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
|
|
|
|
|
|
2019-03-26 23:51:59 +01:00
|
|
|
|
### Get user user permission groups membership per permission group
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `GET`
|
|
|
|
|
- Params: none
|
|
|
|
|
- Response:
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
```JSON
|
|
|
|
|
{
|
2019-03-02 15:32:46 +01:00
|
|
|
|
"is_moderator": bool,
|
|
|
|
|
"is_admin": bool
|
2018-12-31 12:13:17 +01:00
|
|
|
|
}
|
|
|
|
|
```
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Add user in permission group
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `POST`
|
|
|
|
|
- Params: none
|
|
|
|
|
- Response:
|
|
|
|
|
- On failure: `{"error": "…"}`
|
|
|
|
|
- On success: JSON of the `user.info`
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Remove user from permission group
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `DELETE`
|
|
|
|
|
- Params: none
|
|
|
|
|
- Response:
|
|
|
|
|
- On failure: `{"error": "…"}`
|
|
|
|
|
- On success: JSON of the `user.info`
|
|
|
|
|
- Note: An admin cannot revoke their own admin status.
|
2018-12-31 12:13:17 +01:00
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/:nickname/activation_status`
|
2019-02-19 16:40:57 +01:00
|
|
|
|
|
|
|
|
|
### Active or deactivate a user
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Method: `PUT`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- `status` BOOLEAN field, false value means deactivation.
|
2019-02-19 16:40:57 +01:00
|
|
|
|
|
2019-03-27 19:19:00 +01:00
|
|
|
|
## `/api/pleroma/admin/users/:nickname`
|
|
|
|
|
|
|
|
|
|
### Retrive the details of a user
|
|
|
|
|
|
|
|
|
|
- Method: `GET`
|
|
|
|
|
- Params:
|
|
|
|
|
- `nickname`
|
|
|
|
|
- Response:
|
|
|
|
|
- On failure: `Not found`
|
|
|
|
|
- On success: JSON of the user
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
## `/api/pleroma/admin/relay`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Follow a Relay
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Methods: `POST`
|
|
|
|
|
- Params:
|
|
|
|
|
- `relay_url`
|
|
|
|
|
- Response:
|
|
|
|
|
- On success: URL of the followed relay
|
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Unfollow a Relay
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Methods: `DELETE`
|
|
|
|
|
- Params:
|
|
|
|
|
- `relay_url`
|
|
|
|
|
- Response:
|
|
|
|
|
- On success: URL of the unfollowed relay
|
2018-12-31 12:13:17 +01:00
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/invite_token`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2019-04-07 14:48:52 +02:00
|
|
|
|
### Get an account registration invite token
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Methods: `GET`
|
2019-04-07 14:48:52 +02:00
|
|
|
|
- Params:
|
|
|
|
|
- *optional* `invite` => [
|
|
|
|
|
- *optional* `max_use` (integer)
|
2019-04-08 11:01:28 +02:00
|
|
|
|
- *optional* `expires_at` (date string e.g. "2019-04-07")
|
2019-04-07 14:48:52 +02:00
|
|
|
|
]
|
2019-02-27 01:08:03 +01:00
|
|
|
|
- Response: invite token (base64 string)
|
2018-12-31 12:13:17 +01:00
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/invites`
|
2019-04-07 14:48:52 +02:00
|
|
|
|
|
|
|
|
|
### Get a list of generated invites
|
|
|
|
|
|
|
|
|
|
- Methods: `GET`
|
|
|
|
|
- Params: none
|
|
|
|
|
- Response:
|
|
|
|
|
|
|
|
|
|
```JSON
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"invites": [
|
|
|
|
|
{
|
|
|
|
|
"id": integer,
|
|
|
|
|
"token": string,
|
|
|
|
|
"used": boolean,
|
2019-04-08 11:01:28 +02:00
|
|
|
|
"expires_at": date,
|
2019-04-07 14:48:52 +02:00
|
|
|
|
"uses": integer,
|
|
|
|
|
"max_use": integer,
|
|
|
|
|
"invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
|
|
|
|
|
},
|
|
|
|
|
...
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/revoke_invite`
|
2019-04-07 14:48:52 +02:00
|
|
|
|
|
|
|
|
|
### Revoke invite by token
|
|
|
|
|
|
|
|
|
|
- Methods: `POST`
|
|
|
|
|
- Params:
|
|
|
|
|
- `token`
|
|
|
|
|
- Response:
|
|
|
|
|
|
|
|
|
|
```JSON
|
|
|
|
|
{
|
|
|
|
|
"id": integer,
|
|
|
|
|
"token": string,
|
|
|
|
|
"used": boolean,
|
2019-04-08 11:01:28 +02:00
|
|
|
|
"expires_at": date,
|
2019-04-07 14:48:52 +02:00
|
|
|
|
"uses": integer,
|
|
|
|
|
"max_use": integer,
|
|
|
|
|
"invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/email_invite`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Sends registration invite via email
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Methods: `POST`
|
|
|
|
|
- Params:
|
|
|
|
|
- `email`
|
2019-04-07 14:48:52 +02:00
|
|
|
|
- `name`, optional
|
2018-12-31 12:13:17 +01:00
|
|
|
|
|
2019-05-11 10:32:04 +02:00
|
|
|
|
## `/api/pleroma/admin/users/:nickname/password_reset`
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
2018-12-31 12:13:17 +01:00
|
|
|
|
### Get a password reset token for a given nickname
|
2019-02-27 01:08:03 +01:00
|
|
|
|
|
|
|
|
|
- Methods: `GET`
|
|
|
|
|
- Params: none
|
|
|
|
|
- Response: password reset token (base64 string)
|