Compliance API - Chats Endpoints

Trust: ★★★☆☆ (0.90) · 0 validations · developer_reference

Published: 2026-05-10 · Source: crawler_authoritative

Tình huống

API reference for compliance Reviews of Claude chat data, covering chat listing, deletion, message retrieval, and file operations.

Insight

The Compliance API provides three primary chat operations: List, Delete, and Messages retrieval. The List endpoint (GET /v1/compliance/apps/chats) requires 1-10 user_ids as a required parameter and supports pagination via after_id/before_id opaque cursor strings derived from last_id/first_id values. Filters include created_at and updated_at with RFC 3339 datetime ranges using gt/gte/lt/lte operators, plus organization_ids (accepts org_… or UUID) and project_ids (accepts claude_proj_…). Default limit is 100, maximum is 1000. Results are sorted chronologically by created_at with id as tiebreaker.

Chat metadata returned includes: id, created_at, deleted_at, href (claude.ai URL), model (e.g. ‘claude-opus-4-7’, may be null for legacy chats), name, organization_id, organization_uuid, project_id, updated_at, and user object with id and email_address.

The Delete endpoint (DELETE /v1/compliance/apps/chats/{claude_chat_id}) permanently removes a chat and all associated messages and files—this is destructive and irreversible. Returns id and type: “claude_chat_deleted”.

The Messages endpoint (GET /v1/compliance/apps/chats/{claude_chat_id}/messages) retrieves full conversation history. Messages array contains: id (e.g. ‘claude_chat_msg_abcd1234’), artifacts (with id, artifact_type like ‘application/vnd.ant.code’, title, version_id), content array with text/type blocks, created_at timestamp, files (id, filename, mime_type like ‘application/pdf’), generated_files from assistant tool use (e.g. PDF, spreadsheet, slides with id, filename, mime_type), and role (‘user’ or ‘assistant’). Without a limit parameter, full result set is returned.

File operations include: GET /v1/compliance/apps/chats/files/{claude_file_id} for metadata (id, created_at, filename, message_ids array, mime_type, size_bytes), DELETE for permanent deletion, and GET /content for binary download. Generated files (created by assistant via tool use) are accessed via /v1/compliance/apps/chats/generated-files/{claude_gen_file_id}/content using IDs from chat_messages[].generated_files[].id.

All endpoints accept optional x-api-key header and Authorization Bearer token in examples.

Hành động

To list chats: Make GET request to /v1/compliance/apps/chats with required user_ids array (1-10 IDs). Use after_id or before_id from previous responses for pagination (treat these as opaque strings). Filter by datetime ranges using created_at or updated_at objects with gt/gte/lt/lte RFC 3339 values. Example: curl https://api.anthropic.com/v1/compliance/apps/chats -H “Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY”.

To delete a chat: Send DELETE to /v1/compliance/apps/chats/{claude_chat_id} where claude_chat_id is the tagged ID (e.g., claude_chat_abc123). This permanently deletes the chat and all messages/files—cannot be undone.

To retrieve messages: GET /v1/compliance/apps/chats/{claude_chat_id}/messages with optional limit (max 1000) and pagination cursors. The response includes full message history with artifacts, file attachments, and generated files.

To get file metadata: GET /v1/compliance/apps/chats/files/{claude_file_id}. To download file content: GET /v1/compliance/apps/chats/files/{claude_file_id}/content. To download assistant-generated files: GET /v1/compliance/apps/chats/generated-files/{claude_gen_file_id}/content using IDs from message responses.

Kết quả

List chats returns paginated ChatListResponse with data array (sorted by created_at), first_id, last_id for pagination cursors, and has_more boolean. Delete returns ChatDeleteResponse with id and type “claude_chat_deleted”. Messages returns ChatMessagesResponse with chat_messages array ordered by created_at, plus pagination cursors (first_id, last_id, has_more). File retrieve returns FileRetrieveResponse with metadata including message_ids array showing which messages reference the file. File delete returns FileDeleteResponse with id and type “claude_file_deleted”. File content returns binary data (unknown response type).

Điều kiện áp dụng

API key required via x-api-key header or Authorization Bearer token. user_ids parameter is required for list endpoint (1-10 IDs per request). Generated files are distinct from uploaded files—they are outputs from assistant tool use like PDFs or spreadsheets.


Nội dung gốc (Original)

Chats

List

get /v1/compliance/apps/chats

Lists chat metadata with filtering capabilities for targeted compliance review. Results are sorted chronologically (time ascending) by created_at, with ties broken by id.

