Files
2026-07-13 12:38:34 +08:00

23 lines
6.2 KiB
Plaintext

---
title: Sessions (prev Tool Router)
description: "(Labs) Tool router endpoints"
---
{/* Auto-generated from OpenAPI spec. Edit the overview at api-overviews/tool-router.mdx, not this file. */}
These are Composio's session endpoints. A **session** is the runtime context your agent uses to work for one of your users: it scopes which user's connected accounts are in play, which tools are available, how authentication happens, and where execution state lives. Read [What is a session?](/docs/how-composio-works) for the full concept.
<Callout type="info">
Sessions were formerly called the "tool router", which is why these endpoints live under `tool_router`. They are the same thing.
</Callout>
In the SDK you do not call these endpoints directly. Use `composio.create(...)` to start a session and `composio.use(...)` to resume one, then call `session.tools()`, `session.execute(...)`, and `session.authorize(...)` on the returned object.
Reach for the raw API when you need lower-level control: creating and patching a session config, attaching to an existing session, searching for tools, executing tools and meta tools, opening link sessions for auth, proxying authenticated requests, and reading or writing files in a session mount.
See [Configuring sessions](/docs/configuring-sessions) for toolkits, auth configs, account selection, and presets.
## Endpoints
<ApiEndpointsTable endpoints={[{"method":"POST","pathV31":"/api/v3.1/tool_router/session","pathV3":"/api/v3/tool_router/session","summary":"Create a new tool router session","href":"/reference/api-reference/tool-router/postToolRouterSession"},{"method":"GET","pathV31":"/api/v3.1/tool_router/session/{session_id}","pathV3":"/api/v3/tool_router/session/{session_id}","summary":"Get a tool router session by ID (v3.1)","href":"/reference/api-reference/tool-router/getToolRouterSessionBySessionId"},{"method":"PATCH","pathV31":"/api/v3.1/tool_router/session/{session_id}","pathV3":"/api/v3/tool_router/session/{session_id}","summary":"Patch a tool router session config (v3.1)","href":"/reference/api-reference/tool-router/patchToolRouterSessionBySessionId"},{"method":"DELETE","pathV31":"/api/v3.1/tool_router/session/{session_id}","pathV3":"/api/v3/tool_router/session/{session_id}","summary":"Delete a tool router session","href":"/reference/api-reference/tool-router/deleteToolRouterSessionBySessionId"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/attach","pathV3":"/api/v3/tool_router/session/{session_id}/attach","summary":"Attach to an existing tool router session (v3.1)","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdAttach"},{"method":"GET","pathV31":"/api/v3.1/tool_router/session/{session_id}/config_history","pathV3":"/api/v3/tool_router/session/{session_id}/config_history","summary":"List a tool router session config history","href":"/reference/api-reference/tool-router/getToolRouterSessionBySessionIdConfigHistory"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/search","pathV3":"/api/v3/tool_router/session/{session_id}/search","summary":"Search for tools using a query","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdSearch"},{"method":"GET","pathV31":"/api/v3.1/tool_router/session/{session_id}/tools","pathV3":"/api/v3/tool_router/session/{session_id}/tools","summary":"List tools with schemas for a tool router session (v3.1)","href":"/reference/api-reference/tool-router/getToolRouterSessionBySessionIdTools"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/execute","pathV3":"/api/v3/tool_router/session/{session_id}/execute","summary":"Execute a tool within a tool router session","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdExecute"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/execute_meta","pathV3":"/api/v3/tool_router/session/{session_id}/execute_meta","summary":"Execute a meta tool within a tool router session","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdExecuteMeta"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/link","pathV3":"/api/v3/tool_router/session/{session_id}/link","summary":"Create a link session for a toolkit in a tool router session","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdLink"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/proxy_execute","pathV3":"/api/v3/tool_router/session/{session_id}/proxy_execute","summary":"Execute proxy request within a tool router session","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdProxyExecute"},{"method":"GET","pathV31":"/api/v3.1/tool_router/session/{session_id}/toolkits","pathV3":"/api/v3/tool_router/session/{session_id}/toolkits","summary":"Get toolkits for a tool router session","href":"/reference/api-reference/tool-router/getToolRouterSessionBySessionIdToolkits"},{"method":"GET","pathV31":"/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/items","pathV3":"/api/v3/tool_router/session/{session_id}/mounts/{mount_id}/items","summary":"List files in a session mount","href":"/reference/api-reference/tool-router/getToolRouterSessionBySessionIdMountsByMountIdItems"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/download_url","pathV3":"/api/v3/tool_router/session/{session_id}/mounts/{mount_id}/download_url","summary":"Create a presigned download URL for a mount file","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdMountsByMountIdDownloadUrl"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/upload_url","pathV3":"/api/v3/tool_router/session/{session_id}/mounts/{mount_id}/upload_url","summary":"Create a presigned upload URL for a mount file","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdMountsByMountIdUploadUrl"},{"method":"POST","pathV31":"/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/delete","pathV3":"/api/v3/tool_router/session/{session_id}/mounts/{mount_id}/delete","summary":"Delete a file from a session mount","href":"/reference/api-reference/tool-router/postToolRouterSessionBySessionIdMountsByMountIdDelete"}]} />