Repository Public
1---2title: Messages3url: https://platform.claude.com/docs/en/api/compliance/apps/chats/messages4---56# Messages78## Get chat messages910**GET** `/v1/compliance/apps/chats/{claude_chat_id}/messages`1112Retrieves message history and file metadata for a specific chat.1314### Path parameters1516- `claude_chat_id: string`1718 The chat ID (tagged ID, e.g., claude_chat_abc123)1920### Query parameters2122- `after_id: optional string`2324 Pagination cursor for retrieving the next page of results. To paginate, pass the `last_id` value from the most recent response. 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.2526- `before_id: optional string`2728 Pagination cursor for retrieving the previous page of results. To paginate, pass the `first_id` value from the most recent response. 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.2930- `created_at: optional object`3132 - `gt: optional string`3334 Filter messages created after this time (RFC 3339 format)3536 format: date-time3738 - `gte: optional string`3940 Filter messages created at or after this time (RFC 3339 format)4142 format: date-time4344 - `lt: optional string`4546 Filter messages created before this time (RFC 3339 format)4748 format: date-time4950 - `lte: optional string`5152 Filter messages created at or before this time (RFC 3339 format)5354 format: date-time5556- `limit: optional number`5758 Maximum results (max: 1000). When omitted, the full result set is returned in one response.5960 maximum: 1000, minimum: 16162- `order: optional "asc" or "desc"`6364 Sort direction for messages within the response. `asc` (the default) returns oldest-first; `desc` returns newest-first.6566 default: asc6768 - `"asc"`6970 - `"desc"`7172- `tool_result_max_chars: optional number`7374 Maximum characters returned per tool-result text item. Items longer than this are shortened and the block's `truncated` field is set. Pass -1 to disable the limit.7576 default: 10000, minimum: -17778- `tool_use_input_max_chars: optional number`7980 Maximum characters of JSON-encoded tool input returned per tool_use block. Inputs longer than this are shortened and the block's `truncated` field is set. Pass -1 to disable the limit.8182 default: 10000, minimum: -18384- `updated_at: optional object`8586 - `gt: optional string`8788 Filter messages updated after this time (RFC 3339 format)8990 format: date-time9192 - `gte: optional string`9394 Filter messages updated at or after this time (RFC 3339 format)9596 format: date-time9798 - `lt: optional string`99100 Filter messages updated before this time (RFC 3339 format)101102 format: date-time103104 - `lte: optional string`105106 Filter messages updated at or before this time (RFC 3339 format)107108 format: date-time109110### Headers111112- `"x-api-key": optional string`113114### Returns115116- `id: string`117118 Chat ID119120- `chat_messages: array of object`121122 Array of chat messages in order of created_at123124 - `id: string`125126 Unique identifier for the message e.g. 'claude_chat_msg_abcd1234'127128 - `artifacts: array of object or null`129130 Versioned documents generated or updated by the assistant in this message. Download via `GET /v1/compliance/apps/artifacts/{artifact_version_id}/content`.131132 - `id: string`133134 Artifact ID e.g. 'claude_artifact_abc123'135136 - `artifact_type: string or null`137138 MIME-like artifact type e.g. 'application/vnd.ant.code'139140 - `title: string or null`141142 Artifact title143144 - `version_id: string`145146 Artifact version ID e.g. 'claude_artifact_version_abc123'147148 - `content: array of Text or ToolUse or ToolResult`149150 Content blocks within the message151152 - `Text object`153154 Text content block.155156 - `type: "text"`157158 default: text159160 - `text: string`161162 Text content from human or assistant163164 - `thinking_redacted: boolean`165166 True when content enclosed in the assistant's internal-reasoning tags (or the tag markup itself) was removed from `text` during export. Removal never occurs with this field false. Always false on human messages, whose text is exported verbatim.167168 default: false169170 - `truncated: boolean`171172 True when `text` was shortened by the server's fixed per-string bound (1 MiB). Always false on chat text blocks.173174 default: false175176 - `ToolUse object`177178 Tool invocation requested by the assistant.179180 - `type: "tool_use"`181182 default: tool_use183184 - `id: string or null`185186 Tool-use ID, e.g. 'toolu_01AbC...'187188 - `input: string`189190 Arguments passed to the tool, as a JSON-encoded string. May be shortened — see the `truncated` field191192 - `integration_name: string or null`193194 Name of the integration that provides this tool, when applicable195196 - `mcp_server_url: string or null`197198 Base URL (scheme, host, and path only) of the MCP server that provides this tool, when applicable199200 - `name: string`201202 Name of the tool invoked203204 - `truncated: boolean`205206 True when `input` was shortened. Pass the endpoint's tool-use input max parameter as -1 to request full content, subject to any server-side maximum the endpoint enforces.207208 default: false209210 - `ToolResult object`211212 Result returned by a tool invocation.213214 - `type: "tool_result"`215216 default: tool_result217218 - `content: array of object`219220 Text content returned by the tool. Generated files are surfaced via the message's `generated_files` list; other non-text item types (including images and links) are omitted.221222 - `type: "text"`223224 default: text225226 - `text: string`227228 Text returned by the tool229230 - `integration_name: string or null`231232 Name of the integration that provides this tool, when applicable233234 - `is_error: boolean`235236 True when the tool reported an error237238 - `mcp_server_url: string or null`239240 Base URL (scheme, host, and path only) of the MCP server that provides this tool, when applicable241242 - `name: string`243244 Name of the tool that produced this result245246 - `tool_use_id: string or null`247248 ID of the tool_use block this result responds to249250 - `truncated: boolean`251252 True when one or more text items in `content` were shortened. Pass the endpoint's tool-result max parameter as -1 to request full content, subject to any server-side maximum the endpoint enforces.253254 default: false255256 - `created_at: string`257258 Message creation timestamp - For human: when they sent the message, For assistant: when it completed the last content block259260 format: date-time261262 - `files: array of object or null`263264 Binary file attachments uploaded by the user. Download via `GET /v1/compliance/apps/chats/files/{claude_file_id}/content`.265266 - `id: string`267268 File ID269270 - `created_at: string`271272 File creation timestamp273274 format: date-time275276 - `filename: string`277278 Display name of the file279280 - `md5: string or null`281282 Lowercase hex MD5 of the file's preferred downloadable variant, as recorded at upload time. Null when no stored hash is available.283284 - `mime_type: string or null`285286 MIME type of the file's preferred downloadable variant (e.g. 'application/pdf')287288 - `size_bytes: number or null`289290 Size in bytes of the file's preferred downloadable variant, if known. Null for older files uploaded before size was recorded.291292 - `generated_files: array of object or null`293294 Downloadable files the assistant created via tool use (e.g. PDF, spreadsheet, slide deck). Distinct from `files`, which are uploads attached to the message. Download via `GET /v1/compliance/apps/chats/generated-files/{claude_gen_file_id}/content`.295296 - `id: string`297298 Opaque generated-file id, e.g. 'claude_gen_file_abc123'. Treat as an opaque string; the encoding may change without notice.299300 - `filename: string`301302 Display name of the generated file303304 - `md5: string or null`305306 Lowercase hex MD5 of the generated file, when available. Null when no stored hash is available.307308 - `mime_type: string or null`309310 MIME type reported by the tool that produced the file311312 - `size_bytes: number or null`313314 Size in bytes of the generated file, when available. Null when the file has expired or size is not recorded.315316 - `role: "assistant" or "user"`317318 Message sender (user or assistant)319320 - `"assistant"`321322 - `"user"`323324- `created_at: string`325326 Creation timestamp327328 format: date-time329330- `deleted_at: string or null`331332 Deletion timestamp if deleted333334 format: date-time335336- `first_id: string or null`337338 Opaque pagination cursor for the first message in the current result set. Pass as `before_id` on the next request to page backwards. 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.339340- `has_more: boolean`341342 Whether more chat messages exist beyond the current result set. Use `last_id` as `after_id` in a follow-up request to page forward.343344 default: false345346- `href: string`347348 URL to view this chat in claude.ai349350- `last_id: string or null`351352 Opaque pagination cursor for the last message in the current result set. Pass as `after_id` on the next request to page forwards. 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.353354- `model: string or null`355356 Model selected for this chat (e.g. 'claude-opus-5'). May be null for legacy chats that never had a model recorded.357358- `name: string`359360 Chat name361362- `organization_uuid: string`363364 Organization UUID this chat belongs to365366- `project_id: string or null`367368 Project ID this chat belongs to369370- `updated_at: string`371372 Last update timestamp373374 format: date-time375376- `user: object or null`377378 The user who created the chat.379380 Null when the API key is restricted to one organization and the creator381 is no longer a member of it (for example, after they were removed from382 it).383384 A key for the whole parent organization returns the creator's `id`385 and current `email_address` for every chat; on the list endpoint, pass386 `organization_ids[]` to keep the results to one organization. For the387 email address the creator had when the chat was created, query388 `GET /v1/compliance/activities` with `activity_types[]=claude_chat_created`389 and a `created_at` window around the chat's `created_at`, find the event390 whose `claude_chat_id` matches this chat's `id`, and read391 `actor.email_address`. These events exist only for chats created after392 compliance logging was enabled for the organization.393394 - `id: string`395396 User identifier397398 - `email_address: string`399400 User's email address401402- `organization_id: string`403404 **Deprecated**405406 Organization ID this chat belongs to407408### Example409410```bash411curl https://api.anthropic.com/v1/compliance/apps/chats/$CLAUDE_CHAT_ID/messages \412 -H 'anthropic-version: 2023-06-01' \413 -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"414```415416#### Response (200)417418```json419{420 "id": "claude_chat_abc123",421 "name": "Product Requirements Discussion",422 "created_at": "2025-06-07T08:09:10Z",423 "updated_at": "2025-06-07T08:09:11Z",424 "organization_id": "org_abc123",425 "organization_uuid": "abcdef01-2345-6789-abcd-ef0123456789",426 "project_id": "claude_proj_xyz789",427 "model": "claude-opus-5",428 "user": {429 "id": "user_xyz456",430 "email_address": "user@example.com"431 },432 "href": "https://claude.ai/chat/abcdef01-2345-6789-abcd-ef0123456789",433 "chat_messages": [434 {435 "id": "claude_chat_msg_abc123",436 "role": "user",437 "created_at": "2025-06-07T08:09:10Z",438 "content": [439 {440 "type": "text",441 "text": "Can you help me draft requirements for our new dashboard feature?"442 }443 ],444 "files": [445 {446 "id": "claude_file_xyz789",447 "filename": "dashboard_mockup_v1.pdf",448 "mime_type": "application/pdf",449 "size_bytes": 12345,450 "md5": "5d41402abc4b2a76b9719d911017c592",451 "created_at": "2025-06-07T08:09:10Z"452 }453 ]454 },455 {456 "id": "claude_chat_msg_def456",457 "role": "assistant",458 "created_at": "2025-06-07T08:09:11Z",459 "content": [460 {461 "type": "text",462 "text": "I'd be happy to help you draft requirements for your dashboard feature..."463 }464 ],465 "artifacts": [466 {467 "id": "claude_artifact_abc123",468 "version_id": "claude_artifact_version_xyz789",469 "title": "Dashboard Requirements Draft",470 "artifact_type": "text/markdown"471 }472 ]473 }474 ],475 "has_more": false,476 "first_id": "eyJtc2dfdXVpZCI6ICIwZjcwYjA2Ni0uLi4ifQ==",477 "last_id": "eyJtc2dfdXVpZCI6ICJhNGUwYjE3Mi0uLi4ifQ=="478}479```480481## Domain types482483### Message List Response484485- `MessageListResponse object`486487 A single message in a chat conversation.488489 - `id: string`490491 Unique identifier for the message e.g. 'claude_chat_msg_abcd1234'492493 - `artifacts: array of object or null`494495 Versioned documents generated or updated by the assistant in this message. Download via `GET /v1/compliance/apps/artifacts/{artifact_version_id}/content`.496497 - `id: string`498499 Artifact ID e.g. 'claude_artifact_abc123'500501 - `artifact_type: string or null`502503 MIME-like artifact type e.g. 'application/vnd.ant.code'504505 - `title: string or null`506507 Artifact title508509 - `version_id: string`510511 Artifact version ID e.g. 'claude_artifact_version_abc123'512513 - `content: array of Text or ToolUse or ToolResult`514515 Content blocks within the message516517 - `Text object`518519 Text content block.520521 - `type: "text"`522523 default: text524525 - `text: string`526527 Text content from human or assistant528529 - `thinking_redacted: boolean`530531 True when content enclosed in the assistant's internal-reasoning tags (or the tag markup itself) was removed from `text` during export. Removal never occurs with this field false. Always false on human messages, whose text is exported verbatim.532533 default: false534535 - `truncated: boolean`536537 True when `text` was shortened by the server's fixed per-string bound (1 MiB). Always false on chat text blocks.538539 default: false540541 - `ToolUse object`542543 Tool invocation requested by the assistant.544545 - `type: "tool_use"`546547 default: tool_use548549 - `id: string or null`550551 Tool-use ID, e.g. 'toolu_01AbC...'552553 - `input: string`554555 Arguments passed to the tool, as a JSON-encoded string. May be shortened — see the `truncated` field556557 - `integration_name: string or null`558559 Name of the integration that provides this tool, when applicable560561 - `mcp_server_url: string or null`562563 Base URL (scheme, host, and path only) of the MCP server that provides this tool, when applicable564565 - `name: string`566567 Name of the tool invoked568569 - `truncated: boolean`570571 True when `input` was shortened. Pass the endpoint's tool-use input max parameter as -1 to request full content, subject to any server-side maximum the endpoint enforces.572573 default: false574575 - `ToolResult object`576577 Result returned by a tool invocation.578579 - `type: "tool_result"`580581 default: tool_result582583 - `content: array of object`584585 Text content returned by the tool. Generated files are surfaced via the message's `generated_files` list; other non-text item types (including images and links) are omitted.586587 - `type: "text"`588589 default: text590591 - `text: string`592593 Text returned by the tool594595 - `integration_name: string or null`596597 Name of the integration that provides this tool, when applicable598599 - `is_error: boolean`600601 True when the tool reported an error602603 - `mcp_server_url: string or null`604605 Base URL (scheme, host, and path only) of the MCP server that provides this tool, when applicable606607 - `name: string`608609 Name of the tool that produced this result610611 - `tool_use_id: string or null`612613 ID of the tool_use block this result responds to614615 - `truncated: boolean`616617 True when one or more text items in `content` were shortened. Pass the endpoint's tool-result max parameter as -1 to request full content, subject to any server-side maximum the endpoint enforces.618619 default: false620621 - `created_at: string`622623 Message creation timestamp - For human: when they sent the message, For assistant: when it completed the last content block624625 format: date-time626627 - `files: array of object or null`628629 Binary file attachments uploaded by the user. Download via `GET /v1/compliance/apps/chats/files/{claude_file_id}/content`.630631 - `id: string`632633 File ID634635 - `created_at: string`636637 File creation timestamp638639 format: date-time640641 - `filename: string`642643 Display name of the file644645 - `md5: string or null`646647 Lowercase hex MD5 of the file's preferred downloadable variant, as recorded at upload time. Null when no stored hash is available.648649 - `mime_type: string or null`650651 MIME type of the file's preferred downloadable variant (e.g. 'application/pdf')652653 - `size_bytes: number or null`654655 Size in bytes of the file's preferred downloadable variant, if known. Null for older files uploaded before size was recorded.656657 - `generated_files: array of object or null`658659 Downloadable files the assistant created via tool use (e.g. PDF, spreadsheet, slide deck). Distinct from `files`, which are uploads attached to the message. Download via `GET /v1/compliance/apps/chats/generated-files/{claude_gen_file_id}/content`.660661 - `id: string`662663 Opaque generated-file id, e.g. 'claude_gen_file_abc123'. Treat as an opaque string; the encoding may change without notice.664665 - `filename: string`666667 Display name of the generated file668669 - `md5: string or null`670671 Lowercase hex MD5 of the generated file, when available. Null when no stored hash is available.672673 - `mime_type: string or null`674675 MIME type reported by the tool that produced the file676677 - `size_bytes: number or null`678679 Size in bytes of the generated file, when available. Null when the file has expired or size is not recorded.680681 - `role: "assistant" or "user"`682683 Message sender (user or assistant)684685 - `"assistant"`686687 - `"user"`688