---
title: "Retrieve previous AI chats"
method: GET
path: "/v1/org/{orgId}/ai/chat"
tags: ["ai"]
---

# Retrieve previous AI chats

`GET /v1/org/{orgId}/ai/chat`

## Path parameters

- `orgId` string, required

## Query parameters

- `userId` string
- `agentUserId` string
- `fromAt` string
- `untilAt` string
- `from` string
- `limit` integer
- `sort` string
- `returnAccess` string

## Response `200`

successful operation

- ResultsAiChat
  - `data` AiChat[], required
    - `id` string, required — globally unique id
    - `orgId` string, required — parent organization id
    - `type` 'OWNER' | 'INTERNAL' | 'STAFF' | 'CUSTOMER' | 'DEMO' | 'TEST', required — the type of the chat
    - `mode` 'CHAT' | 'AUTO', required — the mode of the chat -- CHAT is an interactive chat, while AUTO is an autonomous action
    - `userId` string, required — user id who initiated the chat
    - `agentUserId` string, required — AI agent user id who is participating in the chat
    - `behalfUserId` string — user id this chat was created on behalf of, when an agent initiated it (userId is then the initiating agent)
    - `modelId` string — model that was used in the chat
    - `aiPromptId` string — prompt id that was used in the chat
    - `actionId` string — action that triggered the chat, if autonomous action
    - `actionStepId` string — action step id that triggered the chat, if autonomous action
    - `label` string — label for the chat (defaults to the first question asked)
    - `feedbackScore` integer — feedback score for the chat
    - `shareAccess` ShareAccess[], required — users who are specifically granted permission to view or edit this chat
      - `access` 'NONE' | 'LIMITED_READ' | 'LIMITED_WRITE' | 'STANDARD_READ' | 'STANDARD_WRITE' | 'COMPENSATION_READ' | 'FULL_READ' | 'COMP_PLANNING_PARTICIPANT' | 'COMPENSATION_WRITE' | 'WRITE' | 'COMPENSATION_OWNER' | 'OWNER', required — access permission level
      - `userId` string — user id
      - `groupId` string — group id
      - `fields` string — fields
    - `systemPrompts` string[] — system prompts used (stable prefix; eligible for prompt caching across turns)
    - `messages` AiChatMessage[] — transcript of the messages
      - `id` string, required
      - `userId` string
      - `userName` string
      - `externalUserId` string
      - `externalId` string
      - `blocks` AiChatMessageBlock[], required
        - `dataContextMessage` string
        - `contextMessage` string
        - `message` string
        - `toolUse` AiToolUse
          - `toolUseId` string, required
          - `name` string, required
          - `input` object, required
          - `entity` AiToolEntity
            - `id` string, required
            - `label` string, required
            - `imagePath` string
            - `entityType` string
          - `summary` string
          - `readOnly` boolean
        - `toolResult` AiToolResult
          - `toolUseId` string, required
          - `success` boolean, required
          - `outputText` string
          - `outputJson` object
          - `outputCsv` TabularData
            - `columnNames` string[], required
            - `rows` object[], required
              - …
            - `totalRow` object
            - `date` string, date
            - `next` string
          - `navigateUrl` string, uri
          - `actionButton` AiToolActionButton
            - `label` string, required
            - `url` string, uri, required
            - `iconUrl` string, uri
          - `userRejected` boolean
          - `userRejectedReason` string
          - `hintIds` string[]
      - `at` string, required
      - `latencyMs` integer
      - `inputTokenCount` integer
      - `outputTokenCount` integer
      - `cacheReadInputTokenCount` integer
      - `cacheWriteInputTokenCount` integer
      - `feedbackScore` integer
      - `feedbackText` string
      - `actionButtons` AiToolActionButton[]
        - `label` string, required
        - `url` string, uri, required
        - `iconUrl` string, uri
      - `fileIds` string[]
    - `messageCount` integer — number of messages in the chat
    - `totalMessageCount` integer — number of messages in the chat, including tool usage
    - `summary` AiChatSummary
      - `title` string, required
      - `summary` string, required
      - `keywords` string[], required
      - `usecase` string, required
      - `safetyScore` integer
      - `complexityScore` integer
      - `uniqueScore` integer
      - `successScore` integer
      - `improvements` string
      - `toolsNeeded` string
      - `safetyRisks` string
      - `at` string, required
    - `inputTokenCount` integer — number of input tokens used
    - `outputTokenCount` integer — number of output tokens used
    - `cacheReadInputTokenCount` integer — number of cached input tokens read from the prompt cache
    - `cacheWriteInputTokenCount` integer — number of input tokens written to the prompt cache
    - `creditCount` number — number of AI credits consumed by this chat
    - `dataContextType` 'ASSESSMENT' | 'ASSESSMENT_CALIBRATE' | 'COMP_REVIEW' | 'PERSON_COMMON' | 'DASHBOARD' | 'FORM_COMPLETE' | 'GOAL' | 'SCENARIO' | 'SCENARIO_IMPACT' | 'TRANSCRIPT' | 'PROCESS_LOG' — data context used for this chat
    - `toolsAvailable` string[] — list of tools that were available in this chat
    - `readOnly` boolean — whether tool use in this chat is constrained to read-only tools
    - `toolsUsed` string[] — list of tools that were used in this chat
    - `providedHintIds` string[] — set of AI hint IDs that have been provided to this chat
    - `pendingToolUseIds` string[] — tool use IDs currently pending approval, used for idempotent approval
    - `pendingToolUseAt` string — timestamp when the pending tool uses were proposed, used for expiration
    - `channel` AiChatChannel
      - `type` 'WEB' | 'MOBILE' | 'SLACK' | 'TEAMS' | 'MCP', required
      - `externalId` string
      - `threadId` string
      - `name` string
    - `createAt` string — created timestamp
    - `updateAt` string — last-updated timestamp
    - `deleteId` string — deleted by user id
    - `deleteAt` string — deleted timestamp
  - `next` string
  - `access` ResultsAccess[]
    - `ids` string[]
    - `allowed` AccessAction[], required
      - `action` string, required
      - `fields` string[]
      - `types` string[]

## Other responses

- `400` — invalid data
- `401` — not authorized
- `403` — permission denied
- `404` — not found

---

[API](https://skmtc.net/charthop/apis/charthop-api.md) · [All operations](https://skmtc.net/charthop/apis/charthop-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/charthop/charthop-api/revisions/50a1edd6b27e/schema)
