Claude Platform Docs

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

1 つのリモートセッションのトランスクリプト(ユーザープロンプト、アシスタントの応答、ツール呼び出しと結果)を取得します。思考ブロックと画像は含まれません。Claude のアプリがユーザーに表示せずにユーザーのメッセージに追加する、アシスタント向けの一部のメモは返されません。そのような text ブロックは added_as_context: true 付きの空の状態で返されます。その他の追加されたテキストは完全な形で返されます。

メッセージはデフォルトで古い順に返されます。逆順にするには order=desc を渡してください。ページネーションは一覧エンドポイントと同じ page/next_page 方式を使用し、1 ページあたり最大 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 を返します。

セッションの組織、またはキー自身の組織に、リモートセッションを Compliance API 経由で読み取ることを許可しないコンプライアンス設定がある場合、error.details に error_code organization_compliance_restricted を含む 403 を返します。これらの設定が変更されるまで、再試行しても解決しません。

Path parameters
claude_remote_session_id: string

The remote session identifier (cse_...) to retrieve

Query parameters
limit: optional number

Maximum results (default: 100, max: 1000)

default100
minimum1
maximum1000
order: optional "asc" or "desc"

Sort direction. asc (oldest-first) or desc.

defaultasc
One of the following:
"asc"
"desc"
page: optional string

Opaque pagination token from a previous response's next_page field. Pass this to retrieve the next page of results. Clients should treat this value as an opaque string and not attempt to parse or interpret its contents, as the format may change without notice.

tool_result_max_bytes: optional number

Truncate each text item inside a tool result to at most this many bytes (cut on a code-point boundary). Pass -1 to request the server maximum. 0 is not a valid value.

default10000
minimum-1
maximum2147483647
tool_use_input_max_bytes: optional number

Truncate each tool-use input to at most this many bytes (cut on a code-point boundary so the result is valid UTF-8). Pass -1 to request the server maximum. 0 is not a valid value.

default10000
minimum-1
maximum2147483647
Headers
"anthropic-version": string

The version of the Claude API to use. Send an available version on every request. A request that sends any other value, including an empty one, returns a 400 error. This endpoint treats a request that omits this header as version 2023-06-01; some other Compliance API endpoints return a 400 error instead.

See API versions for the available versions.

"x-api-key": optional string
Returns
data: array of object{ id, content, content_unavailable, 3 more }

Transcript turns for this page, ordered by transcript position. created_at is a commit timestamp and may tie or invert under concurrent writes; do not re-sort by it.

id: string

Unique identifier for the message, e.g. csev_abc123

content: array of Text or ToolUse or ToolResult

Content blocks within the message

One of the following:
Text object{ type: "text", added_as_context, text, truncated }

Text content block.

type: "text"
defaulttext
added_as_context: boolean

True when the server recognized this text block, by its exact wording, as a note that a Claude app adds to a user's message for the assistant, and withheld it: text is then empty. The match is on the text alone, so it does not prove that an app wrote the block. False does not mean that the user typed the text: other added text, including some of the apps' notes, is exported in full. Always false on assistant messages.

defaultfalse
text: string

Text content from the user or the assistant. Empty when the text is withheld: see added_as_context.

truncated: boolean

True when text exceeded the server-defined maximum (approximately 1 MiB) and was shortened.

defaultfalse
ToolUse object{ type: "tool_use", id, input, 2 more }

Tool invocation requested by the assistant.

type: "tool_use"
defaulttool_use
id: string or null

Tool-use ID, e.g. 'toolu_01AbC...'

input: string

Arguments passed to the tool, as a JSON-encoded string. May be shortened — see the truncated field

name: string

Name of the tool invoked

truncated: boolean

True when input was shortened. Pass tool_use_input_max_bytes=-1 to request full content, subject to the server-side maximum.

defaultfalse
ToolResult object{ type: "tool_result", content, is_error, 3 more }

Result returned by a tool invocation.

type: "tool_result"
defaulttool_result
content: array of object{ type: "text", text }

Text content returned by the tool. Non-text item types are omitted.

type: "text"
defaulttext
text: string

Text returned by the tool

is_error: boolean

True when the tool reported an error

name: string

