{
"error": "Unauthorized",
"message": "Invalid API key"
}
Before using the Threads API, make sure you have set up the REST API integration.Threads are a fundamental component of the Langtail API, designed to manage and maintain the state of conversations with AI assistants. Here’s how the Threads API works:
Creation: A thread can be created either as a new conversation or by referencing an existing thread ID.
Message Storage: Threads store all messages exchanged during a conversation, including both user inputs and assistant responses.
Conversation Continuity: By using thread IDs, you can maintain context across multiple interactions, allowing for coherent, ongoing dialogues.
This endpoint supports pagination in the same way as the OpenAI API. Specifically, it follows the pagination mechanism described in the OpenAI API documentation for listing Assistants.Here’s how it works:
The limit parameter allows you to specify the maximum number of threads to return in a single request. The default and maximum value is 100.
The after parameter is used as a cursor for pagination. It should be set to any thread ID from which you want to retrieve the next set of results.
To fetch the next page of results, make a new request with the after parameter set to the ID of the last thread in the current response.
The response includes a has_more parameter, which indicates whether there are more results available.
This pagination approach allows you to efficiently retrieve and process large numbers of threads in manageable chunks.
A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants.
The ID of the last thread in the list, or null if the list is empty.
Was this page helpful?
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Langtail Docs","colors":{"primary":"#4f46e5","light":"#6366F1","dark":"#4338CA"},"favicon":"/images/favicon.svg","logo":{"light":"https://mintcdn.com/langtail-64/21vrq2LQuE9wZl3n/images/logo/light.svg?fit=max\u0026auto=format\u0026n=21vrq2LQuE9wZl3n\u0026q=85\u0026s=9a2020ca308f997e25f1af399ddc13fa","dark":"https://mintcdn.com/langtail-64/21vrq2LQuE9wZl3n/images/logo/dark.svg?fit=max\u0026auto=format\u0026n=21vrq2LQuE9wZl3n\u0026q=85\u0026s=42611dc0b61af027330cd7fb358de292"},"appearance":{"default":"dark","strict":true},"navbar":{"links":[{"label":"Join Discord","href":"https://discord.com/invite/PpNqWYdBCS"}],"primary":{"type":"button","label":"Open Langtail","href":"https://app.langtail.com"}},"footer":{"socials":{"twitter":"https://twitter.com/langtail","youtube":"https://www.youtube.com/@langtail","linkedin":"https://www.linkedin.com/company/langtail"}},"integrations":{"mixpanel":{"projectToken":"d93a0106154a1a514d81ce1f02019340"}},"navigation":{"global":{"anchors":[{"anchor":"Community","href":"https://discord.com/invite/PpNqWYdBCS","icon":"discord"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"langtail-64","hasAudioNarration":false,"actualSubdomain":"langtail-64","customDomains":["langtail.com"],"gitSource":{"type":"github","owner":"langtail","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ae91e89dad76a2288f7f3ec:success","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"Documentation","count":37},{"language":"default","tag":"Concepts and Examples","count":18},{"language":"default","tag":"References","count":12},{"language":"default","tag":"Threads","count":5},{"language":"default","tag":"Assistant messages in threads","count":5},{"language":"default","tag":"Playground","count":5},{"language":"default","tag":"Deployments","count":4},{"language":"default","tag":"OpenAI Proxy","count":4},{"language":"default","tag":"Tests","count":3},{"language":"default","tag":"Introduction","count":3}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/endpoint/threads","slug":"/api-reference/endpoint/threads","pageMetadata":{"title":"List Threads","openapi":"GET /v2/threads","description":"Get a list of threads within your project.","href":"/api-reference/endpoint/threads"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Get a list of threads within your project.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,..._provideComponents(),...props.components},{Heading}=_components;if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Before using the Threads API, make sure you have set up the REST API integration.`}),`\n`,_jsx(_components.p,{children:`Threads are a fundamental component of the Langtail API, designed to manage and maintain the state of conversations with AI assistants. Here’s how the Threads API works:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Creation: A thread can be created either as a new conversation or by referencing an existing thread ID.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Message Storage: Threads store all messages exchanged during a conversation, including both user inputs and assistant responses.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Conversation Continuity: By using thread IDs, you can maintain context across multiple interactions, allowing for coherent, ongoing dialogues.`}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`pagination`,children:`Pagination`}),`\n`,_jsxs(_components.p,{children:[`This endpoint supports pagination in the same way as the OpenAI API. Specifically, it follows the pagination mechanism described in the `,_jsx(_components.a,{href:`https://platform.openai.com/docs/api-reference/assistants/listAssistants`,children:`OpenAI API documentation for listing Assistants`}),`.`]}),`\n`,_jsx(_components.p,{children:`Here’s how it works:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`limit`}),` parameter allows you to specify the maximum number of threads to return in a single request. The default and maximum value is 100.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`after`}),` parameter is used as a cursor for pagination. It should be set to any thread ID from which you want to retrieve the next set of results.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`To fetch the next page of results, make a new request with the `,_jsx(_components.code,{children:`after`}),` parameter set to the ID of the last thread in the current response.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`The response includes a `,_jsx(_components.code,{children:`has_more`}),` parameter, which indicates whether there are more results available.`]}),`\n`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`This pagination approach allows you to efficiently retrieve and process large numbers of threads in manageable chunks.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"List Threads","openapi":"GET /v2/threads","description":"Get a list of threads within your project.","href":"/api-reference/endpoint/threads"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Pagination","slug":"pagination","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"description":"Get a list of threads within your project.","servers":["1b455827-11a9-4e96-9c7a-3976dd1b6e3c"],"parameters":["fbb675a1-42ec-4a68-8412-4cd3c39ecabb","8bd0010e-59b0-4bd4-bba7-f3ad51f814ac","6379dafe-c307-4965-8bc3-ea65a47fc902"],"responses":{"200":"5ea4c621-dae5-4794-89a5-e5c7a381bad1","401":"a342d285-a98a-4240-9703-98cdd2311306"},"method":"get","type":"path","security":[],"path":"/v2/threads","baseUrlOptions":["https://api.langtail.com"],"title":"","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"fbb675a1-42ec-4a68-8412-4cd3c39ecabb":{"schema":{"type":"string","example":"\u003cLANGTAIL_API_KEY>","isRequired":true,"description":"Your Langtail API Key","uniqueKey":"","typeLabel":"string"},"required":true,"description":"Your Langtail API Key","name":"X-API-Key","in":"header"},"8bd0010e-59b0-4bd4-bba7-f3ad51f814ac":{"schema":{"oneOf":[{"type":"number","description":"The maximum number of threads to return. Default is 100.","uniqueKey":"oneOf.0","typeLabel":"number"},{"type":"null","description":"The maximum number of threads to return. Default is 100.","uniqueKey":"oneOf.1","typeLabel":"null"}],"uniqueKey":"","typeLabel":"number | null"},"name":"limit","in":"query","description":"The maximum number of threads to return. Default is 100."},"6379dafe-c307-4965-8bc3-ea65a47fc902":{"schema":{"oneOf":[{"type":"string","description":"A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants.","uniqueKey":"oneOf.0","typeLabel":"string"},{"type":"null","description":"A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants.","uniqueKey":"oneOf.1","typeLabel":"null"}],"uniqueKey":"","typeLabel":"string | null"},"name":"after","in":"query","description":"A cursor for use in pagination. 'after' is a thread ID that defines your place in the list. For instance, if you make a list request and receive 100 threads, ending with thread 'xyz', your subsequent call can include after='xyz' in order to fetch the next page of the list. Pagination works the same as in the OpenAI API https://platform.openai.com/docs/api-reference/assistants/listAssistants."}},"responses":{"5ea4c621-dae5-4794-89a5-e5c7a381bad1":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","enum":["list"],"isRequired":true,"uniqueKey":"object","typeLabel":"enum\u003cstring>"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the thread.","uniqueKey":"data.items.[INDEX].id","typeLabel":"string"},"createdAt":{"type":"integer","description":"The Unix timestamp (in seconds) of when the thread was created.","uniqueKey":"data.items.[INDEX].createdAt","typeLabel":"integer"},"projectId":{"type":"string","description":"The ID of the project this thread belongs to.","uniqueKey":"data.items.[INDEX].projectId","typeLabel":"string"},"createLog":{"oneOf":[{"type":"object","description":"A log created by the first message that creates the thread.","properties":{"id":{"type":"string","description":"The unique identifier for the log.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.id","typeLabel":"string"},"url":{"type":"string","description":"The URL of the request.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.url","typeLabel":"string"},"stream":{"type":"boolean","description":"Indicates if the request was streamed.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.stream","typeLabel":"boolean"},"metadata":{"type":"string","description":"Additional metadata associated with the log.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.metadata","typeLabel":"string"},"promptId":{"type":"string","description":"The ID of the prompt used.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.promptId","typeLabel":"string"},"threadId":{"oneOf":[{"type":"string","description":"The ID of the associated thread, if any.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.threadId.oneOf.0","typeLabel":"string"},{"type":"null","description":"The ID of the associated thread, if any.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.threadId.oneOf.1","typeLabel":"null"}],"uniqueKey":"data.items.[INDEX].createLog.oneOf.0.threadId","typeLabel":"string | null"},"assistant":{"type":"boolean","description":"Indicates if an assistant was used.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.assistant","typeLabel":"boolean"},"projectId":{"type":"string","description":"The ID of the project.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.projectId","typeLabel":"string"},"requestIP":{"type":"string","description":"The IP address of the request.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.requestIP","typeLabel":"string"},"startedAt":{"type":"string","format":"date-time","description":"The timestamp when the request started.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.startedAt","typeLabel":"string\u003cdate-time>"},"variables":{"type":"string","description":"Variables used in the request.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.variables","typeLabel":"string"},"parameters":{"type":"string","description":"Parameters used in the request.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.parameters","typeLabel":"string"},"promptSlug":{"type":"string","description":"The slug of the prompt used.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.promptSlug","typeLabel":"string"},"doNotRecord":{"type":"boolean","description":"Indicates if the request should not be recorded.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.doNotRecord","typeLabel":"boolean"},"environment":{"type":"string","description":"The environment in which the request was made.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.environment","typeLabel":"string"},"openAIKeyId":{"type":"string","description":"The ID of the OpenAI key used.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.openAIKeyId","typeLabel":"string"},"projectSlug":{"type":"string","description":"The slug of the project.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.projectSlug","typeLabel":"string"},"requestData":{"type":"string","description":"Data associated with the request.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.requestData","typeLabel":"string"},"deploymentId":{"type":"string","description":"The ID of the deployment.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.deploymentId","typeLabel":"string"},"organizationId":{"type":"string","description":"The ID of the organization.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.organizationId","typeLabel":"string"},"projectAPIKeyId":{"type":"string","description":"The ID of the project API key.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.projectAPIKeyId","typeLabel":"string"},"organizationSlug":{"type":"string","description":"The slug of the organization.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.organizationSlug","typeLabel":"string"},"deploymentVersion":{"oneOf":[{"type":"string","description":"The version of the deployment, if applicable.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.deploymentVersion.oneOf.0","typeLabel":"string"},{"type":"null","description":"The version of the deployment, if applicable.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.deploymentVersion.oneOf.1","typeLabel":"null"}],"uniqueKey":"data.items.[INDEX].createLog.oneOf.0.deploymentVersion","typeLabel":"string | null"},"promptHistoryHash":{"type":"string","description":"A hash of the prompt history.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.promptHistoryHash","typeLabel":"string"},"openAIOrganization":{"oneOf":[{"type":"string","description":"The OpenAI organization, if applicable.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.openAIOrganization.oneOf.0","typeLabel":"string"},{"type":"null","description":"The OpenAI organization, if applicable.","uniqueKey":"data.items.[INDEX].createLog.oneOf.0.openAIOrganization.oneOf.1","typeLabel":"null"}],"uniqueKey":"data.items.[INDEX].createLog.oneOf.0.openAIOrganization","typeLabel":"string | null"}},"uniqueKey":"data.items.[INDEX].createLog.oneOf.0","typeLabel":"object"},{"type":"null","description":"A log created by the first message that creates the thread.","properties":{"id":{"type":"string","description":"The unique identifier for the log."},"url":{"type":"string","description":"The URL of the request."},"stream":{"type":"boolean","description":"Indicates if the request was streamed."},"metadata":{"type":"string","description":"Additional metadata associated with the log."},"promptId":{"type":"string","description":"The ID of the prompt used."},"threadId":{"oneOf":[{"type":"string","description":"The ID of the associated thread, if any."},{"type":"null","description":"The ID of the associated thread, if any."}]},"assistant":{"type":"boolean","description":"Indicates if an assistant was used."},"projectId":{"type":"string","description":"The ID of the project."},"requestIP":{"type":"string","description":"The IP address of the request."},"startedAt":{"type":"string","format":"date-time","description":"The timestamp when the request started."},"variables":{"type":"string","description":"Variables used in the request."},"parameters":{"type":"string","description":"Parameters used in the request."},"promptSlug":{"type":"string","description":"The slug of the prompt used."},"doNotRecord":{"type":"boolean","description":"Indicates if the request should not be recorded."},"environment":{"type":"string","description":"The environment in which the request was made."},"openAIKeyId":{"type":"string","description":"The ID of the OpenAI key used."},"projectSlug":{"type":"string","description":"The slug of the project."},"requestData":{"type":"string","description":"Data associated with the request."},"deploymentId":{"type":"string","description":"The ID of the deployment."},"organizationId":{"type":"string","description":"The ID of the organization."},"projectAPIKeyId":{"type":"string","description":"The ID of the project API key."},"organizationSlug":{"type":"string","description":"The slug of the organization."},"deploymentVersion":{"oneOf":[{"type":"string","description":"The version of the deployment, if applicable."},{"type":"null","description":"The version of the deployment, if applicable."}]},"promptHistoryHash":{"type":"string","description":"A hash of the prompt history."},"openAIOrganization":{"oneOf":[{"type":"string","description":"The OpenAI organization, if applicable."},{"type":"null","description":"The OpenAI organization, if applicable."}]}},"uniqueKey":"data.items.[INDEX].createLog.oneOf.1","typeLabel":"null"}],"uniqueKey":"data.items.[INDEX].createLog","typeLabel":"object | null"},"metadata":{"oneOf":[{"type":"object","description":"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.","example":{"user_id":"user_123","conversation_topic":"product_inquiry","priority":"high"},"uniqueKey":"data.items.[INDEX].metadata.oneOf.0","typeLabel":"object"},{"type":"null","description":"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.","example":{"user_id":"user_123","conversation_topic":"product_inquiry","priority":"high"},"uniqueKey":"data.items.[INDEX].metadata.oneOf.1","typeLabel":"null"}],"uniqueKey":"data.items.[INDEX].metadata","typeLabel":"object | null"}},"uniqueKey":"data.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"data","typeLabel":"object[]"},"has_more":{"type":"boolean","description":"Whether there are more threads available after this batch.","isRequired":true,"uniqueKey":"has_more","typeLabel":"boolean"},"first_id":{"oneOf":[{"type":"string","description":"The ID of the first thread in the list, or null if the list is empty.","uniqueKey":"first_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"The ID of the first thread in the list, or null if the list is empty.","uniqueKey":"first_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"first_id","typeLabel":"string | null"},"last_id":{"oneOf":[{"type":"string","description":"The ID of the last thread in the list, or null if the list is empty.","uniqueKey":"last_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"The ID of the last thread in the list, or null if the list is empty.","uniqueKey":"last_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"last_id","typeLabel":"string | null"}},"required":["object","data","has_more"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"object":"list","data":[{"id":"\u003cstring>","createdAt":123,"projectId":"\u003cstring>","createLog":{"id":"\u003cstring>","url":"\u003cstring>","stream":true,"metadata":"\u003cstring>","promptId":"\u003cstring>","threadId":"\u003cstring>","assistant":true,"projectId":"\u003cstring>","requestIP":"\u003cstring>","startedAt":"2023-11-07T05:31:56Z","variables":"\u003cstring>","parameters":"\u003cstring>","promptSlug":"\u003cstring>","doNotRecord":true,"environment":"\u003cstring>","openAIKeyId":"\u003cstring>","projectSlug":"\u003cstring>","requestData":"\u003cstring>","deploymentId":"\u003cstring>","organizationId":"\u003cstring>","projectAPIKeyId":"\u003cstring>","organizationSlug":"\u003cstring>","deploymentVersion":"\u003cstring>","promptHistoryHash":"\u003cstring>","openAIOrganization":"\u003cstring>"},"metadata":{"user_id":"user_123","conversation_topic":"product_inquiry","priority":"high"}}],"has_more":true,"first_id":"\u003cstring>","last_id":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"a342d285-a98a-4240-9703-98cdd2311306":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["Unauthorized"],"isRequired":true,"uniqueKey":"error","typeLabel":"enum\u003cstring>"},"message":{"type":"string","example":"Invalid API key","isRequired":true,"uniqueKey":"message","typeLabel":"string"}},"required":["error","message"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"Unauthorized","message":"Invalid API key"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{},"servers":{"1b455827-11a9-4e96-9c7a-3976dd1b6e3c":{"url":"https://api.langtail.com"}}},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"langtail-64","siteName":"Langtail Docs","title":"List Threads - Langtail Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T00:48:04.302Z","originalFileLocation":"api-reference/endpoint/threads.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"dark\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Get a list of threads within your project.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Langtail Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"List Threads - Langtail Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Get a list of threads within your project.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Langtail Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://langtail.com/docs/api-reference/endpoint/threads\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://langtail-64.mintlify.site/docs/_mintlify/api/og/v2?division=Threads\u0026amp;title=List+Threads\u0026amp;description=Get+a+list+of+threads+within+your+project.\u0026amp;theme=3f4278914b3083aa55ddc90f\u0026amp;signature=075d137b164314aa467ee510d3011033ff9217d4954ca3611fb16bf0c5cb9ce1\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"List Threads - Langtail Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Get a list of threads within your project.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://langtail-64.mintlify.site/docs/_mintlify/api/og/v2?division=Threads\u0026amp;title=List+Threads\u0026amp;description=Get+a+list+of+threads+within+your+project.\u0026amp;theme=3f4278914b3083aa55ddc90f\u0026amp;signature=075d137b164314aa467ee510d3011033ff9217d4954ca3611fb16bf0c5cb9ce1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/langtail-64/gNTkU_HUz-gakvd9/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Langtail Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#4f46e5\">\u003clink data-mint-head rel=\"canonical\" href=\"https://langtail.com/docs/api-reference/endpoint/threads\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api-reference/endpoint/threads.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://langtail.com/#organization\",\"name\":\"Langtail Docs\",\"url\":\"https://langtail.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/langtail-64/21vrq2LQuE9wZl3n/images/logo/light.svg?fit=max\u0026auto=format\u0026n=21vrq2LQuE9wZl3n\u0026q=85\u0026s=9a2020ca308f997e25f1af399ddc13fa\"}},{\"@type\":\"WebSite\",\"@id\":\"https://langtail.com/docs#website\",\"name\":\"Langtail Docs\",\"url\":\"https://langtail.com/docs\",\"publisher\":{\"@id\":\"https://langtail.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://langtail.com/docs/api-reference/endpoint/threads#webpage\",\"url\":\"https://langtail.com/docs/api-reference/endpoint/threads\",\"name\":\"List Threads\",\"description\":\"Get a list of threads within your project.\",\"dateModified\":\"2026-01-07T00:48:04.302Z\",\"isPartOf\":{\"@id\":\"https://langtail.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://langtail.com/docs/api-reference/endpoint/threads#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://langtail.com/docs/api-reference/endpoint/threads#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"References\",\"item\":\"https://langtail.com/docs/api-reference/endpoint/invoke-deployed-prompt\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"List Threads\",\"item\":\"https://langtail.com/docs/api-reference/endpoint/threads\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://langtail.com/docs/api-reference/endpoint/threads#apireference\",\"headline\":\"List Threads\",\"name\":\"List Threads\",\"description\":\"Get a list of threads within your project.\",\"url\":\"https://langtail.com/docs/api-reference/endpoint/threads\",\"mainEntityOfPage\":{\"@id\":\"https://langtail.com/docs/api-reference/endpoint/threads#webpage\"},\"dateModified\":\"2026-01-07T00:48:04.302Z\",\"publisher\":{\"@id\":\"https://langtail.com/#organization\"},\"isPartOf\":{\"@id\":\"https://langtail.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Langtail Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Langtail Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/api-reference/endpoint/threads.md","siteName":"Langtail Docs","nav":{"global":{"anchors":[{"anchor":"Community","href":"https://discord.com/invite/PpNqWYdBCS","icon":"discord"}]},"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Introduction","pages":[{"title":"What is Langtail?","href":"/introduction/what-is-langtail"},{"title":"Getting started","href":"/introduction/getting-started"},{"title":"Main concepts in Langtail","sidebarTitle":"Main concepts in Langtail","href":"/introduction/main-concepts-in-langtail"}]},{"group":"Concepts and Examples","pages":[{"title":"Concepts and Examples Overview","sidebarTitle":"Overview","href":"/concepts-and-examples/overview"},{"group":"Playground","pages":[{"title":"Playground Overview","sidebarTitle":"Overview","href":"/concepts-and-examples/playground/overview"},{"title":"Prompt Templating","href":"/concepts-and-examples/playground/templating"},{"title":"Assistants \u0026 Threads","sidebarTitle":"Assistants \u0026 Threads","href":"/concepts-and-examples/playground/assistants-threads"},{"title":"Variables","href":"/concepts-and-examples/playground/variables"},{"title":"Tools","href":"/concepts-and-examples/playground/tools"}]},{"group":"Tests","pages":[{"title":"Tests Overview","sidebarTitle":"Overview","href":"/concepts-and-examples/tests/overview"},{"title":"Basic Tests","href":"/concepts-and-examples/tests/basic-tests"},{"title":"Advanced tests","sidebarTitle":"Advanced tests","href":"/concepts-and-examples/tests/adv-tests"}]},{"group":"Deployments","pages":[{"title":"Deployments Overview","sidebarTitle":"Overview","href":"/concepts-and-examples/deployments/overview"},{"title":"Deploy Prompt","href":"/concepts-and-examples/deployments/deploy-prompt"},{"title":"API keys and Env Variables","href":"/concepts-and-examples/deployments/api-keys"}]},{"group":"Logs and Metrics","pages":[{"title":"Logs and Metrics Overview","sidebarTitle":"Overview","href":"/concepts-and-examples/logs-and-metrics/overview"}]},{"group":"OpenAI Proxy","pages":[{"title":"Integrate via Langtail SDK","href":"/concepts-and-examples/proxy/integrate-sdk"},{"title":"Integrate via OpenAI library","href":"/concepts-and-examples/proxy/openai"},{"title":"Integrate via REST API","href":"/concepts-and-examples/proxy/rest"},{"title":"Integrate via Langchain","href":"/concepts-and-examples/proxy/langchain"}]},{"group":"SDKs","pages":[{"title":"TypeScript SDK","href":"/concepts-and-examples/sdks/typescript"}]}]},{"group":"References","pages":[{"group":"Deployments","pages":[{"title":"Invoke Deployed Prompt","openapi":"POST /{workspace}/{project}/{prompt}/{environment}","href":"/api-reference/endpoint/invoke-deployed-prompt"}]},{"group":"Assistants","pages":[{"title":"Invoke Assistant","openapi":"POST /{workspace}/{project}/{assistant}/{environment}","description":"Get completion for a stored assistant. This endpoint invokes the assistant and returns its response. It uses chat completions on the backend and maintains OpenAI-compatible format. Assistants are stateful AI agents that can leverage various model providers and tools, access persistent conversation threads, and execute multiple tools in parallel.","href":"/api-reference/endpoint/invoke-assistant"}]},{"group":"Threads","pages":[{"title":"List Threads","openapi":"GET /v2/threads","href":"/api-reference/endpoint/threads"},{"title":"Create a Thread","openapi":"POST /v2/threads","description":"Create a new thread. This endpoint allows you to initialize a conversation thread, optionally providing metadata or an initial log.","href":"/api-reference/endpoint/create-thread"},{"title":"Thread by ID","openapi":"GET /v2/threads/{threadId}","href":"/api-reference/endpoint/thread"},{"title":"Delete a Thread by ID","openapi":"DELETE /v2/threads/{threadId}","href":"/api-reference/endpoint/delete-thread"},{"title":"Update a Thread by ID","openapi":"POST /v2/threads/{threadId}","href":"/api-reference/endpoint/update-thread"}]},{"group":"Assistant messages in threads","pages":[{"title":"List Thread Messages","openapi":"GET /v2/threads/{threadId}/messages","href":"/api-reference/endpoint/thread-messages"},{"title":"Create Thread Message","openapi":"POST /v2/threads/{threadId}/messages","href":"/api-reference/endpoint/create-thread-message"},{"title":"Get Thread Message","openapi":"GET /v2/threads/{threadId}/messages/{messageId}","href":"/api-reference/endpoint/thread-message"},{"title":"Update Thread Message","openapi":"POST /v2/threads/{threadId}/messages/{messageId}","href":"/api-reference/endpoint/update-message"},{"title":"Delete Thread Message","openapi":"DELETE /v2/threads/{threadId}/messages/{messageId}","href":"/api-reference/endpoint/delete-thread-message"}]}]},{"group":"Media \u0026 Presentations","pages":[{"title":"Make Chatbots Better | WebExpo Talk","sidebarTitle":"Make Chatbots Better","href":"/media-presentations/web-expo"},{"title":"Deepnote | Case study","url":"https://langtail.com/customers/deepnote","href":"/media-presentations/deepnote-case"}]},{"group":"Support \u0026 Community","pages":[{"title":"Changelog","href":"/support/changelog"},{"title":"Get Help","href":"/support/get-help"}]}]}]},"basePath":"","title":"List Threads - Langtail Docs","buildId":"dpl_6PxPD4Fj1JDU9BJxEHvfdUmxKThw","deploymentId":"dpl_6PxPD4Fj1JDU9BJxEHvfdUmxKThw","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CASS2Vpq.js","utils-4k9fyWRu.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-UU-UueZb.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-BgJ0LOYq.js","snippetPresets-CMgzlMR-.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-BzEJegkK.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-CZuQIZdk.js","shallow-Bw5arfMA.js","getApiPlaygroundDisplay-Ds834aVN.js","CodeSnippet-CKzmjw9L.js","CodeSnippets-BRpgomdp.js","Page-DvEUoD2H.js","getPastedJson-B0N-Tn76.js","icon-DASMs9nC.js","MethodPill-BA6DBLqx.js","DuplicateIcon-BMT5qfbJ.js","createIcon-CNfwVWPx.js","DynamicMarkdown-JYyBNlrJ.js","SectionHeading-BbZnmz8a.js","axios-vUo_bRtp.js","Markdown-LUU0YLpA.js","clsx-Di4ek5Ae.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-VEVWQCR4.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-CPszyu99.js"]}