---
title: "POST /v2/threads"
method: POST
path: "/v2/threads"
---

# POST /v2/threads

`POST /v2/threads`

## Request

- Base URL: `https://api.langtail.com`
- URL: `https://api.langtail.com/v2/threads`
- Auth: none declared. Required headers: `X-API-Key`

Create a new thread. This endpoint allows you to initialize a conversation thread, optionally providing metadata or an initial log.

## Headers

- `X-API-Key` string, required

## Request body

- object
  - `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.
  - `createLog` object: A log object that can be passed to create an initial log for the thread.

## Response `200`

Successfully created thread

- object
  - `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, nullable: The metadata associated with the thread, if provided.
  - `deletedAt` string, date-time, nullable: The timestamp when the thread was deleted, if applicable.
  - `createLog` object, nullable: The log created by the first message that creates the thread.

## Other responses

- `400`: Bad request

---

[API](https://skmtc.dev/langtail/apis/langtail-prompt-endpoint.md) - [All operations](https://skmtc.dev/langtail/apis/langtail-prompt-endpoint/llms.txt) - [OpenAPI document](https://skmtc.dev/langtail/apis/langtail-prompt-endpoint/revisions/7186c80b2e39?raw)
