---
title: "Delete a workspace"
component: "savanna"
version: "main"
module: "rest-api"
html_url: "/savanna/main/rest-api/endpoints/delete-a-workspace"
---

[View as HTML](/savanna/main/rest-api/endpoints/delete-a-workspace)

# Delete a workspace

Deletes a workspace from a workgroup.

DELETE `/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}` 

## Authorizations

`x-api-key` string header required 

Authorization for TigerGraph Savanna. Send the key in the `x-api-key` request header.

[Create an API key](../create-api-key.md) 

## Path parameters

[#](#parameter-workgroup-id) `workgroupID` string path required 

Workgroup ID

[#](#parameter-workspace-id) `workspaceID` string path required 

Workspace ID

## Response

200 application/json 

[#](#response-error) `Error` boolean 

Indicates whether the request returned an error.

[#](#response-error-details) `ErrorDetails` object\[\] 

Details about each error returned by the request.

Show child attributes Hide child attributes 

`FieldName`string

Field associated with the error.

`Reason`string

Explanation of why the error occurred.

`Type`string

Category of the error.

Available options: `Internal-Error`, `Bad-Request`, `Not-Found`, `Forbidden`, `Unauthorized`, `API-Disabled`, `Quota-Exceed`, `Unknown`

[#](#response-message) `Message` string 

Human-readable summary of the request result.

[#](#response-request-id) `RequestID` string 

Unique identifier for tracing the request.

[#](#response-result) `Result` object 

Payload returned by the request.

Delete a workspace 

cURL 

cURL Python JavaScript PHP Go Java Ruby 

```bash
curl --request DELETE \
  --url 'https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}' \
  --header 'x-api-key: <your-api-key>'
```

```python
import requests

url = "https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}"
headers = {"x-api-key": "<your-api-key>"}
response = requests.delete(url, headers=headers)
print(response.json())
```

```javascript
const response = await fetch(
  "https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}",
  {
    method: "DELETE",
    headers: { "x-api-key": "<your-api-key>" },
  }
)
console.log(await response.json())
```

```php
<?php
$request = curl_init(
  "https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}"
);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($request, CURLOPT_HTTPHEADER, [
  "x-api-key: <your-api-key>"
]);
curl_exec($request);
```

```go
request, _ := http.NewRequest(
  "DELETE",
  "https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}",
  nil,
)
request.Header.Add("x-api-key", "<your-api-key>")
response, _ := http.DefaultClient.Do(request)
```

```java
HttpRequest request = HttpRequest.newBuilder()
  .uri(URI.create(
    "https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}"
  ))
  .header("x-api-key", "<your-api-key>")
  .DELETE()
  .build();
```

```ruby
uri = URI(
  "https://api.tgcloud.io/controller/v4/v2/workgroups/{workgroupID}/workspaces/{workspaceID}"
)
request = Net::HTTP::Delete.new(uri)
request["x-api-key"] = "<your-api-key>"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {
  |http| http.request(request)
}
```

200 

```json
{
  "Error": false,
  "ErrorDetails": [],
  "Message": "<string>",
  "RequestID": "<string>",
  "Result": "<string>"
}
```
