# Update a workspace

> **PATCH** `https://api.us.nylas.com/v3/workspaces/{workspace_id}`

Source: https://developer.nylas.com/docs/reference/api/workspaces/update-workspace/

Updates the specified workspace. You cannot change a workspace's `domain` after it's created.

On the application's default workspace, you can update only the `policy_id` and `rule_ids` values.

**Authentication:** NYLAS_API_KEY

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `workspace_id` | string | Yes | ID of the workspace to access. |

## Request body

Content-Type: application/json

- `auto_group` (boolean) - When `true`, specifies that newly created grants in the application are automatically
assigned to the workspace if their email address' domain matches the `domain`.
- `name` (string) - A short, descriptive name for the workspace.
- `policy_id` (string,null) - The ID of the [policy](/docs/v3/agent-accounts/policies-rules-lists/) to attach to the
workspace. Set a policy ID to attach the policy, set `null` to detach the current policy,
or omit the field to keep the current value. The policy must belong to your application.
- `rule_ids` (array,null) - The IDs of any [rules](/docs/v3/agent-accounts/policies-rules-lists/#rules) to attach to
the workspace. Set an array to replace the current rules, set `null` or an empty array to
detach all rules, or omit the field to keep the current value. Each rule must belong to
your application.

## Responses

### 200 - Success. Returns updated Workspace object.

- `request_id` (string) - The request ID.
- `data` (object)
  - `application_id` (string) - The ID of the application the workspace is associated with.
  - `auto_group` (boolean) - When `true`, specifies that newly created grants in the application are automatically assigned
to the workspace if their email address' domain matches the `domain`.
  - `created_at` (integer) - When the workspace was created, in seconds using the Unix timestamp format.
  - `default` (boolean) - When `true`, the workspace is the application's default workspace, which Nylas creates and
manages. Nylas includes this field when you retrieve workspaces. For more information, see
the [Workspaces overview](/docs/reference/api/workspaces/).
  - `domain` (string) - The top-level domain associated with the workspace.
  - `name` (string) - The name of the workspace.
  - `policy_id` (string) - The ID of the [policy](/docs/v3/agent-accounts/policies-rules-lists/) attached to the workspace.
The policy applies to Agent Accounts in the workspace.
  - `rule_ids` (array) - The IDs of any [rules](/docs/v3/agent-accounts/policies-rules-lists/#rules) attached to the
workspace. The rules apply to Agent Accounts in the workspace.
  - `updated_at` (integer) - When the workspace was last updated, in seconds using the Unix timestamp format. Initially, this
value is the same as `created_at`.
  - `workspace_id` (string) - The workspace ID.

### 400 - Error: Bad request. For example, the request tried to change the workspace's `domain`, modify a
value other than `policy_id` or `rule_ids` on the application's default workspace, or set a
`policy_id` or `rule_ids` value that doesn't belong to the application.

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

### 401 - Error: Not authenticated

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

### 404 - Error: Not found

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

## Code samples

### cURL

```bash
curl --request PATCH \
  --url "https://api.us.nylas.com/v3/workspaces/<WORKSPACE_ID>" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "policy_id": "<POLICY_ID>",
    "rule_ids": ["<RULE_ID>"]
  }'

```
