> For the complete documentation index, see [llms.txt](https://docs.flashback.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flashback.tech/support-reference/platform-api-reference/workspace/delete__workspace_-workspaceid.md). Agents can also search and read this documentation through its [MCP server](https://docs.flashback.tech/~gitbook/mcp).

# delete\_\_workspace\_{workspaceId}

`DELETE /workspace/{id}`

*Delete Workspace*

Delete a workspace (soft delete). The user must have ADMIN access to the workspace to perform deletion. Workspaces with existing buckets or repositories cannot be deleted.

#### TypeScript Client Library

```typescript
public deleteWorkspace = async (id: string): Promise<WorkspaceTypes.DeleteWorkspaceResponse> => {
  return this.makeRequest<WorkspaceTypes.DeleteWorkspaceResponse>(`workspace/${id}`, 'DELETE', null);
};
```

#### Code Samples

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

```shell
# You can also use wget
curl -X DELETE https://backend.flashback.tech/workspace/123e4567-e89b-12d3-a456-426614174000 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const workspaceId = '123e4567-e89b-12d3-a456-426614174000';
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

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

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'

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

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

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

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

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

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

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

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE',"https://backend.flashback.tech/workspace/{$workspace_id}", array(
        'headers' => $headers,
       )
    );
    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("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");

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 (
       "net/http"
       "fmt"
)

func main() {
    workspaceId := "123e4567-e89b-12d3-a456-426614174000"
    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

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

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

{% endtab %}
{% endtabs %}

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

| Name | In   | Type   | Required | Description                            |
| ---- | ---- | ------ | -------- | -------------------------------------- |
| id   | path | string | true     | The unique identifier of the workspace |

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

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

> Example responses

> 200 Response

```json
{
  "success": true
}
```

> 400 Response

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

> 400 Response

```json
{
  "success": false,
  "message": "Cannot delete workspace with existing buckets or repos"
}
```

> 403 Response

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

> 404 Response

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

> 500 Response

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

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

| Status | Meaning                                                                    | Description                                               | Schema |
| ------ | -------------------------------------------------------------------------- | --------------------------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Workspace deleted successfully                            | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)           | User not found, not validated, or workspace has resources | 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="#delete__workspace_workspaceid-responseschema" id="delete__workspace_workspaceid-responseschema"></a>

Status Code **200**

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

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 deletion
* **Account Validation**: User account must be validated to delete workspaces
* **Resource Check**: Workspaces with existing buckets or repositories cannot be deleted
* **Soft Delete**: The workspace is marked as deleted but not permanently removed from the database
* **User Cleanup**: All workspace users are removed when the workspace is deleted
* **Organization Scoped**: Workspaces are scoped to the user's organization
* **Reversible**: Soft deletion allows for potential recovery if needed


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
