To enable the Compliance API, see the setup guide.
Set up the Compliance API检索远程会话消息
GET/v1/compliance/apps/sessions/remote/{claude_remote_session_id}/messages
检索一个远程会话的记录:用户提示、助手响应以及工具调用和结果。不包括思考块和图像。
消息默认按时间从旧到新返回;传递 order=desc 可反转顺序。分页使用与列表端点相同的 page/next_page 方案,每页最多 limit 条消息(默认 100,最大 1000);持续分页直到 next_page 为 null。tool_use_input_max_bytes 和 tool_result_max_bytes 限制每个工具使用输入和每个工具结果文本项返回的字节数;被任一上限截短的块会带有 truncated: true。
响应在分页的 data 数组旁边的 session 下嵌入会话的元数据。在此端点上,session.user.email_address 和 session.started_by_user 始终为 null;请改为从列表端点读取它们。
对于仍处于 pending 状态的会话、已删除的会话以及该密钥可读取的组织之外的会话,返回 404。格式错误的会话标识符返回 400。
Path parameters
Query parameters
Headers
Returns
检索远程会话消息
cURL
curl https://api.anthropic.com/v1/compliance/apps/sessions/remote/$CLAUDE_REMOTE_SESSION_ID/messages \
-H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"Response 200
{
"data": [
{
"id": "id",
"content": [
{
"text": "text",
"truncated": true,
"type": "text"
}
],
"content_unavailable": true,
"created_at": "2019-12-27T18:11:19.117Z",
"role": "assistant",
"sent_by_user_id": "sent_by_user_id"
}
],
"next_page": "next_page",
"session": {
"id": "id",
"agent_id": "agent_id",
"claude_project_id": "claude_project_id",
"created_at": "2019-12-27T18:11:19.117Z",
"organization_uuid": "organization_uuid",
"product_surface": "product_surface",
"started_by_user": {
"id": "id",
"email_address": "email_address"
},
"status": "status",
"updated_at": "2019-12-27T18:11:19.117Z",
"user": {
"id": "id",
"email_address": "email_address"
}
}
}Returns Examples
Response 200
{
"data": [
{
"id": "id",
"content": [
{
"text": "text",
"truncated": true,
"type": "text"
}
],
"content_unavailable": true,
"created_at": "2019-12-27T18:11:19.117Z",
"role": "assistant",
"sent_by_user_id": "sent_by_user_id"
}
],
"next_page": "next_page",
"session": {
"id": "id",
"agent_id": "agent_id",
"claude_project_id": "claude_project_id",
"created_at": "2019-12-27T18:11:19.117Z",
"organization_uuid": "organization_uuid",
"product_surface": "product_surface",
"started_by_user": {
"id": "id",
"email_address": "email_address"
},
"status": "status",
"updated_at": "2019-12-27T18:11:19.117Z",
"user": {
"id": "id",
"email_address": "email_address"
}
}
}