Query Parameters

  • user_ids: array of string

    Filter to chats created by specific users. Required; pass 1–10 user IDs per request. Enumerate IDs via GET /v1/compliance/organizations/{org_uuid}/users.

  • after_id: optional string

    Pagination cursor for retrieving the next page of results (heading backwards in time). 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.

  • before_id: optional string

    Pagination cursor for retrieving the previous page of results (heading forwards in time). 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.

  • created_at: optional object { gt, gte, lt, lte }

    • gt: optional string

      Filter chats created after this time (RFC 3339 format)

    • gte: optional string

      Filter chats created at or after this time (RFC 3339 format)

    • lt: optional string

      Filter chats created before this time (RFC 3339 format)

    • lte: optional string

      Filter chats created at or before this time (RFC 3339 format)

  • limit: optional number

    Maximum results (default: 100, max: 1000)

  • organization_ids: optional array of string

    Filter by organization IDs (accepts org_... or organization UUID). Enumerate IDs via GET /v1/compliance/organizations.

  • project_ids: optional array of string

    Filter by project IDs (accepts claude_proj_...). Enumerate IDs via GET /v1/compliance/apps/projects.

  • updated_at: optional object { gt, gte, lt, lte }

    • gt: optional string

      Filter chats updated after this time (RFC 3339 format)

    • gte: optional string

      Filter chats updated at or after this time (RFC 3339 format)

    • lt: optional string

      Filter chats updated before this time (RFC 3339 format)

    • lte: optional string

      Filter chats updated at or before this time (RFC 3339 format)

Header Parameters

  • "x-api-key": optional string

Returns

  • data: array of object { id, created_at, deleted_at, 8 more }

    List of chat metadata sorted chronologically by created_at, tie break by id

    • id: string

      Chat ID

    • created_at: string

      Creation timestamp

    • deleted_at: string

      Deletion timestamp if deleted

    • href: string

      URL to view this chat in claude.ai

    • model: string

      Model selected for this chat (e.g. ‘claude-opus-4-7’). May be null for legacy chats that never had a model recorded.

    • name: string

      Chat name/title

    • organization_id: string

      Organization ID this chat belongs to

    • organization_uuid: string

      Organization UUID this chat belongs to

    • project_id: string

      Project ID this chat belongs to

    • updated_at: string

      Last update timestamp

    • user: object { id, email_address }

      User information for the chat creator

      • id: string

        User identifier

      • email_address: string

        User’s email address

  • first_id: string

    First chat ID in the current result set. To get the previous page, use this as before_id in your next request

  • has_more: boolean

    Whether more records exist beyond the current result set

  • last_id: string

    Last chat ID in the current result set. To get the next page, use this as after_id in your next request

Example

curl https://api.anthropic.com/v1/compliance/apps/chats \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Delete

delete /v1/compliance/apps/chats/{claude_chat_id}

Permanently deletes a chat and all associated messages and files. This is a destructive operation that cannot be undone.

Path Parameters

  • claude_chat_id: string

    The chat ID (tagged ID, e.g., claude_chat_abc123)

Header Parameters

  • "x-api-key": optional string

Returns

  • id: string

    The ID of the Claude chat that was deleted

  • type: optional "claude_chat_deleted"

    Constant string confirming deletion

    • "claude_chat_deleted"

Example

curl https://api.anthropic.com/v1/compliance/apps/chats/$CLAUDE_CHAT_ID \
    -X DELETE \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Messages

get /v1/compliance/apps/chats/{claude_chat_id}/messages

Retrieves message history and file metadata for a specific chat.

Path Parameters

  • claude_chat_id: string

    The chat ID (tagged ID, e.g., claude_chat_abc123)

Query Parameters

  • after_id: optional string

    Pagination cursor for retrieving the next page of results (heading backwards in time). 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.

  • before_id: optional string

    Pagination cursor for retrieving the previous page of results (heading forwards in time). 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.

  • limit: optional number

    Maximum results (max: 1000). When omitted, the full result set is returned in one response.

Header Parameters

  • "x-api-key": optional string

