Thread: Get v1

The Get Thread API allows you to retrieve thread information like its metadata and other details.


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.


GET/v1/threads/{threadId}

Get a thread

Retrieve a thread by its ID.

Headers

  • Name
    Authorization
    Type
    string
    Required
    Required
    Description

    Replace LANGBASE_API_KEY with your User/Org API key


Path Parameters

  • Name
    threadId
    Type
    string
    Required
    Required
    Description

    The unique identifier of the thread to retrieve.

Usage example

Install the SDK

npm i langbase

Environment variables

.env file

LANGBASE_API_KEY="<USER/ORG-API-KEY>"

Retrieve a thread

Get a thread

GET
/v1/threads/{threadId}
import { Langbase } from 'langbase';

const langbase = new Langbase({
  apiKey: process.env.LANGBASE_API_KEY // Your User/Org API key
});

async function main() {
  const threadId = "thread_abc123xyz456";
  const thread = await langbase.threads.get({
    threadId: threadId
  });

  console.log('Thread retrieved:', thread);
  return thread;
}

main();

Response

The response is a ThreadsBaseResponse object with information about the requested 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 metadata associated with the thread. This may include custom fields that were added when the thread was created or updated.

Response Example

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