---
title: "Update current user's Google Groups preferences and trigger synchronization."
method: PUT
path: "/api/v1/user/me/google-groups"
---

# Update current user's Google Groups preferences and trigger synchronization.

`PUT /api/v1/user/me/google-groups`

**Authentication**: JWT token required
**Access**: Users can update their own Google Groups preferences
**Purpose**: Change opt-in preferences and sync with Google Groups service

**Request Schema**:
```json
{
  "preferences": {
    "trends_earth_users": true,
    "trendsearth": false
  }
}
```

**Request Fields**:
- `preferences`: Object containing group opt-in preferences
  - `trends_earth_users`: Boolean for general user community
  - `trendsearth`: Boolean for platform-specific group
  - Only valid group keys accepted

**Success Response Schema**:
```json
{
  "data": {
    "message": "Google Groups preferences updated successfully",
    "updated_groups": ["trends_earth_users"],
    "preferences": {
      "trends_earth_users": true,
      "trendsearth": false
    },
    "sync_results": {
      "user_email": "user@example.com",
      "trends_earth_users": {
        "action": "added",
        "success": true,
        "current_member": true
      },
      "trendsearth": {
        "action": "no_change",
        "success": true,
        "current_member": false
      }
    }
  }
}
```

**Update Process**:
1. Validates request data and group keys
2. Updates user preferences in database
3. Triggers synchronization with Google Groups service
4. Returns updated preferences and sync results
5. Handles partial sync failures gracefully

**Sync Actions**:
- `added`: User was added to the Google Group
- `removed`: User was removed from the Google Group
- `no_change`: User membership unchanged
- `verified`: Membership status confirmed

**Preference Validation**:
- Only accepts valid group keys
- Boolean values required for all preferences
- Partial updates not supported - must specify all groups

**Error Handling**:
- Preferences saved even if sync fails
- Sync errors reported in response
- User can retry sync separately
- Service availability checked before sync

**Error Responses**:
- `400 Bad Request`: Invalid preferences data or group keys
- `401 Unauthorized`: JWT token required
- `500 Internal Server Error`: Failed to update preferences or sync

## Request body

- object

## Response `200`

Success

- object

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.dev/trends/apis/trends-earth-api.md) · [All operations](https://skmtc.dev/trends/apis/trends-earth-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/trends/trends-earth-api/revisions/6bdbc0b84666/schema)
