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

# Get a preference

GET https://api.immix.xyz/v1/me/preferences/{key}

One of your preferences by key, matched exactly. A key you have not written is 404: a client shows its default then, with no version to write against, and creates the key with `If-None-Match: *`. The `ETag` is the row's version; send it back as `If-None-Match` to be answered 304 while nothing has changed.

**Answers `304`.** Unchanged: the version `If-None-Match` named is the row's. No body; the `ETag` restates the version.

| Response header | Description                                                                                                                                                                |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ETag`          | The row's version, quoted: `"<version>"`, what `If-Match` takes on a write of the row.                                                                                     |
| `X-Request-Id`  | The request's id: your `X-Request-Id` where you sent a usable one, a fresh id otherwise. An error restates it as `error.requestId`; quote it when you ask about a request. |

Reference: https://docs.immix.xyz/trading/api-reference/rest-api/preferences/get

## Authentication

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

## Request

### Path parameters

- `key` (string, required) — The key, matched exactly.

### Headers

- `If-None-Match` (string, optional) — The `ETag` you hold, quoted or bare: while it is still the row's version the read answers 304 with no body, else 200 with the row.
- `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.

## Response

### 200

The preference.

- `key` (string, required) — The key: 1 to 128 characters of `[A-Za-z0-9._:-]`, starting with a letter or digit, matched exactly.
- `value` (any, required)
- `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.
- `version` (string, required) — The row's version, the `ETag`'s value: send it as `If-Match` on a write of the key. A decimal string from one sequence shared by every row, so it never repeats for a key, not even across a delete and a re-create.
- `createdAtNs` (string, required) — When the key was first written, in epoch nanoseconds; microsecond-exact, so it ends in `000`.
- `updatedAtNs` (string, required) — When the key was last written, in epoch nanoseconds; microsecond-exact, so it ends in `000`.

## Errors

### 400 Get Preferences Request Bad Request Error

The request is malformed.

- `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 Get Preferences 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 Get Preferences Request Not Found Error

You have not written this key.

- `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 Get Preferences Request Not Implemented Error

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

- `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 Get Preferences Request Service Unavailable Error

`USER_STATE_UNAVAILABLE`: your preferences 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

**Response**

```json
{
  "key": "trade-page-chart-settings",
  "value": {
    "depth": 1.5,
    "interval": "1m",
    "overlays": [
      "ema",
      "vwap"
    ]
  },
  "tags": [
    "group:chart",
    "page:trade"
  ],
  "version": "4",
  "createdAtNs": "1761264000000000000",
  "updatedAtNs": "1761264000000000000"
}
```

**SDK Code**

```python
import requests

url = "https://api.immix.xyz/v1/me/preferences/key"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'https://api.immix.xyz/v1/me/preferences/key';
const options = {method: 'GET', headers: {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/me/preferences/key"

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

	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/me/preferences/key")

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

request = Net::HTTP::Get.new(url)
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.get("https://api.immix.xyz/v1/me/preferences/key")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.immix.xyz/v1/me/preferences/key', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.immix.xyz/v1/me/preferences/key");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.immix.xyz/v1/me/preferences/key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```