> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/action-center/google-workspace/update-user.md).

# Update User

Applies the same set of field changes to every Google Workspace user in the assets passed to this node. You describe the change as a JSON object in **User Fields**, using Directory API user field names.

### Before you begin

* A Google service account with domain-wide delegation enabled. Paste the content of its JSON key file into **Service Account Key**.
* The email of a Workspace admin user for the job to impersonate (**Workspace Admin Email**).
* The service account must be authorized for the OAuth scope `https://www.googleapis.com/auth/admin.directory.user` in the domain-wide delegation settings of your Google Workspace.
* Asset type: **User** (the only type this job accepts).
* Required column: `Email`. User assets whose `Email` is empty are skipped.
* Defaults: you can save the connection fields once under **Action Center** > **Settings** > **Google Workspace** (each job has its own tab). See [Action Center Settings](broken://pages/463cb9354fc80aafe89eadc3c2511cf858c22856).

### Settings

| Setting               | Type             | Required | Default | Description                                                                                                         |
| --------------------- | ---------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| Service Account Key   | Text (sensitive) | Yes      | None    | Content of the Google service account JSON key file, with domain-wide delegation enabled. Masked after saving.      |
| Workspace Admin Email | Email            | Yes      | None    | Email of the admin user to impersonate through domain-wide delegation.                                              |
| User Fields           | JSON             | Yes      | None    | User fields to update as JSON. Example: `{"name": {"givenName": "John", "familyName": "Doe"}, "suspended": false}`. |
| Request Timeout       | Number           | No       | 30      | Timeout in seconds for API requests.                                                                                |

### How it works

* Before it touches any user, the job parses **User Fields**. It must be a valid, non-empty JSON object, otherwise the job fails with an error such as `User fields must be a non-empty JSON object.`
* For each user asset the job sends one PATCH request to the Directory API users endpoint with your JSON as the body.
* For each asset the job uses the Google Directory ID (`Specifics.google-directory.id`) when the asset has one, and the `Email` value otherwise.
* If Google rejects a request (HTTP status 400 or higher) the job writes the status and response to the log and moves on to the next user. A rejected request does not fail the node. If the access token request fails (for example a wrong key or missing delegation), the job fails before it changes any user.
* The job passes on all assets it received, unchanged, through the **NEXT** edge.

This job is one of the Google Workspace jobs. To only move users between organizational units, use [Change Users OU](broken://pages/c671b586a9872d3d7840a4f15eaf9a2f88ca2253).

### Example

```
Condition: saved User query for users in the wrong department
Job: Google Workspace - Update User
User Fields: {"organizations": [{"department": "Security", "primary": true}]}
Workspace Admin Email: admin@example.com
```

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>About Action Center</strong></td><td>Workflows, triggers, conditions and job nodes.</td><td><a href="broken://pages/b6784ce27913947f154229ea6e014c1e567d94fc">Broken link</a></td></tr><tr><td><strong>Action Center Settings</strong></td><td>Save connection defaults for Google Workspace jobs.</td><td><a href="broken://pages/463cb9354fc80aafe89eadc3c2511cf858c22856">Broken link</a></td></tr><tr><td><strong>Change Users OU</strong></td><td>Move users to another organizational unit.</td><td><a href="broken://pages/c671b586a9872d3d7840a4f15eaf9a2f88ca2253">Broken link</a></td></tr></tbody></table>
