> 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.

# Restate a workspace

PUT https://api.immix.xyz/v1/workspaces/{workspaceId}
Content-Type: application/json

Replaces one of your workspaces whole: every member of the body is required, and the slug never moves. `If-Match` is required: the version you read or last wrote, or `*` to overwrite on purpose. A stale version is 412 with `currentVersion`: re-read and reapply. An autosave keeps one write in flight and sends each `If-Match` from the previous answer's `ETag`.

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

## 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.

### Body (application/json)

This endpoint expects an object.

- `title` (string, required) — The title, 1 to 100 characters, not blank, with no NUL and no unpaired surrogate.
- `layout` (map from string to any, required) — The layout: a JSON object of at most 256 KiB serialised, yours to shape. Anything but an object is 400; more than 256 KiB is 413 `PAYLOAD_TOO_LARGE`.
- `tags` (list of string, required) — The tags, whole: at most 50, each 1 to 64 characters of `[A-Za-z0-9:._-]`, lower-cased and de-duplicated on write. An empty list clears them.
- `visibility` (string, required) — Who may read the row: `PRIVATE`, its owner alone; `ORG`, the owner's organisation too, read-only, once organisation admission serves colleagues' rows. `ORG` needs a token that names an organisation: without one it is 400. Append-only: tolerate values you don't know; a write of one this release does not know is 400.

## Response

### 200

The workspace as restated. The `ETag` is its new version.

- `workspaceId` (string, required) — The workspace's id, a UUID. Ids are opaque strings.
- `slug` (string, required) — The slug, 1 to 100 characters of `[a-z0-9-]`, unique among the owner's workspaces: minted from the title on create unless you supplied one, and never changed after, so a page URL outlives a rename.
- `title` (string, required) — The title, 1 to 100 characters, not blank, with no NUL and no unpaired surrogate.
- `layout` (map from string to any, required) — The layout: a JSON object whose shape belongs to the code that renders it (keep your own `schemaVersion` inside it). The API checks that it is an object of at most 256 KiB serialised and never reads inside it; it is served as you last wrote it: the same tree, members in their order, numbers exact.
- `tags` (list of string, required) — Tags to list by: at most 50, each 1 to 64 characters of `[a-z0-9:._-]`, lower-cased on write and unique.
- `visibility` (string, required) — Who may read the row: `PRIVATE`, its owner alone; `ORG`, the owner's organisation too, read-only, once organisation admission serves colleagues' rows. `ORG` needs a token that names an organisation: without one it is 400. Append-only: tolerate values you don't know; a write of one this release does not know is 400.
- `owned` (boolean, required) — Whether you own the row. `false` for a colleague's `ORG` workspace, which you can read but not write. The owner's identity is not on the row.
- `version` (string, required) — The row's version, the `ETag`'s value: send it as `If-Match` on a write. A decimal string from one sequence shared by every row.
- `createdAtNs` (string, required) — When the workspace was created, in epoch nanoseconds; microsecond-exact, so it ends in `000`.
- `updatedAtNs` (string, required) — When the workspace was last written, in epoch nanoseconds; microsecond-exact, so it ends in `000`.

## Errors

### 400 Update Workspaces Request Bad Request Error

The request is malformed: a member is missing, the layout is not a JSON object, a title or tag is off its grammar, or `ORG` on a token without an organisation; or `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 Update 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 Update 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.

### 409 Update Workspaces Request Conflict Error

`WORKSPACE_CEILING`: setting `ORG` would take your organisation past 2,000 shared 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.

### 412 Update 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.

### 413 Update Workspaces Request Content Too Large Error

`PAYLOAD_TOO_LARGE`: the layout is over 256 KiB serialised, or the body over 528 KiB.

- `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 Update 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 Update 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 Update 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

**Request**

```json
{
  "title": "Trading",
  "layout": {
    "key": "value"
  },
  "tags": [
    "desk:rates"
  ],
  "visibility": "visibility"
}
```

**Response**

```json
{
  "workspaceId": "0192f3a0-7c2e-7d1a-9b3f-4d5e6f708190",
  "slug": "scratch",
  "title": "Scratch",
  "layout": {
    "panels": [
      {
        "type": "watchlist",
        "w": 6
      }
    ],
    "schemaVersion": 1
  },
  "tags": [
    "desk:scratch"
  ],
  "visibility": "PRIVATE",
  "owned": true,
  "version": "8",
  "createdAtNs": "1761263999999998000",
  "updatedAtNs": "1761264000000001000"
}
```

**SDK Code**

```python
import requests

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

payload = {
    "title": "Trading",
    "layout": { "key": "value" },
    "tags": ["desk:rates"],
    "visibility": "visibility"
}
headers = {
    "If-Match": "If-Match",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.immix.xyz/v1/workspaces/workspaceId';
const options = {
  method: 'PUT',
  headers: {
    'If-Match': 'If-Match',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"title":"Trading","layout":{"key":"value"},"tags":["desk:rates"],"visibility":"visibility"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"title\": \"Trading\",\n  \"layout\": {\n    \"key\": \"value\"\n  },\n  \"tags\": [\n    \"desk:rates\"\n  ],\n  \"visibility\": \"visibility\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("If-Match", "If-Match")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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::Put.new(url)
request["If-Match"] = 'If-Match'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"title\": \"Trading\",\n  \"layout\": {\n    \"key\": \"value\"\n  },\n  \"tags\": [\n    \"desk:rates\"\n  ],\n  \"visibility\": \"visibility\"\n}"

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.put("https://api.immix.xyz/v1/workspaces/workspaceId")
  .header("If-Match", "If-Match")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"title\": \"Trading\",\n  \"layout\": {\n    \"key\": \"value\"\n  },\n  \"tags\": [\n    \"desk:rates\"\n  ],\n  \"visibility\": \"visibility\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.immix.xyz/v1/workspaces/workspaceId', [
  'body' => '{
  "title": "Trading",
  "layout": {
    "key": "value"
  },
  "tags": [
    "desk:rates"
  ],
  "visibility": "visibility"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    '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.PUT);
request.AddHeader("If-Match", "If-Match");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"title\": \"Trading\",\n  \"layout\": {\n    \"key\": \"value\"\n  },\n  \"tags\": [\n    \"desk:rates\"\n  ],\n  \"visibility\": \"visibility\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "If-Match": "If-Match",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "title": "Trading",
  "layout": ["key": "value"],
  "tags": ["desk:rates"],
  "visibility": "visibility"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```