SPB Git

Repository Public

sessions.md 39.1 KB 1,059 lines markdown

1---2title: Sessions3url: https://platform.claude.com/docs/en/api/compliance/apps/sessions4---56# Sessions78## Sessions › Local910### List local sessions1112**GET** `/v1/compliance/apps/sessions/local`1314List local sessions across the organizations the key may read.1516Results are ordered by `created_at` descending. Pagination is17forward-only via `next_page`; there is no reverse cursor.1819#### Query parameters2021- `created_at: optional object`2223  - `gte: optional string`2425    Only return sessions whose first inference call is at or after this time (RFC 3339; a UTC offset is required).2627    format: date-time2829  - `lt: optional string`3031    Only return sessions whose first inference call is strictly before this time (RFC 3339; a UTC offset is required).3233    format: date-time3435- `limit: optional number`3637  Maximum results (default: 100, max: 500)3839  default: 100, maximum: 500, minimum: 14041- `page: optional string`4243  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.4445- `updated_at: optional object`4647  - `gte: optional string`4849    Only return sessions whose last inference call is at or after this time (RFC 3339; a UTC offset is required). Combines with `created_at.gte` / `created_at.lt`; the ordering and pagination are unchanged. Use it to poll for sessions that have been active since a previous pass — a session that becomes active later can only enter the result, never leave it.5051    format: date-time5253#### Headers5455- `"x-api-key": optional string`5657#### Returns5859- `data: array of object`6061  Page of local sessions, ordered by `created_at` descending; ties are broken by a fixed server-side order. `updated_at` never participates in the ordering; the `updated_at.gte` query parameter filters on it without changing the order or the pagination cursor.6263  - `type: "compliance_local_session"`6465    default: compliance_local_session6667  - `id: string`6869    Local session identifier, prefixed `clls_`. Unique within the parent organization. Treat as an opaque string; the format may change without notice.7071  - `created_at: string`7273    Timestamp of the session's first retained inference call (RFC 3339, UTC). When a session's activity spans the child organization's retention boundary, calls older than the boundary are no longer reflected, so this value is the timestamp of the earliest retained call: always strictly after the boundary, never the boundary itself.7475    format: date-time7677  - `organization_uuid: string`7879    UUID of the child organization the session belongs to8081  - `product_surface: string or null`8283    The product the session ran in: `cowork` (Cowork in Claude Desktop on the user's machine), `claude_code` (Claude Code), `claude_science` (Claude Science), or one of `office_agents/excel`, `office_agents/powerpoint`, `office_agents/word`, and `office_agents/outlook` (Claude for Microsoft 365, by app; `office_agents` alone when the app is not identified). New values appear as coverage expands; treat unrecognized values as opaque. `null` when the surface was not recorded.8485  - `truncated: boolean`8687    True when the session has more inference calls than the service can return for one session (100,000). The messages endpoint then returns only the session's earliest calls, up to that many, and ends before the session does; `updated_at` is a lower bound on the latest call and can differ between the list and retrieve endpoints. False for every session within that bound.8889    default: false9091  - `updated_at: string`9293    Timestamp of the session's last retained inference call (RFC 3339, UTC). Always at or after `created_at`. When a session's activity spans the child organization's retention boundary, calls older than the boundary are no longer reflected — but because retention removes only the oldest calls, this value (unlike `created_at`) is unaffected until the entire session has aged out. On the list endpoint this value is a lower bound: for a session still active at a page or `created_at.lt` window boundary it can momentarily lag the session's true last activity. Retrieving the session, or its messages, always reflects the exact latest retained call.9495    format: date-time9697  - `user: object`9899    The authenticated user at the time of the session. Always set; `user.id` is always populated. `user.email_address` is null when the user's account has been deleted or the user is no longer a member of an organization the key may read.100101    - `id: string`102103      User identifier (tagged ID, prefixed `user_`). Always set, so attribution survives after the user's account is deleted or the user leaves the organizations the key may read.104105    - `email_address: string or null`106107      User's email address. Null when the user's account has been deleted or the user is no longer a member of an organization the key may read. The messages endpoint does not resolve email addresses; this field is always null there.108109  - `workspace_id: string or null`110111    Workspace identifier (tagged ID, prefixed `wrkspc_`). Null for sessions not attributed to a workspace.112113- `next_page: string or null`114115  Opaque pagination cursor (prefixed `page_`) for the next page. Null when there is no further page. Treat as an opaque string; the format may change without notice.116117#### Example118119```bash120curl https://api.anthropic.com/v1/compliance/apps/sessions/local \121    -H 'anthropic-version: 2023-06-01' \122    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"123```124125##### Response (200)126127```json128{129  "data": [130    {131      "type": "compliance_local_session",132      "id": "clls_eyJ2IjoxLCJvIjoiOWEx…",133      "organization_uuid": "9a1e0000-0000-0000-0000-000000000000",134      "workspace_id": "wrkspc_01SvYKoWVRVHoEbwESNvzYdR",135      "user": {136        "id": "user_01GpKpLmNoPqRsTuVwXyZaBc",137        "email_address": "engineer@example.com"138      },139      "product_surface": "cowork",140      "created_at": "2026-07-09T14:02:11Z",141      "updated_at": "2026-07-09T15:47:33Z"142    }143  ]144}145```146147### Retrieve a local session148149**GET** `/v1/compliance/apps/sessions/local/{local_session_id}`150151Retrieve one local session.152153The response is the same session object the list endpoint returns,154with `user.email_address` resolved the same way. Retention is155enforced when the response is served: a session whose every156inference call has aged out returns 404.157158#### Path parameters159160- `local_session_id: string`161162#### Headers163164- `"x-api-key": optional string`165166#### Returns167168- `type: "compliance_local_session"`169170  default: compliance_local_session171172- `id: string`173174  Local session identifier, prefixed `clls_`. Unique within the parent organization. Treat as an opaque string; the format may change without notice.175176- `created_at: string`177178  Timestamp of the session's first retained inference call (RFC 3339, UTC). When a session's activity spans the child organization's retention boundary, calls older than the boundary are no longer reflected, so this value is the timestamp of the earliest retained call: always strictly after the boundary, never the boundary itself.179180  format: date-time181182- `organization_uuid: string`183184  UUID of the child organization the session belongs to185186- `product_surface: string or null`187188  The product the session ran in: `cowork` (Cowork in Claude Desktop on the user's machine), `claude_code` (Claude Code), `claude_science` (Claude Science), or one of `office_agents/excel`, `office_agents/powerpoint`, `office_agents/word`, and `office_agents/outlook` (Claude for Microsoft 365, by app; `office_agents` alone when the app is not identified). New values appear as coverage expands; treat unrecognized values as opaque. `null` when the surface was not recorded.189190- `truncated: boolean`191192  True when the session has more inference calls than the service can return for one session (100,000). The messages endpoint then returns only the session's earliest calls, up to that many, and ends before the session does; `updated_at` is a lower bound on the latest call and can differ between the list and retrieve endpoints. False for every session within that bound.193194  default: false195196- `updated_at: string`197198  Timestamp of the session's last retained inference call (RFC 3339, UTC). Always at or after `created_at`. When a session's activity spans the child organization's retention boundary, calls older than the boundary are no longer reflected — but because retention removes only the oldest calls, this value (unlike `created_at`) is unaffected until the entire session has aged out. On the list endpoint this value is a lower bound: for a session still active at a page or `created_at.lt` window boundary it can momentarily lag the session's true last activity. Retrieving the session, or its messages, always reflects the exact latest retained call.199200  format: date-time201202- `user: object`203204  The authenticated user at the time of the session. Always set; `user.id` is always populated. `user.email_address` is null when the user's account has been deleted or the user is no longer a member of an organization the key may read.205206  - `id: string`207208    User identifier (tagged ID, prefixed `user_`). Always set, so attribution survives after the user's account is deleted or the user leaves the organizations the key may read.209210  - `email_address: string or null`211212    User's email address. Null when the user's account has been deleted or the user is no longer a member of an organization the key may read. The messages endpoint does not resolve email addresses; this field is always null there.213214- `workspace_id: string or null`215216  Workspace identifier (tagged ID, prefixed `wrkspc_`). Null for sessions not attributed to a workspace.217218#### Example219220```bash221curl https://api.anthropic.com/v1/compliance/apps/sessions/local/$LOCAL_SESSION_ID \222    -H 'anthropic-version: 2023-06-01' \223    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"224```225226##### Response (200)227228```json229{230  "type": "compliance_local_session",231  "id": "clls_eyJ2IjoxLCJvIjoiOWEx…",232  "organization_uuid": "9a1e0000-0000-0000-0000-000000000000",233  "workspace_id": "wrkspc_01SvYKoWVRVHoEbwESNvzYdR",234  "user": {235    "id": "user_01GpKpLmNoPqRsTuVwXyZaBc",236    "email_address": "engineer@example.com"237  },238  "product_surface": "cowork",239  "created_at": "2026-07-09T14:02:11Z",240  "updated_at": "2026-07-09T15:47:33Z"241}242```243244## Sessions › Local › Messages245246### Retrieve local session messages247248**GET** `/v1/compliance/apps/sessions/local/{local_session_id}/messages`249250Read one local session's transcript, oldest-first by default.251252Retention is enforced read-side: turns at or before the child253organization's retention boundary are never returned; a session254that straddles the boundary carries one leading255`content_unavailable` placeholder (`reason: "retention_elapsed"`)256in their place. The boundary is pinned on the walk's first page and257honored for 24 hours: a cursor older than that is rejected with an258explicit 400; restart the walk to read under the current boundary.259260#### Path parameters261262- `local_session_id: string`263264#### Query parameters265266- `limit: optional number`267268  Maximum results (default: 100, max: 1000)269270  default: 100, maximum: 1000, minimum: 1271272- `order: optional "asc" or "desc"`273274  Sort direction. `asc` (oldest-first, default) or `desc`.275276  default: asc277278  - `"asc"`279280  - `"desc"`281282- `page: optional string`283284  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.285286- `tool_result_max_bytes: optional number`287288  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 (approximately 1 MiB); larger values are clamped to it. `0` is not a valid value.289290  default: 10000, maximum: 2147483647, minimum: -1291292- `tool_use_input_max_bytes: optional number`293294  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 (approximately 1 MiB); larger values are clamped to it. `0` is not a valid value.295296  default: 10000, maximum: 2147483647, minimum: -1297298#### Headers299300- `"x-api-key": optional string`301302#### Returns303304- `data: array of object`305306  Transcript turns for this page, in call order: oldest call first by default, newest call first with `order=desc`. The messages of one call carry the call's timestamp and follow each other in transcript order; a page boundary can fall between them.307308  - `type: "compliance_local_session_message"`309310    default: compliance_local_session_message311312  - `id: string`313314    Message identifier, prefixed `clsm_`. Stable for as long as the message's turn is retained: identifiers of retained turns do not change as older turns age out of the organization's retention period. The `retention_elapsed` placeholder's identifier is distinct from every retained turn's and changes only when further turns age out.315316  - `content: array of Text or ToolUse or ToolResult`317318    Content blocks within the message, discriminated on `type` (`text` / `tool_use` / `tool_result`: the same discriminator values as the claude.ai chat-messages endpoint; the tool variants omit `integration_name` and `mcp_server_url`, and `text` carries `truncated`). Extended-thinking content is never included. The request's `system` field is never included; a presence-only marker message is emitted when it was set. The request's `tools[]` definitions are never included as transcript messages. Project-level instructions (such as CLAUDE.md files) appear in the message stream as a user-role context block and are included. Empty when `provenance.type` is `content_unavailable`.319320    - `Text object`321322      Text content block.323324      - `type: "text"`325326        default: text327328      - `text: string`329330        Text content from the user or the assistant331332      - `truncated: boolean`333334        True when `text` was shortened by the server's fixed per-string bound (approximately 1 MiB), or when ancillary content the block carried (such as citations) was omitted, or when this block stands in for a non-text block whose content is not shown, or when it is an explanatory marker the server inserted (its text enclosed in square brackets, e.g. prefacing client-asserted history). There is no request parameter that raises the per-string bound.335336        default: false337338    - `ToolUse object`339340      Tool invocation requested by the assistant.341342      - `type: "tool_use"`343344        default: tool_use345346      - `id: string or null`347348        Tool-use ID, e.g. 'toolu_01AbC...'349350      - `input: string`351352        Arguments passed to the tool, as a JSON-encoded string. May be shortened (see the `truncated` field); a truncated value is cut mid-document and is not valid JSON.353354      - `name: string`355356        Name of the tool invoked357358      - `truncated: boolean`359360        True when `input` was shortened. Pass `tool_use_input_max_bytes=-1` to request the server maximum.361362        default: false363364    - `ToolResult object`365366      Result returned by a tool invocation.367368      - `type: "tool_result"`369370        default: tool_result371372      - `content: array of object`373374        Text content returned by the tool. Non-text item types are omitted and signalled via `truncated` with an in-band item-count marker.375376        - `type: "text"`377378          default: text379380        - `text: string`381382          Text returned by the tool383384      - `is_error: boolean`385386        True when the tool reported an error387388      - `name: string`389390        Name of the tool that produced this result391392      - `tool_use_id: string or null`393394        ID of the tool_use block this result responds to395396      - `truncated: boolean`397398        True when one or more text items in `content` were shortened or non-text items were omitted. Pass `tool_result_max_bytes=-1` to request the server maximum.399400        default: false401402  - `created_at: string`403404    When the message was recorded (RFC 3339, UTC)405406    format: date-time407408  - `model: string or null`409410    The model that served this assistant turn, as reported in the `model` field of the underlying Messages API response. Null on user messages and on any assistant message whose `provenance` is set: client-asserted history and synthetic markers were not produced by a model during this session, and for unavailable content the serving model is not known.411412  - `provenance: ContentUnavailable or ClientAsserted or SyntheticMarker or null`413414    Where this turn's content came from, discriminated on `type`. Null (the common case) means verified content: on an assistant message, content Claude produced during this session; on a user message, content the user sent. `content_unavailable`: the turn's content cannot be returned and `content` is empty; `reason` says why. `client_asserted`: assistant content the client supplied as conversation history; `content` shows what the model received but its authorship is not verified; never on user-role messages. `synthetic_marker`: a transcript marker the endpoint generated rather than content either party sent during the session. Both `client_asserted` and `synthetic_marker` can result from normal request or client processing, not only client modification. Callers should tolerate unrecognized `type` values.415416    - `ContentUnavailable object`417418      The turn's content cannot be returned; `content` is empty.419420      - `type: "content_unavailable"`421422        default: content_unavailable423424      - `reason: string`425426        Why this turn's content cannot be returned, e.g. `not_captured` (the content was not captured for compliance retrieval), `client_aborted` (the client closed the connection or cancelled the request before the response completed, so the response was not captured for this turn; any partial output already streamed to the client is not included; assistant-role turns only), `cmek_key_revoked` (the content is encrypted under the organization's customer-managed key and that key is unavailable), `retention_elapsed` (the content lies past the organization's retention boundary; on the placeholder standing in for every pre-boundary turn), or `oversize` (the message exceeds the server's per-message size bound even after per-block truncation). Callers should tolerate unrecognized values. `not_captured` is not proof that no record was stored: content withheld by the storage layer's fail-closed access policies carries the same reason and is deliberately indistinguishable from content that was never captured.427428    - `ClientAsserted object`429430      Assistant content the client supplied as conversation history431      rather than produced by Claude during this session. `content` shows432      what the model received but its authorship is not verified; this can433      result from normal request or client processing, not only client434      modification. Never on user-role messages.435436      - `type: "client_asserted"`437438        default: client_asserted439440    - `SyntheticMarker object`441442      A transcript marker generated by the endpoint rather than sent by443      either party during the session. Marker messages indicate that the444      prompt history diverged from what was captured, that the request's445      `system` field was present but is not shown, or that earlier turns446      that a request re-sent as history were withheld because they cannot447      be dated against the child organization's data-retention period448      (only for organizations with a finite retention period; the request's449      new user input after its last assistant turn is not affected). The450      marker's text names the cause. Markers that report a mismatch with451      captured history can result from normal request or client processing,452      not only client modification.453454      - `type: "synthetic_marker"`455456        default: synthetic_marker457458  - `role: "assistant" or "user"`459460    Message sender (`user` or `assistant`)461462    - `"assistant"`463464    - `"user"`465466- `next_page: string or null`467468  Opaque pagination cursor (prefixed `page_`) for the next page. Null when there is no further page. Treat as an opaque string; the format may change without notice.469470- `session: object`471472  The local session the messages belong to. `user.email_address` is always null on this endpoint; the messages endpoint does not resolve email addresses.473474  - `type: "compliance_local_session"`475476    default: compliance_local_session477478  - `id: string`479480    Local session identifier, prefixed `clls_`. Unique within the parent organization. Treat as an opaque string; the format may change without notice.481482  - `created_at: string`483484    Timestamp of the session's first retained inference call (RFC 3339, UTC). When a session's activity spans the child organization's retention boundary, calls older than the boundary are no longer reflected, so this value is the timestamp of the earliest retained call: always strictly after the boundary, never the boundary itself.485486    format: date-time487488  - `organization_uuid: string`489490    UUID of the child organization the session belongs to491492  - `product_surface: string or null`493494    The product the session ran in: `cowork` (Cowork in Claude Desktop on the user's machine), `claude_code` (Claude Code), `claude_science` (Claude Science), or one of `office_agents/excel`, `office_agents/powerpoint`, `office_agents/word`, and `office_agents/outlook` (Claude for Microsoft 365, by app; `office_agents` alone when the app is not identified). New values appear as coverage expands; treat unrecognized values as opaque. `null` when the surface was not recorded.495496  - `truncated: boolean`497498    True when the session has more inference calls than the service can return for one session (100,000). The messages endpoint then returns only the session's earliest calls, up to that many, and ends before the session does; `updated_at` is a lower bound on the latest call and can differ between the list and retrieve endpoints. False for every session within that bound.499500    default: false501502  - `updated_at: string`503504    Timestamp of the session's last retained inference call (RFC 3339, UTC). Always at or after `created_at`. When a session's activity spans the child organization's retention boundary, calls older than the boundary are no longer reflected — but because retention removes only the oldest calls, this value (unlike `created_at`) is unaffected until the entire session has aged out. On the list endpoint this value is a lower bound: for a session still active at a page or `created_at.lt` window boundary it can momentarily lag the session's true last activity. Retrieving the session, or its messages, always reflects the exact latest retained call.505506    format: date-time507508  - `user: object`509510    The authenticated user at the time of the session. Always set; `user.id` is always populated. `user.email_address` is null when the user's account has been deleted or the user is no longer a member of an organization the key may read.511512    - `id: string`513514      User identifier (tagged ID, prefixed `user_`). Always set, so attribution survives after the user's account is deleted or the user leaves the organizations the key may read.515516    - `email_address: string or null`517518      User's email address. Null when the user's account has been deleted or the user is no longer a member of an organization the key may read. The messages endpoint does not resolve email addresses; this field is always null there.519520  - `workspace_id: string or null`521522    Workspace identifier (tagged ID, prefixed `wrkspc_`). Null for sessions not attributed to a workspace.523524#### Example525526```bash527curl https://api.anthropic.com/v1/compliance/apps/sessions/local/$LOCAL_SESSION_ID/messages \528    -H 'anthropic-version: 2023-06-01' \529    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"530```531532##### Response (200)533534```json535{536  "data": [537    {538      "id": "clsm_eyJ2IjoxLCJsIjoi…",539      "content": [540        {541          "text": "text",542          "truncated": true,543          "type": "text"544        }545      ],546      "created_at": "2025-03-12T18:22:41.123456Z",547      "model": "claude-opus-5",548      "provenance": {549        "reason": "not_captured",550        "type": "content_unavailable"551      },552      "role": "assistant",553      "type": "compliance_local_session_message"554    }555  ],556  "next_page": "page_eyJ2IjoxLCJmIjoibSIs…",557  "session": {558    "id": "clls_eyJ2IjoxLCJvIjoiOWEx…",559    "created_at": "2025-03-12T18:22:41.123456Z",560    "organization_uuid": "a1b2c3d4-e5f6-4789-a012-3456789abcde",561    "product_surface": "cowork",562    "truncated": true,563    "type": "compliance_local_session",564    "updated_at": "2025-03-12T18:22:41.123456Z",565    "user": {566      "id": "user_01WCz1FkmYMm4gnmykNKUu3Q",567      "email_address": "jane.doe@example.com"568    },569    "workspace_id": "wrkspc_01SvYKoWVRVHoEbwESNvzYdR"570  }571}572```573574## Sessions › Remote575576### List remote sessions577578**GET** `/v1/compliance/apps/sessions/remote`579580List remote sessions (Cowork sessions that run in Anthropic-managed581cloud environments) across the organizations the key may read.582583Each entry carries session metadata only; retrieve a session's584transcript from the messages endpoint. By default the list spans every585such organization; pass up to 500 `organization_ids[]` values to586narrow it. Pass 1 to 10 `user_ids[]` values to scope the587list to specific users: that filter matches the session's owning user,588so agent-owned sessions are excluded whenever it is set. Bound results589in time with the `created_at` range parameters (`created_at.gte`,590`created_at.gt`, `created_at.lt`, `created_at.lte`; RFC 3339). There591is no `updated_at` filter.592593Results are sorted newest first by `created_at`, with at most `limit`594sessions per page (default 100, maximum 500). Pagination is595forward-only: pass the response's `next_page` value back as `page` to596retrieve the next page, and stop when `next_page` is null.597598#### Query parameters599600- `created_at: optional object`601602  - `gt: optional string`603604    Filter remote sessions created after this time (RFC 3339 format)605606    format: date-time607608  - `gte: optional string`609610    Filter remote sessions created at or after this time (RFC 3339 format)611612    format: date-time613614  - `lt: optional string`615616    Filter remote sessions created before this time (RFC 3339 format)617618    format: date-time619620  - `lte: optional string`621622    Filter remote sessions created at or before this time (RFC 3339 format)623624    format: date-time625626- `limit: optional number`627628  Maximum results (default: 100, max: 500)629630  default: 100, maximum: 500, minimum: 1631632- `organization_ids: optional array of string`633634  Filter to specific child organization identifiers. Omit to enumerate every child organization the key may read.635636  maxItems: 500637638- `page: optional string`639640  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.641642- `user_ids: optional array of string`643644  Filter to sessions owned by specific users (max 10 per request). Agent-owned sessions are excluded when this filter is set.645646  maxItems: 10647648#### Headers649650- `"x-api-key": optional string`651652#### Returns653654- `data: array of object`655656  - `id: string`657658    Remote session identifier659660  - `agent_id: string or null`661662    Identifier of the automated agent that owns the session. Null for user-owned sessions. At most one of `user` and `agent_id` is set.663664  - `claude_project_id: string or null`665666    ID of the project the session is bound to. Null when the session has no project binding.667668  - `created_at: string`669670    When the session was created (RFC 3339, UTC)671672    format: date-time673674  - `organization_uuid: string`675676    UUID of the organization the session belongs to677678  - `product_surface: string or null`679680    The Claude product the session was created from. Currently `cowork_remote`, for Cowork sessions started on claude.ai web or mobile. 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.681682  - `started_by_user: object or null`683684    A user associated with a remote session.685686    - `id: string`687688      User identifier689690    - `email_address: string or null`691692      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.693694  - `status: string`695696    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.697698  - `updated_at: string`699700    When the session was last modified (RFC 3339, UTC)701702    format: date-time703704  - `user: object or null`705706    A user associated with a remote session.707708    - `id: string`709710      User identifier711712    - `email_address: string or null`713714      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.715716- `next_page: string or null`717718  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.719720#### Example721722```bash723curl https://api.anthropic.com/v1/compliance/apps/sessions/remote \724    -H 'anthropic-version: 2023-06-01' \725    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"726```727728##### Response (200)729730```json731{732  "data": [733    {734      "id": "cse_01A0000000000000000000000",735      "organization_uuid": "00000000-0000-0000-0000-000000000000",736      "user": {737        "id": "user_01A0000000000000000000000",738        "email_address": "user@example.com"739      },740      "status": "active",741      "created_at": "2026-01-02T03:04:05.000000Z",742      "updated_at": "2026-01-02T03:04:05.000000Z",743      "product_surface": "cowork_remote",744      "claude_project_id": "claude_proj_01Nm7PqRsTuVwXyZaBcDeFgH"745    }746  ],747  "next_page": "page_AAE..."748}749```750751## Sessions › Remote › Messages752753### Retrieve remote session messages754755**GET** `/v1/compliance/apps/sessions/remote/{claude_remote_session_id}/messages`756757Retrieve one remote session's transcript: user prompts, assistant758responses, and tool calls and results. Thinking blocks and images are759not included.760761Messages are returned oldest first by default; pass `order=desc` to762reverse. Pagination uses the same `page`/`next_page` scheme as the763list endpoint, with at most `limit` messages per page (default 100,764maximum 1000); keep paginating until `next_page` is null.765`tool_use_input_max_bytes` and `tool_result_max_bytes` cap how many766bytes of each tool-use input and each tool-result text item are767returned; a block shortened by either cap carries `truncated: true`.768769The response embeds the session's metadata under `session` alongside770the paginated `data` array. On this endpoint `session.user.email_address`771and `session.started_by_user` are always null; read them from the list772endpoint instead.773774Returns 404 while the session is still `pending`, for deleted sessions,775and for sessions outside the organizations the key may read. A776malformed session identifier returns 400.777778#### Path parameters779780- `claude_remote_session_id: string`781782  The remote session identifier (`cse_...`) to retrieve783784#### Query parameters785786- `limit: optional number`787788  Maximum results (default: 100, max: 1000)789790  default: 100, maximum: 1000, minimum: 1791792- `order: optional "asc" or "desc"`793794  Sort direction. `asc` (oldest-first) or `desc`.795796  default: asc797798  - `"asc"`799800  - `"desc"`801802- `page: optional string`803804  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.805806- `tool_result_max_bytes: optional number`807808  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.809810  default: 10000, maximum: 2147483647, minimum: -1811812- `tool_use_input_max_bytes: optional number`813814  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.815816  default: 10000, maximum: 2147483647, minimum: -1817818#### Headers819820- `"x-api-key": optional string`821822#### Returns823824- `data: array of object`825826  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.827828  - `id: string`829830    Unique identifier for the message, e.g. `csev_abc123`831832  - `content: array of Text or ToolUse or ToolResult`833834    Content blocks within the message835836    - `Text object`837838      Text content block.839840      - `type: "text"`841842        default: text843844      - `text: string`845846        Text content from the user or the assistant847848      - `truncated: boolean`849850        True when `text` exceeded the server-defined maximum (approximately 1 MiB) and was shortened.851852        default: false853854    - `ToolUse object`855856      Tool invocation requested by the assistant.857858      - `type: "tool_use"`859860        default: tool_use861862      - `id: string or null`863864        Tool-use ID, e.g. 'toolu_01AbC...'865866      - `input: string`867868        Arguments passed to the tool, as a JSON-encoded string. May be shortened — see the `truncated` field869870      - `name: string`871872        Name of the tool invoked873874      - `truncated: boolean`875876        True when `input` was shortened. Pass `tool_use_input_max_bytes=-1` to request full content, subject to the server-side maximum.877878        default: false879880    - `ToolResult object`881882      Result returned by a tool invocation.883884      - `type: "tool_result"`885886        default: tool_result887888      - `content: array of object`889890        Text content returned by the tool. Non-text item types are omitted.891892        - `type: "text"`893894          default: text895896        - `text: string`897898          Text returned by the tool899900      - `is_error: boolean`901902        True when the tool reported an error903904      - `name: string`905906        Name of the tool that produced this result907908      - `tool_use_id: string or null`909910        ID of the tool_use block this result responds to911912      - `truncated: boolean`913914        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.915916        default: false917918  - `content_unavailable: boolean`919920    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'.921922    default: false923924  - `created_at: string`925926    When the message was recorded (RFC 3339, UTC)927928    format: date-time929930  - `role: "assistant" or "user"`931932    Message sender (`user` or `assistant`)933934    - `"assistant"`935936    - `"user"`937938  - `sent_by_user_id: string or null`939940    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`.941942- `next_page: string or null`943944  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.945946- `session: object`947948  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.949950  - `id: string`951952    Remote session identifier953954  - `agent_id: string or null`955956    Identifier of the automated agent that owns the session. Null for user-owned sessions. At most one of `user` and `agent_id` is set.957958  - `claude_project_id: string or null`959960    ID of the project the session is bound to. Null when the session has no project binding.961962  - `created_at: string`963964    When the session was created (RFC 3339, UTC)965966    format: date-time967968  - `organization_uuid: string`969970    UUID of the organization the session belongs to971972  - `product_surface: string or null`973974    The Claude product the session was created from. Currently `cowork_remote`, for Cowork sessions started on claude.ai web or mobile. 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.975976  - `started_by_user: object or null`977978    A user associated with a remote session.979980    - `id: string`981982      User identifier983984    - `email_address: string or null`985986      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.987988  - `status: string`989990    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.991992  - `updated_at: string`993994    When the session was last modified (RFC 3339, UTC)995996    format: date-time997998  - `user: object or null`9991000    A user associated with a remote session.10011002    - `id: string`10031004      User identifier10051006    - `email_address: string or null`10071008      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.10091010#### Example10111012```bash1013curl https://api.anthropic.com/v1/compliance/apps/sessions/remote/$CLAUDE_REMOTE_SESSION_ID/messages \1014    -H 'anthropic-version: 2023-06-01' \1015    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"1016```10171018##### Response (200)10191020```json1021{1022  "data": [1023    {1024      "id": "id",1025      "content": [1026        {1027          "text": "text",1028          "truncated": true,1029          "type": "text"1030        }1031      ],1032      "content_unavailable": true,1033      "created_at": "2019-12-27T18:11:19.117Z",1034      "role": "assistant",1035      "sent_by_user_id": "sent_by_user_id"1036    }1037  ],1038  "next_page": "next_page",1039  "session": {1040    "id": "id",1041    "agent_id": "agent_id",1042    "claude_project_id": "claude_project_id",1043    "created_at": "2019-12-27T18:11:19.117Z",1044    "organization_uuid": "organization_uuid",1045    "product_surface": "product_surface",1046    "started_by_user": {1047      "id": "id",1048      "email_address": "email_address"1049    },1050    "status": "status",1051    "updated_at": "2019-12-27T18:11:19.117Z",1052    "user": {1053      "id": "id",1054      "email_address": "email_address"1055    }1056  }1057}1058```1059
Files main
Menu

Theme