> This page is for Trading.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.immix.xyz/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.immix.xyz/_mcp/server.

# Delete a workspace

DELETE https://api.immix.xyz/v1/workspaces/{workspaceId}

Deletes one of your workspaces. `If-Match` is required: the version you read, or `*` to delete whatever is stored. A stale version is 412 with `currentVersion`. The id is never reused.

Reference: https://docs.immix.xyz/trading/api-reference/rest-api/workspaces/delete

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `workspaceId` (string, required) — The workspace id.

### Headers

- `If-Match` (string, required) — Required on every entity write: the `ETag` the read minted, quoted or bare, the version this write was computed against, or `*` to write unconditionally on purpose. Absent is 428 `PRECONDITION_REQUIRED`; a weak validator or a list 400 `INVALID_IF_MATCH`; a stale value 412 `VERSION_CONFLICT` with `currentVersion` and a fresh `ETag`: re-read, reapply, retry. Every write restates the whole record, so a `*` write overwrites every field from your copy. State the version unless you mean the overwrite.
- `X-Request-Id` (string, optional) — Your own id for the request: 8 to 128 of `[A-Za-z0-9._-]`. It becomes the request's id and is echoed on the response. A value off that grammar is replaced with a fresh id, never refused.

## Errors

### 400 Delete Workspaces Request Bad Request Error

`INVALID_IF_MATCH`: an `If-Match` this write cannot read (weak, a list).

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

### 401 Delete Workspaces Request Unauthorized Error

The bearer token is missing or not valid.

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

### 404 Delete Workspaces Request Not Found Error

No workspace you own has this id, whatever its shape.

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

### 412 Delete Workspaces Request Precondition Failed Error

`VERSION_CONFLICT`: the row's version is not the one `If-Match` named; `currentVersion` and the `ETag` carry it.

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

### 428 Delete Workspaces Request Precondition Error

`PRECONDITION_REQUIRED`: no `If-Match`.

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

### 501 Delete Workspaces Request Not Implemented Error

`NOT_IMPLEMENTED`: this deployment runs no user-state store, so it serves no workspaces.

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

### 503 Delete Workspaces Request Service Unavailable Error

`USER_STATE_UNAVAILABLE`: your workspaces cannot be read or written now; retry. `USER_STATE_SCHEMA_BEHIND`: the store is behind this release; a retry does not help until the deployment catches up.

- `error` (ErrorBody, required)
- `currentVersion` (string, optional) — On a 412 `VERSION_CONFLICT` from a conditional write that met a row: the row's current version (the `ETag` carries the same token); re-read, reapply, retry. Absent from every other response, a 412 for a row that no longer exists included.

## Types

### ErrorBody

- `code` (string, required) — Machine-readable, UPPER_SNAKE and append-only; tolerate codes you don't know. Branch on this, never on the message.
- `message` (string, required) — For display only; its wording may change at any time.
- `retryable` (boolean, required) — Whether sending the identical request again, after `Retry-After` or a short pause, can succeed with nothing else changed. `false` where something must change first: the request, the caller's standing, or the platform's own records or deployment.
- `requestId` (string, required) — The request's id, also sent as X-Request-Id; quote it to support.

## Examples

**SDK Code**

```python
import requests

url = "https://api.immix.xyz/v1/workspaces/workspaceId"

headers = {
    "If-Match": "If-Match",
    "Authorization": "Bearer <token>"
}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.immix.xyz/v1/workspaces/workspaceId';
const options = {
  method: 'DELETE',
  headers: {'If-Match': 'If-Match', Authorization: 'Bearer <token>'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.immix.xyz/v1/workspaces/workspaceId"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("If-Match", "If-Match")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.immix.xyz/v1/workspaces/workspaceId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["If-Match"] = 'If-Match'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.immix.xyz/v1/workspaces/workspaceId")
  .header("If-Match", "If-Match")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.immix.xyz/v1/workspaces/workspaceId', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'If-Match' => 'If-Match',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.immix.xyz/v1/workspaces/workspaceId");
var request = new RestRequest(Method.DELETE);
request.AddHeader("If-Match", "If-Match");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "If-Match": "If-Match",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.immix.xyz/v1/workspaces/workspaceId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```