---
title: aiThreadCreate query | Wartiva GraphQL API
description: 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, object type.
url: https://wartiva.com/api-docs/queries/ai-thread-create.html
updated: 2026-10-07
---

AI · GraphQL query

# `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, object type, and object id, so repeating a call returns the same thread with its history. The search- and GraphQL-generation types require an object type, and the object question type also requires an object id. Send messages to it with [aiThreadMessage](https://wartiva.com/api-docs/queries/ai-thread-message.html).

## Response

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

## Arguments

| Name | Description |
|---|---|
| `orgId` - [`OrganizationId!`](https://wartiva.com/api-docs/types/organization-id.html) | The Organization identifier. |
| `options` - [`AiThreadCreateInput!`](https://wartiva.com/api-docs/types/ai-thread-create-input.html) | Configuration options for creating the AI chat thread, including thread type and other optional settings. |

## Example

### Query

```graphql
query aiThreadCreate(
  $orgId: OrganizationId!,
  $options: AiThreadCreateInput!
) {
  aiThreadCreate(
    orgId: $orgId,
    options: $options
  ) {
    id
    name
    threadType
    objectId
    entries {
      timestamp
      isFromUser
      message
    }
    timestamp
  }
}

```

### Variables

```json
{
  "orgId": "615f3b3b28284380e28a7342",
  "options": AiThreadCreateInput
}

```

### Response

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

```

## 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.
- [`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
