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

# Thuộc tính khách hàng

GET https://api.omicx.one/customers/attributes

**Scope yêu cầu:** `customer:read`. Các field khách hàng đang hoạt động của tenant, theo **fieldCode** — chính là tên mà Customer API dùng (xem thêm [Thuộc tính khách hàng](/customer-attributes)). Field có `system: true` là field cấp cao nhất của body tạo/cập nhật khách hàng; các field còn lại nằm trong `attributes.{fieldCode}`. `options` chỉ có ở field kiểu `SINGLE_SELECT`/`MULTI_SELECT` (gửi `optionId`). `example` là giá trị mẫu đúng định dạng field đó nhận — nhiều lựa chọn hoặc nhiều uid kiểu `PERSON` nối nhau bằng `;` (ví dụ `"optionId1;optionId2"`). Riêng field `customerSourceOptionId` còn liệt kê thêm các nguồn mặc định của nền tảng (master data) sau các giá trị tenant tự tạo.

Reference: https://developers.omicx.one/customer-config/attributes/list-customer-attributes

## Request

### Headers

- `X-Api-Key` (string, required)

## Response

### 200

Danh sách field.

- `items` (list of CustomerAttributeListItemsItems, optional)

## Errors

### 401 Unauthorized Error

`API_KEY_REQUIRED` hoặc `API_KEY_INVALID`.

- `error` (ErrorResponseError, optional)

### 403 Forbidden Error

`INSUFFICIENT_SCOPE`.

- `error` (ErrorResponseError, optional)

### 429 Too Many Requests Error

`RATE_LIMIT_EXCEEDED`.

- `error` (ErrorResponseError, optional)

### 502 Bad Gateway Error

`CUSTOMER_SERVICE_UNAVAILABLE` — upstream timeout/lỗi 5xx, kèm `Retry-After: 5`.

- `error` (ErrorResponseError, optional)

## Types

### CustomerAttributeListItemsItems

- `fieldCode` (string, optional)
- `label` (string, optional)
- `dataType` (enum, optional)
  - Allowed values: `TEXT`, `TEXTAREA`, `NUMBER`, `CURRENCY`, `BOOLEAN`, `SINGLE_SELECT`, `MULTI_SELECT`, `TEMPORAL`, `PERSON`, `ATTACHMENT`, `URL`, `PHONE`, `EMAIL`
- `storageType` (enum, optional) — Cách giá trị được lưu trữ — suy ra từ `dataType`.
  - Allowed values: `STRING`, `NUMBER`, `BOOLEAN`, `DATETIME`, `ATTACHMENT`
- `system` (boolean, optional) — `true` — field cấp cao nhất của body tạo/cập nhật; `false` — nằm trong `attributes.{fieldCode}`.
- `required` (boolean, optional)
- `options` (list of CustomerAttributeListItemsItemsOptionsItems, optional) — Chỉ có ở field kiểu `SINGLE_SELECT`/`MULTI_SELECT`.
- `example` (any, optional) — Giá trị mẫu theo `dataType` — nhiều lựa chọn (`MULTI_SELECT`) hoặc nhiều uid (`PERSON`) nối nhau bằng `;`.

### ErrorResponseError

- `code` (string, optional) — Nhóm lỗi (dạng máy đọc được), ổn định theo từng HTTP status.
- `subCode` (string, optional, nullable) — Mã cụ thể, ổn định — dùng để phân nhánh xử lý / dịch i18n. Hãy xử lý logic dựa trên `subCode`, không dựa vào chuỗi `message`.
- `message` (string, optional) — Mô tả cho con người đọc (dùng để debug), không nên dịch trực tiếp.
- `timestamp` (long, optional) — Epoch millis.
- `path` (string, optional) — Đường dẫn request đầy đủ.
- `traceId` (string, optional, nullable) — Mã tương quan request, có khi lỗi đi qua bộ xử lý lỗi chung.
- `details` (list of ErrorResponseErrorDetailsItems, optional, nullable) — Chỉ xuất hiện khi `code` là `VALIDATION_ERROR` — danh sách lỗi theo từng trường.

### CustomerAttributeListItemsItemsOptionsItems

- `optionId` (string, optional)
- `label` (string, optional)

### ErrorResponseErrorDetailsItems

- `field` (string, optional)
- `message` (string, optional)
- `rejectedValue` (any, optional, nullable)

## Examples

**Response**

```json
{
  "items": [
    {
      "fieldCode": "string",
      "label": "string",
      "dataType": "TEXT",
      "storageType": "STRING",
      "system": true,
      "required": true,
      "options": [
        {
          "optionId": "string",
          "label": "string"
        }
      ],
      "example": null
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.omicx.one/customers/attributes"

headers = {"X-Api-Key": "omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

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

print(response.json())
```

```javascript
const url = 'https://api.omicx.one/customers/attributes';
const options = {method: 'GET', headers: {'X-Api-Key': 'omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}};

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.omicx.one/customers/attributes"

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

	req.Header.Add("X-Api-Key", "omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")

	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.omicx.one/customers/attributes")

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

request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = 'omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

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.omicx.one/customers/attributes")
  .header("X-Api-Key", "omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.omicx.one/customers/attributes', [
  'headers' => [
    'X-Api-Key' => 'omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.omicx.one/customers/attributes");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Api-Key", "omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-Api-Key": "omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.omicx.one/customers/attributes")! 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()
```