Function: threadsRoute()
threadsRoute(
options):ApiRoute[]
Register the <path> Mastra custom API route. Handles three methods
on the same mount:
GET: a page of the resource’s conversation threads (listThreads).DELETE: remove the thread named by the thread-selection header /?threadId=query (deleteThread). The id is read fromRequestContext(the auth middleware resolves it the same way it does for streaming and history), so the client deletes any of its threads by stamping the target id - no separate path param.PATCH: rename the thread named by the thread-selection header /?threadId=query to the{ title }in the JSON body (renameThread). Targets a thread the same wayDELETEdoes; 404s when the thread isn’t owned by the caller.
Follows the @mastra/ai-sdk agent-binding convention: pass agent
for a fixed-agent mount, or include :agentId in the path for
dynamic routing. The plugin registers both /route/threads (default
agent) and /route/threads/:agentId.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”ApiRoute[]