Returns

  • id: string

    Chat ID

  • chat_messages: array of object { id, artifacts, content, 4 more }

    Array of chat messages in order of created_at

    • id: string

      Unique identifier for the message e.g. ‘claude_chat_msg_abcd1234’

    • artifacts: array of object { id, artifact_type, title, version_id }

      Artifacts generated or updated by this message

      • id: string

        Artifact ID e.g. ‘claude_artifact_abc123’

      • artifact_type: string

        MIME-like artifact type e.g. ‘application/vnd.ant.code’

      • title: string

        Artifact title

      • version_id: string

        Artifact version ID e.g. ‘claude_artifact_version_abc123’

    • content: array of object { text, type }

      Content blocks within the message

      • text: string

        Text content from human or assistant

      • type: "text"

        • "text"
    • created_at: string

      Message creation timestamp - For human: when they sent the message, For assistant: when it completed the last content block

    • files: array of object { id, filename, mime_type }

      File attachments

      • id: string

        File ID

      • filename: string

        Display name of the file

      • mime_type: string

        MIME type of the file when it was uploaded (e.g. ‘application/pdf’)

    • generated_files: array of object { id, filename, mime_type }

      Downloadable files the assistant created via tool use (e.g. PDF, spreadsheet, slide deck). Distinct from files, which are uploads attached to the message.

      • id: string

        Opaque generated-file id, e.g. ‘claude_gen_file_abc123’. Treat as an opaque string; the encoding may change without notice.

      • filename: string

        Display name of the generated file

      • mime_type: string

        MIME type reported by the tool that produced the file

    • role: "user" or "assistant"

      Message sender (user or assistant)

      • "user"

      • "assistant"

  • created_at: string

    Creation timestamp

  • deleted_at: string

    Deletion timestamp if deleted

  • first_id: string

    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.

  • has_more: boolean

    Whether more chat messages exist beyond the current result set. Use last_id as after_id in a follow-up request to page forward.

  • href: string

    URL to view this chat in claude.ai

  • last_id: string

    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.

  • model: string

    Model selected for this chat (e.g. ‘claude-opus-4-7’). May be null for legacy chats that never had a model recorded.

  • name: string

    Chat name

  • organization_id: string

    Organization ID this chat belongs to

  • organization_uuid: string

    Organization UUID this chat belongs to

  • project_id: string

    Project ID this chat belongs to

  • updated_at: string

    Last update timestamp

  • user: object { id, email_address }

    User information

    • id: string

      User identifier

    • email_address: string

      User’s email address

Example

curl https://api.anthropic.com/v1/compliance/apps/chats/$CLAUDE_CHAT_ID/messages \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Domain Types

Chat List Response

  • ChatListResponse = object { id, created_at, deleted_at, 8 more }

    Chat metadata for listing chats (without messages).

    • id: string

      Chat ID

    • created_at: string

      Creation timestamp

    • deleted_at: string

      Deletion timestamp if deleted

    • href: string

      URL to view this chat in claude.ai

    • model: string

      Model selected for this chat (e.g. ‘claude-opus-4-7’). May be null for legacy chats that never had a model recorded.

    • name: string

      Chat name/title

    • organization_id: string

      Organization ID this chat belongs to

    • organization_uuid: string

      Organization UUID this chat belongs to

    • project_id: string

      Project ID this chat belongs to

    • updated_at: string

      Last update timestamp

    • user: object { id, email_address }

      User information for the chat creator

      • id: string

        User identifier

      • email_address: string

        User’s email address

Chat Delete Response

  • ChatDeleteResponse = object { id, type }

    Response for deleting a Claude chat.

    • id: string

      The ID of the Claude chat that was deleted

    • type: optional "claude_chat_deleted"

      Constant string confirming deletion

      • "claude_chat_deleted"

Chat Messages Response

  • ChatMessagesResponse = object { id, chat_messages, created_at, 12 more }

    Complete chat conversation data for compliance purposes.

    • id: string

      Chat ID

    • chat_messages: array of object { id, artifacts, content, 4 more }

      Array of chat messages in order of created_at

      • id: string

        Unique identifier for the message e.g. ‘claude_chat_msg_abcd1234’

      • artifacts: array of object { id, artifact_type, title, version_id }

        Artifacts generated or updated by this message

        • id: string

          Artifact ID e.g. ‘claude_artifact_abc123’

        • artifact_type: string

          MIME-like artifact type e.g. ‘application/vnd.ant.code’

        • title: string

          Artifact title

        • version_id: string

          Artifact version ID e.g. ‘claude_artifact_version_abc123’

      • content: array of object { text, type }

        Content blocks within the message

        • text: string

          Text content from human or assistant

        • type: "text"

          • "text"
      • created_at: string

        Message creation timestamp - For human: when they sent the message, For assistant: when it completed the last content block

      • files: array of object { id, filename, mime_type }

        File attachments

        • id: string

          File ID

        • filename: string

          Display name of the file

        • mime_type: string

          MIME type of the file when it was uploaded (e.g. ‘application/pdf’)

      • generated_files: array of object { id, filename, mime_type }

        Downloadable files the assistant created via tool use (e.g. PDF, spreadsheet, slide deck). Distinct from files, which are uploads attached to the message.

        • id: string

          Opaque generated-file id, e.g. ‘claude_gen_file_abc123’. Treat as an opaque string; the encoding may change without notice.

        • filename: string

          Display name of the generated file

        • mime_type: string

          MIME type reported by the tool that produced the file

      • role: "user" or "assistant"

        Message sender (user or assistant)

        • "user"

        • "assistant"

    • created_at: string

      Creation timestamp

    • deleted_at: string

      Deletion timestamp if deleted

    • first_id: string

      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.

    • has_more: boolean

      Whether more chat messages exist beyond the current result set. Use last_id as after_id in a follow-up request to page forward.

    • href: string

      URL to view this chat in claude.ai

    • last_id: string

      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.

    • model: string

      Model selected for this chat (e.g. ‘claude-opus-4-7’). May be null for legacy chats that never had a model recorded.

    • name: string

      Chat name

    • organization_id: string

      Organization ID this chat belongs to

    • organization_uuid: string

      Organization UUID this chat belongs to

    • project_id: string

      Project ID this chat belongs to

    • updated_at: string

      Last update timestamp

    • user: object { id, email_address }

      User information

      • id: string

        User identifier

      • email_address: string

        User’s email address

