Admin API: Members
Operations to list the members of a space, change their roles, and remove them. Common rules (authentication, error format, dates and times) are in the Admin API reference.
In the examples, replace <hostname> with the hostname of your environment and <access token> with an access token that starts with hako_pat_. Replace other values in angle brackets, such as <slug>, with the values described in each operation’s parameter table.
| Operation | Method and path |
|---|---|
| List members | GET /admin/api/spaces/{slug}/members |
| Leave a space yourself | DELETE /admin/api/spaces/{slug}/members/me |
| Change a member’s role | PATCH /admin/api/spaces/{slug}/members/{user_id} |
| Remove a member | DELETE /admin/api/spaces/{slug}/members/{user_id} |
List members
Section titled “List members”GET /admin/api/spaces/{slug}/members- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space |
Responses:
| Status | Body | Reason |
|---|---|---|
200 |
Array of MemberView (application/json) |
|
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/members" \ -H "Authorization: Bearer <access token>"Leave a space yourself
Section titled “Leave a space yourself”members.manage is not required.
DELETE /admin/api/spaces/{slug}/members/me- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space |
Responses:
| Status | Body | Reason |
|---|---|---|
204 |
None | |
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
409 |
Error (application/json) |
Would remove or change the last owner of the space, or make them leave |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl -X DELETE "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/members/me" \ -H "Authorization: Bearer <access token>"Change a member’s role
Section titled “Change a member’s role”PATCH /admin/api/spaces/{slug}/members/{user_id}- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space | |
user_id |
path | string | Yes | User ID |
Request body (application/json):
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
roleId |
string | Yes | ID of the new role (see roles list) |
Responses:
| Status | Body | Reason |
|---|---|---|
200 |
MemberView (application/json) |
|
400 |
Error (application/json) |
An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues |
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
409 |
Error (application/json) |
Would remove or change the last owner of the space, or make them leave |
415 |
Error (application/json) |
Content-Type: application/json is missing |
422 |
Error (application/json) |
The JSON has the wrong shape (a required key is missing, a type is wrong, or there is an unknown key) |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl -X PATCH "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/members/<user_id>" \ -H "Authorization: Bearer <access token>" \ -H "Content-Type: application/json" \ -d '{ "roleId": "<roleId>"}'Remove a member
Section titled “Remove a member”DELETE /admin/api/spaces/{slug}/members/{user_id}- Login: required (session or access token)
Parameters:
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
slug |
path | string | Yes | Slug of the space | |
user_id |
path | string | Yes | User ID |
Responses:
| Status | Body | Reason |
|---|---|---|
204 |
None | |
401 |
Error (application/json) |
Not logged in, or the access token is wrong, expired, or revoked |
403 |
Error (application/json) |
Insufficient permission (including writes with a read-only access token and writes from another origin with a session) |
404 |
Error (application/json) |
Not found. A space you are not a member of also returns 404 |
409 |
Error (application/json) |
Would remove or change the last owner of the space, or make them leave |
If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.
Example:
curl -X DELETE "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/members/<user_id>" \ -H "Authorization: Bearer <access token>"