To enable the Compliance API, see the setup guide.
Set up the Compliance API检索本地会话消息
GET/v1/compliance/apps/sessions/local/{local_session_id}/messages
读取一个本地会话的记录,默认按时间从旧到新排序。
保留策略在读取端强制执行:处于或早于子组织保留边界的轮次永远不会返回;跨越该边界的会话会在其位置带有一个前置的 content_unavailable 占位符(reason: "retention_elapsed")。该边界在遍历的第一页时固定,并在 24 小时内保持有效:超过该时限的游标将被拒绝并返回明确的 400;请重新开始遍历以在当前边界下读取。
Path parameters
Query parameters
Headers
Returns
检索本地会话消息
cURL
curl https://api.anthropic.com/v1/compliance/apps/sessions/local/$LOCAL_SESSION_ID/messages \
-H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"Response 200
{
"data": [
{
"id": "clsm_eyJ2IjoxLCJsIjoi…",
"content": [
{
"text": "text",
"truncated": true,
"type": "text"
}
],
"created_at": "2025-03-12T18:22:41.123456Z",
"model": "claude-opus-5",
"provenance": {
"reason": "not_captured",
"type": "content_unavailable"
},
"role": "assistant",
"type": "compliance_local_session_message"
}
],
"next_page": "page_eyJ2IjoxLCJmIjoibSIs…",
"session": {
"id": "clls_eyJ2IjoxLCJvIjoiOWEx…",
"created_at": "2025-03-12T18:22:41.123456Z",
"organization_uuid": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
"product_surface": "cowork",
"type": "compliance_local_session",
"updated_at": "2025-03-12T18:22:41.123456Z",
"user": {
"id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
"email_address": "jane.doe@example.com"
},
"workspace_id": "wrkspc_01SvYKoWVRVHoEbwESNvzYdR"
}
}Returns Examples
Response 200
{
"data": [
{
"id": "clsm_eyJ2IjoxLCJsIjoi…",
"content": [
{
"text": "text",
"truncated": true,
"type": "text"
}
],
"created_at": "2025-03-12T18:22:41.123456Z",
"model": "claude-opus-5",
"provenance": {
"reason": "not_captured",
"type": "content_unavailable"
},
"role": "assistant",
"type": "compliance_local_session_message"
}
],
"next_page": "page_eyJ2IjoxLCJmIjoibSIs…",
"session": {
"id": "clls_eyJ2IjoxLCJvIjoiOWEx…",
"created_at": "2025-03-12T18:22:41.123456Z",
"organization_uuid": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
"product_surface": "cowork",
"type": "compliance_local_session",
"updated_at": "2025-03-12T18:22:41.123456Z",
"user": {
"id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
"email_address": "jane.doe@example.com"
},
"workspace_id": "wrkspc_01SvYKoWVRVHoEbwESNvzYdR"
}
}