Files

Retrieve

get /v1/compliance/apps/chats/files/{claude_file_id}

Retrieves metadata for a file referenced in chat messages, without downloading the file content. Use the sibling /content endpoint to download the bytes.

Path Parameters

  • claude_file_id: string

    The file ID (tagged ID, e.g., claude_file_abc123)

Header Parameters

  • "x-api-key": optional string

Returns

  • id: string

    File ID

  • created_at: string

    File creation timestamp

  • filename: string

    Display name of the file, if set

  • message_ids: array of string

    Chat message IDs this file is attached to. A file can be referenced by multiple messages.

  • mime_type: string

    MIME type of the file’s preferred downloadable variant (e.g. ‘application/pdf’). May be null for files with no downloadable content (e.g. code-interpreter outputs).

  • size_bytes: number

    Size in bytes of the file’s preferred downloadable variant, if known

Example

curl https://api.anthropic.com/v1/compliance/apps/chats/files/$CLAUDE_FILE_ID \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Delete

delete /v1/compliance/apps/chats/files/{claude_file_id}

Permanently deletes a specific file. This is a destructive operation that cannot be undone.

Path Parameters

  • claude_file_id: string

    The file ID (tagged ID, e.g., claude_file_abc123)

Header Parameters

  • "x-api-key": optional string

Returns

  • id: string

    The ID of the file that was deleted

  • type: optional "claude_file_deleted"

    Constant string confirming deletion

    • "claude_file_deleted"

Example

curl https://api.anthropic.com/v1/compliance/apps/chats/files/$CLAUDE_FILE_ID \
    -X DELETE \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Content

get /v1/compliance/apps/chats/files/{claude_file_id}/content

Downloads the binary content of a file referenced in chat messages.

Path Parameters

  • claude_file_id: string

    The file ID (tagged ID, e.g., claude_file_abc123)

Header Parameters

  • "x-api-key": optional string

Example

curl https://api.anthropic.com/v1/compliance/apps/chats/files/$CLAUDE_FILE_ID/content \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Domain Types

File Retrieve Response

  • FileRetrieveResponse = object { id, created_at, filename, 3 more }

    File metadata for GET /v1/compliance/apps/chats/files/{claude_file_id}.

    Returns metadata only. Use the sibling /content endpoint to download the file bytes.

    • id: string

      File ID

    • created_at: string

      File creation timestamp

    • filename: string

      Display name of the file, if set

    • message_ids: array of string

      Chat message IDs this file is attached to. A file can be referenced by multiple messages.

    • mime_type: string

      MIME type of the file’s preferred downloadable variant (e.g. ‘application/pdf’). May be null for files with no downloadable content (e.g. code-interpreter outputs).

    • size_bytes: number

      Size in bytes of the file’s preferred downloadable variant, if known

File Delete Response

  • FileDeleteResponse = object { id, type }

    Response for deleting a compliance file.

    • id: string

      The ID of the file that was deleted

    • type: optional "claude_file_deleted"

      Constant string confirming deletion

      • "claude_file_deleted"

File Content Response

  • FileContentResponse = unknown

Generated Files

Content

get /v1/compliance/apps/chats/generated-files/{claude_gen_file_id}/content

Downloads the binary content of a file the assistant created via tool use.

Path Parameters

  • claude_gen_file_id: string

    The generated-file id (e.g., ‘claude_gen_file_abc123’) as returned in chat_messages[].generated_files[].id from GET /apps/chats/{claude_chat_id}/messages.

Header Parameters

  • "x-api-key": optional string

Example

curl https://api.anthropic.com/v1/compliance/apps/chats/generated-files/$CLAUDE_GEN_FILE_ID/content \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"

Domain Types

Generated File Content Response

  • GeneratedFileContentResponse = unknown

Liên kết

Xem thêm: