---
title: "POST /v2/threads/{threadId}"
method: POST
path: "/v2/threads/{threadId}"
---

# POST /v2/threads/{threadId}

`POST /v2/threads/{threadId}`

## Request

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

Updates a thread's metadata by its ID.

## Path parameters

- `threadId` string, required

## Headers

- `X-API-Key` string, required

## Request body

- object
  - `metadata` object, required: 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. Note that the new metadata provided will completely overwrite any existing metadata for the thread.

## Response `200`

Successfully updated thread

- object
  - `id` string, required: The unique identifier for the thread.
  - `createdAt` integer, required: The Unix timestamp (in seconds) of when the thread was created.
  - `projectId` string, required: The ID of the project this thread belongs to.
  - `createLog` object, nullable: A log created by the first message that creates the thread.
    - `id` string: The unique identifier for the log.
    - `url` string: The URL of the request.
    - `stream` boolean: Indicates if the request was streamed.
    - `metadata` string: Additional metadata associated with the log.
    - `promptId` string: The ID of the prompt used.
    - `threadId` string, nullable: The ID of the associated thread, if any.
    - `assistant` boolean: Indicates if an assistant was used.
    - `projectId` string: The ID of the project.
    - `requestIP` string: The IP address of the request.
    - `startedAt` string, date-time: The timestamp when the request started.
    - `variables` string: Variables used in the request.
    - `parameters` string: Parameters used in the request.
    - `promptSlug` string: The slug of the prompt used.
    - `doNotRecord` boolean: Indicates if the request should not be recorded.
    - `environment` string: The environment in which the request was made.
    - `openAIKeyId` string: The ID of the OpenAI key used.
    - `projectSlug` string: The slug of the project.
    - `requestData` string: Data associated with the request.
    - `deploymentId` string: The ID of the deployment.
    - `organizationId` string: The ID of the organization.
    - `projectAPIKeyId` string: The ID of the project API key.
    - `organizationSlug` string: The slug of the organization.
    - `deploymentVersion` string, nullable: The version of the deployment, if applicable.
    - `promptHistoryHash` string: A hash of the prompt history.
    - `openAIOrganization` string, nullable: The OpenAI organization, if applicable.
  - `metadata` object, required: The updated set of key-value pairs attached to the thread.

## Other responses

- `400`: Metadata is required
- `404`: Thread not found

---

[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)
