# Update a workspace

`PATCH https://api.vidmoat.com/v1/workspaces/{id}`

- Scope: `projects.write`
- Cost: Free

Rename, recolour, change the icon or reorder a workspace.

### Path parameters

- `id` (string, required): The workspace id.

### Body

- `name` (string, optional): Up to 48 characters.
- `color` (string or null, optional): A palette colour, or `null` to clear it. An unknown colour also clears it.
- `icon` (string or null, optional): One emoji, or `null` to clear it.
- `position` (integer, optional): Sort position, 0 to 999.

## Response

Returns `200`.

### Response fields

- `id` (string): The workspace id.
- `name` (string): Its name.
- `color` (string or null): A hex colour, or `null` when none is set.
- `icon` (string or null): An emoji, or `null`.
- `teamId` (string or null): The team it belongs to, or `null` for a personal workspace.
- `projectCount` (integer): Projects filed in it (0 for a new one).

## Errors

Besides the errors any request can get ([authentication](https://developer.vidmoat.com/developer/docs/authentication#when-a-request-is-refused), [rate limits](https://developer.vidmoat.com/developer/docs/rate-limits)):

| Status | Code | When |
| --- | --- | --- |
| 404 | [`not_found`](https://developer.vidmoat.com/developer/docs/errors#not_found) | No such workspace. |
| 400 | [`invalid_request`](https://developer.vidmoat.com/developer/docs/errors#invalid_request) | Nothing to change, or an empty name. |

## Request examples

```bash curl
curl -X PATCH https://api.vidmoat.com/v1/workspaces/$ID \
  -H "Authorization: Bearer $VIDMOAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Acme Q4"}'
```

```js Node
const ID = 'YOUR_PROJECT_ID';

const res = await fetch(`https://api.vidmoat.com/v1/workspaces/${ID}`, {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.VIDMOAT_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Acme Q4',
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? `HTTP ${res.status}`);
console.log(data);
```

```python Python
import os
import requests

ID = "YOUR_PROJECT_ID"

res = requests.patch(
    f"https://api.vidmoat.com/v1/workspaces/{ID}",
    headers={"Authorization": f"Bearer {os.environ['VIDMOAT_KEY']}"},
    json={
      "name": "Acme Q4",
    },
    timeout=60,
)
res.raise_for_status()
print(res.json())
```

## Example response

```json
{ "id": "ws_1", "name": "Acme Q4", "color": "#5AA9FF", "icon": "🎬", "teamId": null, "projectCount": 4 }
```

---

Source: https://developer.vidmoat.com/developer/docs/api/workspaces/update-workspace
Previous: [Create a workspace](https://developer.vidmoat.com/developer/docs/api/workspaces/create-workspace.md)
Next: [Delete a workspace](https://developer.vidmoat.com/developer/docs/api/workspaces/delete-workspace.md)
All documentation: https://developer.vidmoat.com/llms-full.txt
