# put\_\_workspace\_{workspaceId}

`PUT /workspace/{id}`

*Update Workspace*

Update an existing workspace's configuration. The user must have ADMIN access to the workspace to perform updates.

#### TypeScript Client Library

```typescript
public updateWorkspace = async (id: string, request: WorkspaceTypes.UpdateWorkspaceRequest): Promise<WorkspaceTypes.UpdateWorkspaceResponse> => {
  return this.makeRequest<WorkspaceTypes.UpdateWorkspaceResponse>(`workspace/${id}`, 'PUT', request);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X PUT https://backend.flashback.tech/workspace/123e4567-e89b-12d3-a456-426614174000 \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}' \
  -d '{
    "name": "Updated Development Workspace"
  }'
```

{% endtab %}

{% tab title="HTTP" %}

```http
PUT https://backend.flashback.tech/workspace/123e4567-e89b-12d3-a456-426614174000 HTTP/1.1
Host: backend.flashback.tech
Content-Type: application/json
Accept: application/json
Authorization: Bearer {access-token}

{
  "name": "Updated Development Workspace"
}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const workspaceId = '123e4567-e89b-12d3-a456-426614174000';
const inputBody = '{
  "name": "Updated Development Workspace"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch(`https://backend.flashback.tech/workspace/${workspaceId}`,
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

workspace_id = '123e4567-e89b-12d3-a456-426614174000'
headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

data = {
  'name' => 'Updated Development Workspace'
}

result = RestClient.put "https://backend.flashback.tech/workspace/#{workspace_id}",
  data.to_json, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

workspace_id = '123e4567-e89b-12d3-a456-426614174000'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

data = {
  'name': 'Updated Development Workspace'
}

r = requests.put(f'https://backend.flashback.tech/workspace/{workspace_id}', 
                 headers=headers, 
                 json=data)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$workspace_id = '123e4567-e89b-12d3-a456-426614174000';
$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array(
    'name' => 'Updated Development Workspace'
);

try {
    $response = $client->request('PUT',"https://backend.flashback.tech/workspace/{$workspace_id}", array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
```

{% endtab %}

{% tab title="Java" %}

```java
String workspaceId = "123e4567-e89b-12d3-a456-426614174000";
URL obj = new URL("https://backend.flashback.tech/workspace/" + workspaceId);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");

String jsonInputString = "{\"name\": \"Updated Development Workspace\"}";
con.setDoOutput(true);
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonInputString.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
       "encoding/json"
       "fmt"
)

func main() {
    workspaceId := "123e4567-e89b-12d3-a456-426614174000"
    data := map[string]string{
        "name": "Updated Development Workspace",
    }
    
    jsonData, _ := json.Marshal(data)
    
    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    req, err := http.NewRequest("PUT", fmt.Sprintf("https://backend.flashback.tech/workspace/%s", workspaceId), bytes.NewBuffer(jsonData))
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Body parameter

```json
{
  "name": "Updated Development Workspace"
}
```

#### Parameters <a href="#put__workspace_workspaceid-parameters" id="put__workspace_workspaceid-parameters"></a>

| Name | In   | Type   | Required | Description                            |
| ---- | ---- | ------ | -------- | -------------------------------------- |
| id   | path | string | true     | The unique identifier of the workspace |
| body | body | object | true     | Workspace update data                  |

#### Path Parameters <a href="#put__workspace_workspaceid-path-parameters" id="put__workspace_workspaceid-path-parameters"></a>

| Name | Type   | Required | Restrictions | Description                            |
| ---- | ------ | -------- | ------------ | -------------------------------------- |
| id   | string | true     | none         | The unique identifier of the workspace |

#### Request Body Schema <a href="#put__workspace_workspaceid-request-body-schema" id="put__workspace_workspaceid-request-body-schema"></a>

| Name   | Type   | Required | Restrictions | Description                    |
| ------ | ------ | -------- | ------------ | ------------------------------ |
| » name | string | false    | none         | The new name for the workspace |

> Example responses

> 200 Response

```json
{
  "success": true,
  "workspace": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Updated Development Workspace",
    "orgId": "987fcdeb-51a2-43d1-9f12-345678901234"
  }
}
```

> 400 Response

```json
{
  "success": false,
  "message": "User not found or account is not validated"
}
```

> 403 Response

```json
{
  "success": false,
  "message": "Insufficient permissions to update workspace"
}
```

> 404 Response

```json
{
  "success": false,
  "message": "Workspace not found"
}
```

> 500 Response

```json
{
  "success": false,
  "message": "Failed to update workspace"
}
```

#### Responses <a href="#put__workspace_workspaceid-responses" id="put__workspace_workspaceid-responses"></a>

| Status | Meaning                                                                    | Description                     | Schema |
| ------ | -------------------------------------------------------------------------- | ------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Workspace updated successfully  | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)           | User not found or not validated | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)             | Insufficient permissions        | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)             | Workspace not found             | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Server error                    | Inline |

#### Response Schema <a href="#put__workspace_workspaceid-responseschema" id="put__workspace_workspaceid-responseschema"></a>

Status Code **200**

| Name        | Type    | Required | Restrictions | Description                 |
| ----------- | ------- | -------- | ------------ | --------------------------- |
| » success   | boolean | true     | none         | Operation success status    |
| » workspace | object  | true     | none         | Updated workspace details   |
| »» id       | string  | true     | none         | Unique workspace identifier |
| »» name     | string  | true     | none         | Updated workspace name      |
| »» orgId    | string  | true     | none         | Organization identifier     |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | true     | none         | Operation success status |
| » message | string  | true     | none         | Error message            |

Status Code **403**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | true     | none         | Operation success status |
| » message | string  | true     | none         | Error message            |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | true     | none         | Operation success status |
| » message | string  | true     | none         | Error message            |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description              |
| --------- | ------- | -------- | ------------ | ------------------------ |
| » success | boolean | true     | none         | Operation success status |
| » message | string  | true     | none         | Error message            |

## Notes

* **Authentication Required**: User must be authenticated with a valid Bearer token
* **Permissions**: User must have ADMIN access to the workspace to perform updates
* **Account Validation**: User account must be validated to update workspaces
* **Workspace Naming**: If updating the name, it must be unique within the organization
* **Organization Scoped**: Workspaces are scoped to the user's organization
* **Partial Updates**: Only the fields provided in the request body will be updated


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/workspace/put__workspace_-workspaceid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
