# Sync groups

> Refresh a workspace's groups from its line.

Source: https://docs.mycrmsim.com/docs/groups/sync-groups

```http
POST https://backend.mysmsgateway.app/api/v1/ext/groups/sync
```

- Category: myCRMSIM Conversations / Group Chats
- Auth: Bearer access token
- Scope: `groups.write`

**whatsapp**: reads the groups from the connected WhatsApp line now and updates the list in this call (groups the line is no longer in are retired). **imessage**: asks the workspace's Macs to report their group chats; they answer in the background, so list again shortly after.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | body | number | yes | A workspace of the installer. Example: `7` |
| `channel` | body | enum | yes | Which line to sync. One of: `whatsapp`, `imessage`. Example: `whatsapp` |

## Request body

```json
{
  "workspace_id": 7,
  "channel": "whatsapp"
}
```

## Response 202

WhatsApp: done

```json
{
  "success": true,
  "message": "Groups synced",
  "data": {
    "channel": "whatsapp",
    "synced": 12,
    "retired": 1,
    "connections": 1,
    "errors": []
  }
}
```

## Response 202

iMessage: asked

```json
{
  "success": true,
  "message": "Asked your Mac to report its group chats",
  "data": {
    "channel": "imessage",
    "devices": 1,
    "pushed": 1
  }
}
```

## Response 400

No ready line for that channel

```json
{
  "success": false,
  "message": "No ready WhatsApp connection for this workspace"
}
```

## Response 401

Missing or invalid token

```json
{
  "success": false,
  "message": "Invalid or expired access token."
}
```

## Response 403

Missing scope

```json
{
  "success": false,
  "message": "Missing scope(s): groups.write. This integration was granted: …"
}
```

## Response 404

Workspace does not exist or is not the installer's (same response for both)

```json
{
  "success": false,
  "message": "Workspace not found or not accessible to this token"
}
```
