
## Workgroup fields

`GET /v1/workgroups/fields`

Returns the workgroup field schema and the list of operations available in batch requests.

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/workgroups/fields" \
  -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/workgroups/fields', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Fields:', Object.keys(data.fields).length)
console.log('Available batch operations:', data.batch)
```

### JavaScript — OAuth application

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

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.fields` | object | Workgroup field schema object |
| `data.fields.<name>` | object | Description of a single field |
| `data.fields.<name>.type` | string | Value type: `number`, `string`, `boolean` or `datetime` |
| `data.fields.<name>.readonly` | boolean | Whether the field is writable via `POST` / `PATCH` |
| `data.batch` | array | List of entity operations available in [`POST /v1/batch`](/docs/batch): `create`, `update`, `delete` |

### Workgroup fields

| Field | Type | Read-only | Description |
|------|-----|:--:|---------|
| `id` | number | yes | Workgroup identifier |
| `name` | string | | Name |
| `description` | string | | Description |
| `active` | boolean | | Whether the group is active |
| `visible` | boolean | | Whether it is visible in shared lists |
| `opened` | boolean | | Whether it is open for joining without an invitation |
| `ownerId` | number | | Owner (responsible person). List: [`GET /v1/users`](/docs/entities/users) |
| `subjectId` | number | | Subject identifier |
| `subjectName` | string | yes | Subject name |
| `membersCount` | number | yes | Number of members |
| `dateCreate` | datetime | yes | Creation date |
| `dateUpdate` | datetime | yes | Last update date |
| `dateActivity` | datetime | yes | Last activity date |
| `archived` | boolean | | Whether it is archived |
| `isProject` | boolean | | Whether it is a project with tasks and deadlines |
| `isExtranet` | boolean | | Extranet group |
| `keywords` | string | | Keywords |
| `siteId` | string | yes | Bitrix24 account site identifier |
| `imageUrl` | string | yes | Group avatar URL |

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "ID", "description": "Workgroup identifier." },
      "name": { "type": "string", "readonly": false, "label": "Name", "description": "Workgroup name." },
      "description": { "type": "string", "readonly": false, "label": "Description", "description": "Text description of the workgroup." },
      "active": { "type": "boolean", "readonly": false, "label": "Active", "description": "Whether the group is active." },
      "visible": { "type": "boolean", "readonly": false, "label": "Visible in lists", "description": "Whether the group is shown in shared lists." },
      "opened": { "type": "boolean", "readonly": false, "label": "Open group", "description": "Whether joining the group is possible without an invitation." },
      "ownerId": { "type": "number", "readonly": false, "label": "Owner", "description": "Identifier of the user responsible for the group." },
      "subjectId": { "type": "number", "readonly": false, "label": "Subject ID", "description": "Identifier of the subject (activity area) of the workgroup." },
      "subjectName": { "type": "string", "readonly": true, "label": "Subject name", "description": "Name of the subject the workgroup belongs to." },
      "membersCount": { "type": "number", "readonly": true, "label": "Member count", "description": "Number of members in the workgroup." },
      "dateCreate": { "type": "datetime", "readonly": true, "label": "Creation date", "description": "Date and time the workgroup was created." },
      "dateUpdate": { "type": "datetime", "readonly": true, "label": "Update date", "description": "Date and time of the last update to the workgroup." },
      "dateActivity": { "type": "datetime", "readonly": true, "label": "Activity date", "description": "Date and time of the last activity in the workgroup." },
      "archived": { "type": "boolean", "readonly": false, "label": "Archived", "description": "Whether the group is archived." },
      "isProject": { "type": "boolean", "readonly": false, "label": "Project", "description": "Whether the group is a project with tasks and deadlines." },
      "isExtranet": { "type": "boolean", "readonly": false, "label": "Extranet group", "description": "Whether the group belongs to the extranet." },
      "keywords": { "type": "string", "readonly": false, "label": "Keywords", "description": "Keywords associated with the workgroup." },
      "siteId": { "type": "string", "readonly": true, "label": "Site ID", "description": "Identifier of the Bitrix24 account site the group belongs to." },
      "imageUrl": { "type": "string", "readonly": true, "label": "Avatar URL", "description": "Link to the workgroup avatar image." }
    },
    "batch": ["create", "update", "delete"]
  }
}
```

## Error response example

401 — no authorization key:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "API key is required"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not passed |
| 401 | `INVALID_API_KEY` | An invalid key was passed |
| 403 | `SCOPE_DENIED` | The API key does not have the `sonet_group` scope |

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

## Known specifics

- The field list does not depend on the key user's permissions — the full entity schema is returned.
- Besides the operations listed in `data.batch`, in [`POST /v1/batch`](/docs/batch) you can also call `get`, `list` and `fields` for workgroups.

## See also

- [List workgroups](./list.md)
- [Create a workgroup](./create.md)
- [Update a workgroup](./update.md)
- [Batch](/docs/batch)
- [Entity API](/docs/entity-api)
