跳转到内容
EN

列出客户

先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。

GET/agent/v1/agents/{agent_id}/customers● 支持

请求参数

  • agent_idstring必填

    path: Active service agent id from agent creation or listing. Also accepts an 8-character identity number (0–9, A–Z); malformed, absent and foreign references return 404, and response ids always use agent_….

  • limitinteger可选
    默认 20

    query: Maximum customers per page, 1 to 100; defaults to 20.

  • pagestring可选

    query: 上一响应的 next_page;q、type、blocked 和 limit 必须相同。

  • qstring可选

    query: 客户 ID 的区分大小写的字面前缀;省略则返回全部客户。

  • typestring可选

    query: Only identified or only anonymous customers; omit for both.

    取值 identifiedanonymous
  • blockedboolean可选

    query: true 仅返回已封禁客户,false 仅返回未封禁客户;省略则返回两者。

返回

200

由商家后端用 API Key 或控制台成员调用;客户访问令牌返回 404。包含尚无会话的已登录客户,以及旧嵌入令牌流程留下的客户。

错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码

请求示例

curl
# 先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
curl "https://api.deepraxis.com/agent/v1/agents/agent_123/customers?limit=20" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
# 先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
    f"{opts['base_url']}/v1/agents/agent_123/customers?limit=20",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())
TypeScript
// 先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/agents/agent_123/customers?limit=20`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "data": [
    {
      "id": "docs-sample",
      "type": "identified",
      "merged_into": null,
      "blocked": false,
      "first_seen_at": "2026-10-24T08:07:33.125Z",
      "last_seen_at": "2026-10-24T08:07:33.125Z",
      "session_count": 0,
      "cost": {
        "amount": "0.000000",
        "currency": "USD"
      }
    }
  ],
  "next_page": null
}

响应

HTTP 200

Matching customers and the next page cursor.

application/json

名称 类型 说明
data array<object> Items of this page, in the order requested by the call.
data[].id string The customer id: your customer_id for an identified customer, or anon_ followed by 16 characters for an anonymous one.
data[].type string identified: signed in through a grant code from your backend, or seen under your own id before customer sign-in existed. anonymous: a visitor admitted with the publishable key.
data[].merged_into string | null For an anonymous customer who later signed in, the identified customer it joined; their conversations count toward that customer. null otherwise.
data[].blocked boolean Whether the customer is blocked: no grant code, sign-in, renewal or new session is accepted for this id until it is unblocked.
data[].first_seen_at string | null Earliest sign-in, session or token issuance for this customer, in RFC 3339; null when nothing is recorded.
data[].last_seen_at string | null Latest sign-in, token renewal, session update or token issuance, in RFC 3339; the list is ordered by it, newest first.
data[].session_count integer Sessions of this customer on this agent, including those of anonymous customers merged into it.
data[].cost object Recorded cost of those sessions: model usage (threads included) plus session runtime; "0.000000" when nothing has been recorded.
next_page string | null Cursor for the next page with the same agent, q, type, blocked and limit; null when exhausted.

运行示例前

先创建服务智能体,并为自己的测试客户 docs-sample 通过客户面(/customer/v1)签发授权码并换取访问令牌;替换 agent_123。解封测试前先封禁该客户。删除时 confirm 必须与客户 ID 一致;测试结束后吊销令牌、删除测试客户数据,再归档智能体。