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

# Chi tiết khách hàng

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

Tra theo `customerId` duy nhất — chính là id công khai (11 ký tự `[0-9A-Z]`) mà API trả về; **không** nhận id nội bộ (UUID). **Scope yêu cầu:** `customer:read`; agent cần quyền xem. Khách hàng ngoài phạm vi dữ liệu của agent, hoặc thuộc tenant khác: `404`.

Reference: https://developers.omicx.one/customers/info/get-customer

## Request

### Query parameters

- `customerId` (string, required) — `customerId` do API trả về (11 ký tự `[0-9A-Z]`). Gửi id nội bộ (UUID) sẽ bị từ chối.

### Headers

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

## Response

### 200

Khách hàng.

- `customerId` (string, optional)
- `lifecycleStages` (string, optional)
- `status` (string, optional)
- `fullName` (string, optional)
- `phone` (string, optional) — Có thể đã bị che.
- `email` (string, optional) — Có thể đã bị che.
- `gender` (string, optional)
- `dateOfBirth` (long, optional) — Epoch millis.
- `customerSource` (string, optional)
- `avatarUrl` (string, optional)
- `refId` (string, optional)
- `attributes` (map from string to any, optional) — Khoá theo fieldCode.
- `aiAttributes` (map from string to any, optional) — Câu trả lời của Agent Bot (AI Insight), có ở cả `GET /customers` và search. Khoá theo `id` của card trong [Danh sách tiêu chí AI Insights](/customer-config/attributes/get-customer-ai-insight-config) — là mã kỹ năng (card `SYSTEM`) hoặc id của card (card `CUSTOM` không có mã). Chỉ trả về card đang được cấu hình; card chưa có câu trả lời sẽ không xuất hiện. Giá trị theo `valueType`: `TEXT`/`SINGLE_SELECT` → chuỗi, `STRING_LIST` → mảng chuỗi, `RATING` → số, `BOOLEAN` → boolean.
- `socialIds` (map from string to string, optional) — Chỉ có ở `GET /customers`, không có khi search.
- `assignedAgentId` (string, optional)
- `relatedAgentIds` (list of string, optional)
- `relatedCustomerUids` (list of string, optional)
- `tagIds` (list of string, optional)
- `groupIds` (list of string, optional)
- `workflowStates` (list of CustomerResponseWorkflowStatesItems, optional) — Các quy trình chăm sóc đang gắn với khách hàng.
- `createdBy` (string, optional) — id của agent tạo khách hàng — `public-service` khi tạo qua API này.
- `createdAt` (long, optional)
- `lastModifiedBy` (string, optional) — id của agent sửa khách hàng gần nhất.
- `lastModifiedAt` (long, optional)
- `lastLifecycleStageTime` (long, optional) — Thời điểm chuyển sang giai đoạn hành trình hiện tại.
- `lastInteractionAt` (long, optional, nullable)

## Errors

### 400 Bad Request Error

`VALIDATION_ERROR` — thiếu `customerId` hoặc không đúng định dạng 11 ký tự.

- `error` (ErrorResponseError, optional)

### 401 Unauthorized Error

`API_KEY_REQUIRED` hoặc `API_KEY_INVALID`.

- `error` (ErrorResponseError, optional)

### 403 Forbidden Error

`INSUFFICIENT_SCOPE` (key thiếu scope) · `API_KEY_PRINCIPAL_REQUIRED` (legacy key chưa gắn agent — tạo key mới) · `API_KEY_PRINCIPAL_NOT_ELIGIBLE` (agent của key đã bị vô hiệu hoá, rời tenant, hoặc không còn thuộc tenant) · `FEATURE_ACCESS_DENIED` (quyền hiện tại của agent không cho phép thao tác này trên Khách hàng) · `CUSTOMER_ACCESS_DENIED` (ngoài phạm vi dữ liệu của agent).

- `error` (ErrorResponseError, optional)

### 404 Not Found Error

Không tìm thấy (ngoài phạm vi dữ liệu của agent, hoặc thuộc tenant khác).

- `error` (ErrorResponseError, optional)

### 429 Too Many Requests Error

`RATE_LIMIT_EXCEEDED`.

- `error` (ErrorResponseError, optional)

### 502 Bad Gateway Error

`CUSTOMER_SERVICE_UNAVAILABLE` — customer-service timeout/lỗi 5xx, kèm `Retry-After: 5`. Platform không tự động thử lại.

- `error` (ErrorResponseError, optional)

### 503 Service Unavailable Error

`AGENT_SERVICE_UNAVAILABLE` / `PERMISSION_SNAPSHOT_UNAVAILABLE` / `SCOPE_RESOLUTION_FAILED` — không xác thực được quyền hạn, hệ thống từ chối theo hướng an toàn (fail closed).

- `error` (ErrorResponseError, optional)

## Types

### CustomerResponseWorkflowStatesItems

- `workflowId` (string, optional)
- `statusId` (string, optional)
- `joinedAt` (long, optional)
- `statusChangedAt` (long, optional)

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

### ErrorResponseErrorDetailsItems

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

## Examples

**Response**

```json
{
  "customerId": "string",
  "lifecycleStages": "string",
  "status": "string",
  "fullName": "string",
  "phone": "string",
  "email": "string",
  "gender": "string",
  "dateOfBirth": 1,
  "customerSource": "string",
  "avatarUrl": "string",
  "refId": "string",
  "attributes": {
    "cap_bac": "VIP",
    "diem_tich_luy": 120
  },
  "aiAttributes": {
    "customer_sentiment": "Tích cực",
    "nhu_cau": "Quan tâm gói Premium"
  },
  "socialIds": {
    "zalo": "0912345678"
  },
  "assignedAgentId": "string",
  "relatedAgentIds": [
    "string"
  ],
  "relatedCustomerUids": [
    "string"
  ],
  "tagIds": [
    "string"
  ],
  "groupIds": [
    "string"
  ],
  "workflowStates": [
    {
      "workflowId": "string",
      "statusId": "string",
      "joinedAt": 1,
      "statusChangedAt": 1
    }
  ],
  "createdBy": "string",
  "createdAt": 1,
  "lastModifiedBy": "string",
  "lastModifiedAt": 1,
  "lastLifecycleStageTime": 1,
  "lastInteractionAt": 1
}
```

**SDK Code**

```python
import requests

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

querystring = {"customerId":"customerId"}

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

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

print(response.json())
```

```javascript
const url = 'https://api.omicx.one/customers?customerId=customerId';
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?customerId=customerId"

	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?customerId=customerId")

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?customerId=customerId")
  .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?customerId=customerId', [
  'headers' => [
    'X-Api-Key' => 'omx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.omicx.one/customers?customerId=customerId");
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?customerId=customerId")! 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()
```