---
title: aiThreads query | Wartiva GraphQL API
description: Lists the caller's AI chat threads in an organization that contain at least one message, most recently updated first.
url: https://wartiva.com/api-docs/queries/ai-threads.html
updated: 2026-10-07
---

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](https://wartiva.com/api-docs/queries/ai-thread.html). 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!`](https://wartiva.com/api-docs/types/ai-thread-payload.html)

## Arguments

| Name | Description |
|---|---|
| `orgId` - [`OrganizationId!`](https://wartiva.com/api-docs/types/organization-id.html) | The Organization identifier. |
| `limit` - [`Int`](https://wartiva.com/api-docs/types/int.html) | Limits the amount of threads returned. Optional, a value of 0 is unlimited. |

## Example

### Query

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

```

### Variables

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

```

### Response

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

```

## Related operations

- [`aiThread`](https://wartiva.com/api-docs/queries/ai-thread.html) query: Retrieves one of the caller's AI chat threads with its messages.
- [`aiThreadClear`](https://wartiva.com/api-docs/queries/ai-thread-clear.html) query: Removes every message from one of the caller's AI chat threads and returns the now-empty thread.
- [`aiThreadCreate`](https://wartiva.com/api-docs/queries/ai-thread-create.html) 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,…

---

Wartiva is in early access. Request access: https://wartiva.com/early-access.html  
All pages: https://wartiva.com/llms.txt
