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"
}
}
}