> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tofrom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update workspace

> Update workspace settings and configuration

## Authentication

This endpoint requires user authentication. You must be a member of the workspace to update it.

## Path Parameters

<ParamField path="workspaceId" type="string" required>
  The unique identifier of the workspace to update
</ParamField>

## Request Body

<ParamField body="name" type="string" required>
  The new name for the workspace
</ParamField>

## Response

<ResponseField name="ok" type="boolean">
  Indicates whether the update was successful
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "ok": true
  }
  ```
</ResponseExample>

## Error Responses

<ResponseField name="error" type="string">
  The error code indicating what went wrong
</ResponseField>

<ResponseField name="detail" type="string">
  Additional details about the error
</ResponseField>

### Error Codes

* `invalid_name` (400) - The provided name is invalid or empty
* `update_failed` (500) - Failed to update the workspace

<RequestExample>
  ```bash theme={null}
  curl -X PATCH https://api.example.com/api/ui/workspaces/workspace_123 \
    -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Production Workspace"
    }'
  ```

  ```javascript theme={null}
  const response = await fetch('https://api.example.com/api/ui/workspaces/workspace_123', {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer YOUR_SESSION_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Production Workspace'
    })
  });

  const data = await response.json();
  ```

  ```python theme={null}
  import requests

  response = requests.patch(
      'https://api.example.com/api/ui/workspaces/workspace_123',
      headers={
          'Authorization': 'Bearer YOUR_SESSION_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Production Workspace'
      }
  )

  data = response.json()
  ```
</RequestExample>
