AI · GraphQL query

aiThreads query

Lists the caller's AI chat threads in an organization that contain at least one message, most recently updated first. Each entry carries the thread id and timestamps only; load a thread's messages with aiThread. When the caller has no general-purpose thread yet, one is created and included, so the result can hold one more thread than limit.

Response

Returns an AiThreadPayload!

Arguments

Name Description
orgId - OrganizationId! The Organization identifier.
limit - Int Limits the amount of threads returned. Optional, a value of 0 is unlimited.

Example

Query

query aiThreads(
  $orgId: OrganizationId!,
  $limit: Int
) {
  aiThreads(
    orgId: $orgId,
    limit: $limit
  ) {
    threads {
      id
      name
      threadType
      objectId
      entries {
        ...AiThreadEntryFragment
      }
      timestamp
    }
  }
}

Variables

{
  "orgId": "615f3b3b28284380e28a7342",
  "limit": 123
}

Response

{"data": {"aiThreads": {"threads": [AiThread]}}}

Related operations

  • aiThread query: Retrieves one of the caller's AI chat threads with its messages.
  • aiThreadClear query: Removes every message from one of the caller's AI chat threads and returns the now-empty thread.
  • aiThreadCreate query: Creates an AI chat thread of the requested type, or returns the existing one: a thread id is derived from the user, organization, thread type,…