Skip to main content
POST
/
v2
/
threads
cURL
curl --request POST \
  --url https://api.langtail.com/v2/threads \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <x-api-key>' \
  --data '{
  "metadata": {
    "user_id": "user_123",
    "conversation_topic": "product_inquiry",
    "priority": "high"
  },
  "createLog": {}
}'
{
  "id": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "projectId": "<string>",
  "metadata": {},
  "deletedAt": "2023-11-07T05:31:56Z",
  "createLog": {}
}
This endpoint creates a new thread. It allows you to initialize a conversation thread, optionally providing metadata to associate with it.

Headers

X-API-Key
string
required

Your Langtail API Key

Example:

"<LANGTAIL_API_KEY>"

Body

application/json
metadata
object

A set of key-value pairs that can be attached to the thread. This can be used to store additional information about the thread to facilitate filtering or organization.

Example:
{
"user_id": "user_123",
"conversation_topic": "product_inquiry",
"priority": "high"
}
createLog
object

A log object that can be passed to create an initial log for the thread.

Response

Successfully created thread

id
string
required

The unique identifier for the created thread.

createdAt
string<date-time>
required

The timestamp when the thread was created.

projectId
string
required

The ID of the project this thread belongs to.

metadata
object | null

The metadata associated with the thread, if provided.

deletedAt
string<date-time> | null

The timestamp when the thread was deleted, if applicable.

createLog
object | null

The log created by the first message that creates the thread.

I