# List the members of a workspace

> The people of the workspace with their role, and its groups with their members: the user_id and group_id an access grant names its principal by. Pending invitations are not members yet.

Source: https://docs.stacksync.com/api-reference/workspaces/list_workspace_members

`GET https://api.stacksync.com/v1/workspaces/{workspace_id}/members`

- Operation: `list_workspace_members`
- Resource: Workspaces
- Access: read-only

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `users` | array of object (WorkspaceMember) | Yes |  |
| `users[].user_id` | integer | Yes |  |
| `users[].email` | string | Yes |  |
| `users[].firstname` | string \| null | Yes |  |
| `users[].lastname` | string \| null | Yes |  |
| `users[].role` | string (viewer \| editor \| owner) | Yes | The person's role in the workspace: viewer, editor or owner |
| `groups` | array of object (WorkspaceGroup) | Yes |  |
| `groups[].group_id` | string (uuid) | Yes |  |
| `groups[].name` | string | Yes |  |
| `groups[].description` | string | Yes |  |
| `groups[].member_user_ids` | array of integer | Yes |  |

## Example request

```bash
curl -X GET "https://api.stacksync.com/v1/workspaces/{workspace_id}/members" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "users": [
    {
      "user_id": 0,
      "email": "<email>",
      "firstname": "<firstname>",
      "lastname": "<lastname>",
      "role": "viewer"
    }
  ],
  "groups": [
    {
      "group_id": "3f6c1d2e-8a4b-4c7d-9e21-5b6f7a8c9d01",
      "name": "<name>",
      "description": "<description>",
      "member_user_ids": [
        0
      ]
    }
  ]
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [List workspaces](https://docs.stacksync.com/api-reference/workspaces/list_workspaces)
- [Get a workspace](https://docs.stacksync.com/api-reference/workspaces/get_workspace)