Thread: Update v1

The Threads API allows you to update existing conversation threads. This endpoint helps you manage thread metadata for better organization and filtering of your conversational applications.


You will need to generate an API key to authenticate your requests. For more information, visit the User/Org API key documentation.


POST/v1/threads/{threadId}

Update an existing thread's metadata.

Headers

  • Name
    Content-Type
    Type
    string
    Required
    Required
    Description

    Request content type. Needs to be application/json

  • Name
    Authorization
    Type
    string
    Required
    Required
    Description

    Replace YOUR_API_KEY with your User/Org API key


Path Parameters

  • Name
    threadId
    Type
    string
    Required
    Required
    Description

    The ID of the thread to update.


Body Parameters

  • Name
    metadata
    Type
    Record<string, string>
    Required
    Required
    Description

    Key-value pairs to update or add to the thread's metadata.

Install the SDK

npm i langbase

Environment variables

.env file

LANGBASE_API_KEY="<YOUR_API_KEY>"

Update an existing thread

Update thread metadata

POST
/v1/threads/{threadId}
curl -X POST https://api.langbase.com/v1/threads/{thread_id} \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <YOUR_API_KEY>' \ -d '{ "metadata": { "status": "resolved", "priority": "high" } }'

Response

The response is a ThreadsBaseResponse object with information about the updated thread.

  • Name
    id
    Type
    string
    Description

    The unique identifier for the thread.

  • Name
    object
    Type
    string
    Description

    The type of object. Always "thread".

  • Name
    created_at
    Type
    number
    Description

    The Unix timestamp (in seconds) for when the thread was created.

  • Name
    metadata
    Type
    Record<string, string>
    Description

    The updated metadata associated with the thread.

Response Example

{ "id": "thread_abc123xyz456", "object": "thread", "created_at": 1714322048, "metadata": { "userId": "user123", "topic": "support", "status": "resolved", "priority": "high" } }