Skip to content

AI Threads API

Endpoints for managing AI conversation threads. Threads maintain context across multiple chat interactions.

SDK equivalent: sdk.ai.threads

Create Thread

Create a new conversation thread.

POST /api/ai/threads

Request Body

json
{
  "integration": "integration-id",
  "title": "Customer Support Chat"
}
FieldTypeRequiredDescription
integrationstringYesThe AI integration ID
titlestringNoHuman-readable title for the thread

Response

json
{
  "_id": "thread-id",
  "integration": "integration-id",
  "title": "Customer Support Chat",
  "messages": [],
  "messageSummaries": [],
  "created": "2025-01-01T00:00:00.000Z",
  "user": "user-id",
  "workspace": "workspace-id"
}

SDK: sdk.ai.threads.create(data)


Get Thread

Retrieve a specific thread by ID, including its full message history.

GET /api/ai/threads/{threadId}

Path Parameters

ParameterTypeDescription
threadIdstringThe thread ID

Response

json
{
  "_id": "thread-id",
  "integration": "integration-id",
  "title": "Customer Support Chat",
  "messages": [
    { "role": "user", "content": "Hello!", "timestamp": "2025-01-01T00:00:00.000Z" },
    { "role": "assistant", "content": "Hi! How can I help?", "timestamp": "2025-01-01T00:00:01.000Z" }
  ],
  "messageSummaries": [],
  "created": "2025-01-01T00:00:00.000Z",
  "updated": "2025-01-01T00:00:01.000Z"
}

SDK: sdk.ai.threads.getOne(threadId)


List Threads

Retrieve threads with optional filtering and pagination.

GET /api/ai/threads

Query Parameters

ParameterTypeDescription
integrationstringFilter by integration ID
limitnumberMaximum number of threads to return
pagenumberPage number for pagination
sortstringSort field (e.g., -created for newest first)
userstringFilter by user ID
workspacestringFilter by workspace ID

Response

json
[
  {
    "_id": "thread-id",
    "integration": "integration-id",
    "title": "Customer Support Chat",
    "messages": [],
    "created": "2025-01-01T00:00:00.000Z"
  }
]

SDK: sdk.ai.threads.list(options)


Delete Thread

Delete a conversation thread and its messages.

DELETE /api/ai/threads/{threadId}

Path Parameters

ParameterTypeDescription
threadIdstringThe thread ID

Response

json
{
  "success": true
}

SDK: sdk.ai.threads.delete(threadId)

Build SaaS Products Without Limits.