---
title: aiThread query | Wartiva GraphQL API
description: Retrieves one of the caller's AI chat threads with its messages. Wartiva GraphQL API reference with arguments, fields, and examples.
url: https://wartiva.com/api-docs/queries/ai-thread.html
updated: 2026-10-07
---

AI · GraphQL query

# `aiThread` query

Retrieves one of the caller's AI chat threads with its messages. A thread id that has no stored thread yet returns the thread's welcome messages instead of an error. Long threads are trimmed to their most recent entries. A thread owned by another user returns an access-denied error.

## Response

Returns an [`AiThread!`](https://wartiva.com/api-docs/types/ai-thread.html)

## Arguments

| Name | Description |
|---|---|
| `threadId` - [`AiThreadId!`](https://wartiva.com/api-docs/types/ai-thread-id.html) | The thread ID. |

## Example

### Query

```graphql
query aiThread($threadId: AiThreadId!) {
  aiThread(threadId: $threadId) {
    id
    name
    threadType
    objectId
    entries {
      timestamp
      isFromUser
      message
    }
    timestamp
  }
}

```

### Variables

```json
{"threadId": AiThreadId}

```

### Response

```json
{
  "data": {
    "aiThread": {
      "id": AiThreadId,
      "name": "abc123",
      "threadType": "GENERAL",
      "objectId": "abc123",
      "entries": [AiThreadEntry],
      "timestamp": "2021-10-07T18:23:25.829Z"
    }
  }
}

```

## Related operations

- [`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,…
- [`aiThreads`](https://wartiva.com/api-docs/queries/ai-threads.html) query: Lists the caller's AI chat threads in an organization that contain at least one message, most recently updated first.

---

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