Thread: Delete v1
The Delete Thread API allows you to delete threads that are no longer needed. This helps you manage conversation history and clean up unused threads in your applications.
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.
DELETE/v1/threads/{threadId}
Delete a thread
Delete 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 delete.
Usage example
Install the SDK
npm i langbase
Environment variables
.env file
LANGBASE_API_KEY="<USER/ORG-API-KEY>"
Delete a thread
Delete a thread
DELETE
/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 result = await langbase.threads.delete({
threadId: threadId
});
console.log('Thread deleted:', result.success);
return result;
}
main();
Response
The response is a simple JSON object that confirms the deletion operation.
- Name
success
- Type
- boolean
- Description
Indicates whether the thread was successfully deleted.
Response Example
{
"success": true
}