Get Thread langbase.threads.get()
You can use the threads.get()
function to retrieve thread information and its metadata. This helps you access conversation history and thread details when needed.
Generate a User/Org API key
You will need to generate an API key to authenticate your requests. For more information, visit the User/Org API key documentation.
API reference
langbase.threads.get()
Function Signature
langbase.threads.get(options);
// with types
langbase.threads.get(options: ThreadsGet);
options
- Name
options
- Type
- ThreadsGet
- Description
ThreadsGet Object
threadId: string;
threadId
- Name
threadId
- Type
- string
- Required
- Required
- Description
The ID of the thread
Usage example
Install the SDK
npm i langbase
Environment variables
Environment variables
LANGBASE_API_KEY="<USER/ORG-API-KEY>"
Get a thread
Get a thread on Langbase
const thread = await langbase.threads.get({
threadId: "thread_123"
});
Response
- Name
ThreadsBaseResponse
- Type
- object
- Description
The response of the
threads.get()
function is a promise that resolves to aThreadsBaseResponse
object.ThreadsBaseResponse
id: string; object: 'thread'; created_at: number; metadata: Record<string, string>;
ThreadsBaseResponse type of langbase.threads.get()
{
"id": "thread_123",
"object": "thread",
"created_at": 1709544000,
"metadata": {
"userId": "user123",
"topic": "support",
"status": "resolved"
}
}