## My workgroups

`GET /v1/me/workgroups`

Returns the workgroups and projects the key's user belongs to, together with the user's role in each one. Use it to show employees their groups or to pick a group for the next call.

## Parameters

The endpoint takes no parameters. The response is the user's full list of groups in a single call, without pagination.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/me/workgroups" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/me/workgroups" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/me/workgroups', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const body = await res.json()
const moderated = body.data.filter((group) => group.role !== 'member')
console.log(`Groups: ${body.meta.total}, with moderation rights: ${moderated.length}`)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/me/workgroups', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const body = await res.json()
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `success` | boolean | `true` on success |
| `data` | array | The user's groups. An empty array means the user belongs to no group |
| `data[].groupId` | number | Workgroup ID. Use it with [`GET /v1/workgroups/:id`](/docs/entities/workgroups/get) and [`GET /v1/workgroups/:groupId/users`](/docs/entities/workgroups/users) |
| `data[].groupName` | string | Group name |
| `data[].role` | string | The user's role in the group: `owner`, `moderator` or `member` |
| `data[].groupImageId` | number | Group image ID. `0` means the group has no image |
| `data[].groupImage` | string | Group image URL. An empty string means there is no URL. The image ID can still be non-zero in that case |
| `data[].isExtranet` | boolean | `true` for an extranet group, which can include external users |
| `meta.total` | number | Number of groups in `data` |

## Response example

```json
{
  "success": true,
  "data": [
    {
      "groupId": 5,
      "groupName": "Open group for everyone",
      "role": "owner",
      "groupImageId": 5,
      "groupImage": "https://example.bitrix24.com/b13743910/resize_cache/5/570b913f0922d8ef3131ca43a12dafee/socialnetwork/8d6/8d691e3ced2c04ece929d721067ee572/3.png",
      "isExtranet": true
    },
    {
      "groupId": 13,
      "groupName": "WORKFLOW LISTS",
      "role": "owner",
      "groupImageId": 0,
      "groupImage": "",
      "isExtranet": true
    }
  ],
  "meta": {
    "total": 2
  }
}
```

## Error response example

401 — the `X-Api-Key` header is not sent:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "API key required. Pass via X-Api-Key header."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|------|-------------|
| 400 | `UNSUPPORTED_FILTER` | The `filter` parameter was passed and strict mode is enabled on the server. Without strict mode, the filter is ignored — see "Known specifics" |
| 401 | `MISSING_API_KEY` | `X-Api-Key` is not sent |
| 401 | `INVALID_API_KEY` | The key is not recognized — no such key exists on the platform |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key lacks the `sonet_group` scope |
| 422 | `BITRIX_ERROR` | Bitrix24 refused the call and returned its own reason in `error.message` |
| 429 | `RATE_LIMITED` | Request limit exceeded. Retry after the delay in the `Retry-After` header |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a group the endpoint cannot parse: an unknown role, an invalid group ID or image ID. The list is not returned at all in that case, even if the other groups are valid |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time. The response includes a `Retry-After` header |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **Only the key user's groups.** A personal key returns its owner's groups, and an OAuth application key returns the session user's groups. This call cannot return another employee's groups.
- **Membership does not grant permission for an action.** An `owner` or `moderator` role in the response does not guarantee that the next call on the group succeeds: Bitrix24 checks permissions when the action itself runs.
- **`filter` is not applied.** By default, a request with `filter` gets the same full list with status `200` and the header `Warning: 299 - "filter is not supported on this endpoint and was ignored"`. If strict mode is enabled on the server, the same request gets `400` with code `UNSUPPORTED_FILTER` and no data. Filter the groups on your side.
- **URLs with credentials are hidden.** If a string field in the response — a group name or an image URL — contains an address with a Bitrix24 access key, the whole string is replaced with `[REDACTED]`.

## See also

- [Workgroups](/docs/entities/workgroups)
- [List workgroup members](/docs/entities/workgroups/users)
- [Workgroup members](/docs/workgroups/members)