Name of the tool that produced this result

tool_use_id: string or null

ID of the tool_use block this result responds to

truncated: boolean

True when one or more text items in content were shortened. Pass tool_result_max_bytes=-1 to request full content, subject to the server-side maximum.

defaultfalse
content_unavailable: boolean

True when the stored content could not be returned — it could not be decrypted, or it exceeded the server's per-event size bound. content is empty in that case; this distinguishes 'no content' from 'content withheld'.

defaultfalse
created_at: string

When the message was recorded (RFC 3339, UTC)

formatdate-time
role: "assistant" or "user"

Message sender (user or assistant)

One of the following:
"assistant"
"user"
sent_by_user_id: string or null

Identifier of the human account that sent this turn on an agent-owned session. Null on user-owned sessions, where every user-role turn was sent by the session's user. Can also be null on an agent-owned session, where several people may take part, when the turn cannot be attributed to one human account (for example, no sender was recorded).

next_page: string or null

Opaque page token; pass as page to retrieve the next page. Null when no rows exist after this page. Treat this value as opaque; do not parse or store it long-term, as the format may change without notice.

session: object{ id, agent_id, claude_project_id, 8 more }

Session metadata. started_by_user, user.email_address, and claude_project_id are always null on this endpoint; the messages endpoint resolves neither email addresses nor project bindings.

id: string

Remote session identifier

agent_id: string or null

Identifier of the automated agent that owns the session. Null for user-owned sessions. At most one of user and agent_id is set.

claude_project_id: string or null

ID of the project the session is bound to, as the projects endpoints return it. Null when the session has no project binding.

created_at: string

When the session was created (RFC 3339, UTC)

formatdate-time
organization_uuid: string

UUID of the organization the session belongs to

product_surface: string or null

The Claude product the session was created from. Currently cowork_remote, for Cowork sessions started on claude.ai web or mobile, claude_tag, for Claude Tag sessions started in Slack, and claude_projects, for the sessions of a project whose is_coordinated is true. More values will appear as other surfaces launch, so treat any unrecognized value as an unclassified surface rather than an error. Null for sessions created before this field was recorded, for surfaces that do not stamp it, and for unrecognized tag values.

scheduled_task_id: string or null

ID of the scheduled task whose run started the session, prefixed trig_. The task may no longer exist. Null when no task is recorded, even if a task started or ran in the session.

started_by_user: object{ id, email_address } or null

The user who initiated an agent-owned session (for example, by mentioning Claude in Slack or via a scheduled trigger). Null for user-owned sessions — where the session's user started it — and for agent sessions with no human initiator. For initiators no longer a member of an organization the key may read, the object is populated with email_address null.

id: string

User identifier

email_address: string or null

User's email address. Null when the user is no longer a member of an organization the key may read — id remains set so attribution is preserved. The messages endpoint does not resolve email addresses; this field is always null there.

status: string

Session lifecycle state. One of active, paused, archived, or failed — the lifecycle states the owning product surface exposes — plus pending, a brief transient state that resolves before any transcript content exists. The list endpoint includes pending; the messages endpoint returns 404 for it. Deleted sessions are not returned on either endpoint. Treat unrecognized values as an unknown state rather than an error.

updated_at: string

When the session was last modified (RFC 3339, UTC)

formatdate-time
user: object{ id, email_address } or null

The user who owns the session. Null for sessions owned by an automated agent rather than a user. At most one of user and agent_id is set. For users no longer a member of an organization the key may read, the object is populated with email_address null.

id: string

User identifier

email_address: string or null

User's email address. Null when the user is no longer a member of an organization the key may read — id remains set so attribution is preserved. The messages endpoint does not resolve email addresses; this field is always null there.

リモートセッションメッセージの取得
cURL
curl https://api.anthropic.com/v1/compliance/apps/sessions/remote/$CLAUDE_REMOTE_SESSION_ID/messages \
    -H 'anthropic-version: 2026-10-21' \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"
Returns Examples
Response 200
{
  "data": [
    {
      "id": "id",
      "content": [
        {
          "added_as_context": true,
          "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",
    "scheduled_task_id": "scheduled_task_id",
    "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"
    }
  }
}