---
title: "Create a new tool router session"
method: POST
path: "/api/v3/tool_router/session"
tags: ["Tool Router"]
---

# Create a new tool router session

`POST /api/v3/tool_router/session`

Creates a new session for the tool router feature. This endpoint initializes a new session with specified toolkits and their authentication configurations. The session provides an isolated environment for testing and managing tool routing logic with scoped MCP server access.

## Request body

- object
  - `user_id` string, required — The identifier of the user who is initiating the session, ideally a unique identifier from your database like a user ID or email address
  - `toolkits` union — Toolkit configuration - specify either enable toolkits (allowlist) or disable toolkits (denylist). Mutually exclusive.
    - object — Enable only specific toolkits (allowlist)
      - `enable` string[], required — Only these specific toolkits will be enabled
    - object — Disable specific toolkits (denylist)
      - `disable` string[], required — These specific toolkits will be disabled
  - `auth_configs` object — The auth configs to use for the session. This will override the default behavior and use the given auth config when specific toolkits are being executed
  - `connected_accounts` object — Per-toolkit connected account override (single nano-ID). Each connected account must exist (not deleted or disabled) and belong to the same `user_id` as the session.
  - `manage_connections` object — Configuration for connection management settings
    - `enable` boolean, nullable — Whether to enable the connection manager for automatic connection handling. If true, we will provide a tool your agent can use to initiate connections to toolkits if it doesnt exist. If set to false, then you have to manage connections manually.
    - `callback_url` string, uri — The URL to redirect to after a user completes authentication for a connected account. This allows you to handle the auth callback in your own application.
    - `enable_wait_for_connections` boolean, nullable — When true, the COMPOSIO_WAIT_FOR_CONNECTIONS tool is available for agents to poll connection status after sharing auth URLs. Default is false (disabled). May not work reliably with GPT models.
    - `enable_connection_removal` boolean, nullable — Enable the "remove" action in COMPOSIO_MANAGE_CONNECTIONS to allow deleting connected accounts. Default true.
  - `tools` object — Tool-level configuration per toolkit. Allows you to enable, disable, or filter by tags for specific tools within each toolkit. Every slug passed in `enable` / `disable` must be a valid Composio tool slug for that toolkit — invalid or typo'd slugs fail session creation with a clear error listing which ones didn't match.
  - `tags` union — Global MCP tool annotation hints for filtering. Array format is treated as enabled list. Object format supports both enabled (tool must have at least one) and disabled (tool must NOT have any) lists. Toolkit-level tags override this. Toolkit enabled/disabled lists take precedence over tag filtering.
    - string[]
    - object
      - `enable` string[]
      - `disable` string[]
  - `workbench` object — Configuration for workbench behavior
    - `enable` boolean — Set to false to disable the workbench entirely. When disabled, no code execution tools are available in the session.
    - `enable_proxy_execution` boolean — Whether proxy execution is enabled. When enabled, workbench can call URLs and APIs directly.
    - `auto_offload_threshold` number — Character threshold for automatic offloading. When workbench response exceeds this threshold, it will be automatically offloaded. Default is picked automatically based on the response size.
    - `sandbox_size` 'standard' | 'medium' | 'large' | 'xlarge' — Sandbox compute tier: standard (1 vCPU / 1 GB), medium (2 vCPU / 2 GB), large (4 vCPU / 4 GB), xlarge (8 vCPU / 8 GB). Defaults to standard.
  - `multi_account` object — Configure multi-account behavior. When enabled, users can connect multiple accounts per toolkit.
    - `enable` boolean — When true, enables multi-account mode for this session. When not set, falls back to org/project-level configuration.
    - `max_accounts_per_toolkit` integer — Maximum number of connected accounts allowed per toolkit. Must be between 2 and 10.
    - `require_explicit_selection` boolean — When true, the agent must explicitly select which account to use. When false (default), the first/default account is used automatically.
  - `experimental` object — Experimental features - not stable, may be modified or removed in future versions.
    - `assistive_prompt_config` object — Customize assistive prompt generation (e.g., timezone).
      - `user_timezone` string — IANA timezone identifier (e.g., 'America/New_York', 'Europe/London'). Used to customize the system prompt with timezone-aware instructions.
    - `custom_toolkits` object[] — Custom toolkits with grouped tools. Toolkit slugs must not conflict with existing Composio toolkits. All tools are no-auth.
      - `slug` string, required — Unique slug for the toolkit. Must not conflict with existing Composio toolkit slugs. Alphanumeric, underscores, and hyphens only.
      - `name` string, required — Display name shown to the LLM and in search results.
      - `description` string, required — Used for BM25 search matching and shown in toolkit connection statuses.
      - `preload` boolean — SDK hint for direct custom-tool exposure. Not stored in session config; echoed in create/attach responses for inline custom definitions.
      - `tools` object[], required — Tools in this custom toolkit
        - `slug` string, required — Tool slug. Combined with toolkit slug to form LOCAL_<TOOLKIT>_<TOOL> (max 60 chars total).
        - `name` string, required — Human-readable display name
        - `description` string, required — Used for BM25 search matching and shown to the LLM.
        - `input_schema` object, required — Must have type: "object" and a properties field.
        - `output_schema` object — Optional output schema for the tool response.
        - `preload` boolean — SDK hint for direct custom-tool exposure. Not stored in session config; echoed in create/attach responses for inline custom definitions.
    - `custom_tools` object[] — Custom tools to include in search. Standalone tools need no auth. Tools with extends_toolkit inherit the Composio toolkit's connection.
      - `slug` string, required — Tool slug. Forms LOCAL_<TOOL> (standalone) or LOCAL_<TOOLKIT>_<TOOL> (extending). Max 60 chars total.
      - `name` string, required — Human-readable display name
      - `description` string, required — Used for BM25 search matching and shown to the LLM.
      - `input_schema` object, required — Must have type: "object" and a properties field.
      - `output_schema` object — JSON Schema describing tool output (optional)
      - `extends_toolkit` string — If set, must be a valid Composio toolkit slug. The tool inherits that toolkit's auth/connection status. If omitted, the tool is standalone (no-auth).
      - `preload` boolean — SDK hint for direct custom-tool exposure. Not stored in session config; echoed in create/attach responses for inline custom definitions.
    - `permissions` object — Per-tool elicitation permission config. Default behavior + per-tool always_allow/always_deny overrides. Mutation via PATCH.
      - `default` 'allow_all' | 'ask_every_call' | 'ask_once_per_session', required — Default elicitation behavior when no override matches. `allow_all` runs every tool without prompting; `ask_every_call` prompts on each invocation; `ask_once_per_session` prompts once and remembers the answer for the rest of the session.
      - `overrides` object — Per-tool overrides keyed by `${toolSlug}:${connectedAccountId ?? "__none__"}`, plus account-wide overrides keyed by `*:${connectedAccountId ?? "__none__"}`. Exact tool overrides take precedence over account-wide overrides. `always_allow` skips the prompt and runs the tool; `always_deny` blocks the tool; `ask_once` prompts once per session (allow/deny) and remembers; `ask_always` prompts on every call with allow-once/allow-session/deny, ignoring any cached session allow. Overrides take precedence over `default`.
    - `link_url_overwrite` string, uri — Experimental base URL override for connection link redirects created from this tool-router session. When set, link creation returns `${link_url_overwrite}/link/{link_token}` instead of the default Composio Connect base URL. Use only when your integration needs links to open through a custom Connect host.
  - `preload` object — Preload configuration for Composio tools. Controls which tools appear in `session.tools` and the MCP server tool list so the agent can call them directly without going through search first. Custom tools use `preload` on the custom tool/toolkit definition instead. Not supported when multi-account is enabled. Each preloaded tool adds to the agent context window, so keep the list at or under ~20 tools.
    - `tools` string[] — Composio tool slugs to preload. Each slug must be allowed by the session filters (`toolkits`, `tools`, `tags`) — unknown, blocked, meta, or custom slugs return a 400 at session creation.

## Response `201`

Session successfully created. Returns the session ID and MCP server URL for the created session.

- object
  - `session_id` string, toolRouterSessionId, required — The identifier of the session
  - `mcp` object, required
    - `type` 'http', required — The type of the MCP server. Can be http
    - `url` string, uri, required — The URL of the MCP server
  - `tool_router_tools` string[], required — List of available tools in this session
  - `config` object, required — The session configuration including user, toolkits, and overrides
    - `user_id` string, required — User identifier for this session
    - `toolkits` union — Toolkit configuration - either enabled list or disabled list
      - object
        - `enabled` string[], required
      - object
        - `disabled` string[], required
    - `auth_configs` object — Auth config overrides per toolkit
    - `connected_accounts` object — Per-toolkit connected account override (single nano-ID). Returns the first override when multi-account is enabled; see `all_connected_accounts` for the full list.
    - `all_connected_accounts` object — Full per-toolkit connected account overrides as arrays. Populated whenever `connected_accounts` is non-empty; carries the complete list when multi-account is enabled.
    - `manage_connections` object — Manage connections configuration
      - `enabled` boolean — Whether to enable the connection manager for automatic connection handling
      - `callback_url` string, uri — Custom callback URL for connected account auth flows
      - `enable_wait_for_connections` boolean — Enable the COMPOSIO_WAIT_FOR_CONNECTIONS tool for polling connection status. Default false. May not work reliably with GPT models.
      - `enable_connection_removal` boolean — Enable the "remove" action in COMPOSIO_MANAGE_CONNECTIONS. Default true.
    - `tools` object — Tool-level configuration per toolkit
    - `tags` object — MCP tool annotation hints for filtering tools with enabled/disabled support. enabled: tags that the tool must have at least one of. disabled: tags that the tool must NOT have any of. Both conditions must be satisfied.
      - `enabled` string[] — Tags that the tool must have at least one of
      - `disabled` string[] — Tags that the tool must NOT have any of
    - `workbench` object — Workbench configuration
      - `enable` boolean — Whether the workbench (code execution sandbox) is enabled. When false, COMPOSIO_REMOTE_WORKBENCH and COMPOSIO_REMOTE_BASH_TOOL are not exposed.
      - `proxy_execution_enabled` boolean — Whether proxy execution is enabled in the workbench
      - `auto_offload_threshold` number — Character threshold after which tool execution response are saved to a file in workbench. Default is 20k.
      - `sandbox_size` 'standard' | 'medium' | 'large' | 'xlarge' — Sandbox compute tier: standard (1 vCPU / 1 GB), medium (2 vCPU / 2 GB), large (4 vCPU / 4 GB), xlarge (8 vCPU / 8 GB). Defaults to standard.
    - `multi_account` object — Multi-account configuration for this session.
      - `enable` boolean — When true, enables multi-account mode for this session. When not set, falls back to org/project-level configuration.
      - `max_accounts_per_toolkit` integer — Maximum number of connected accounts allowed per toolkit. Defaults to 5 when multi-account is enabled.
      - `require_explicit_selection` boolean — When true, require explicit account selection when multiple accounts are connected. When false (default), use the first/default account.
    - `preload` object, required — Preload configuration. Controls which tools appear in `session.tools` and the MCP server tool list, callable directly without going through search. Each preloaded tool adds to the agent context — roughly ≤20 tools is recommended. Always present in the response (empty `tools: []` when the session was created without a preload config).
      - `tools` string[], required — Tool slugs preloaded for this session. Appear in `session.tools` and the MCP server tool list, callable directly without going through search. Empty array when no preload was configured.
  - `config_version` integer, required — Monotonic version of the config. Incremented on each PATCH. Use for optimistic concurrency control.
  - `experimental` object — Experimental features including the generated system prompt. Only returned on session creation, not on GET.
    - `assistive_prompt` string — The assistive system prompt for the tool router session
    - `custom_toolkits` object[] — User-defined custom toolkits with grouped tools (no-auth)
      - `slug` string, required
      - `name` string, required
      - `description` string, required
      - `tools` object[], required
        - `slug` string, required — Prefixed tool slug (e.g. LOCAL_CRM_FIND_CUSTOMER)
        - `name` string, required
        - `description` string, required
        - `input_schema` object, required
        - `output_schema` object
        - `original_slug` string, required — Original tool slug as provided by the user
        - `preload` boolean — Echoes the SDK-local preload hint provided for this tool
      - `preload` boolean — Echoes the SDK-local preload hint provided for this toolkit
    - `custom_tools` object[] — Custom tools — standalone or extending Composio toolkits
      - `slug` string, required — Prefixed tool slug (e.g. LOCAL_GMAIL_GET_IMPORTANT_EMAILS)
      - `name` string, required
      - `description` string, required
      - `input_schema` object, required
      - `output_schema` object
      - `extends_toolkit` string
      - `original_slug` string, required — Original tool slug as provided by the user
      - `preload` boolean — Echoes the SDK-local preload hint provided for this tool
  - `warnings` object[] — Advisory list — the session exists and is usable, but the listed issues may warrant attention.
    - `code` 'PRELOAD_TOOLS_HIGH_CONTEXT_USAGE', required — Stable machine code identifying the advisory. Safe to switch on in client code.
    - `message` string, required — Human-readable description of the advisory. Suitable for logging or surfacing to end users.

## Other responses

- `400` — Bad request. This may occur if the user_id format is invalid, toolkit names are invalid, or auth_config_id IDs are malformed.
- `401` — Unauthorized. Authentication is required or the provided credentials are invalid.
- `403` — Forbidden. The user is not authorized to create a tool router session.
- `408` — Request timeout. The session creation took too long to complete.
- `429` — Too many requests. The upstream service is rate limiting the request; retry after a short backoff.
- `500` — Internal server error. An unexpected error occurred while processing the request.

## Changes

> 10 revisions in range; 1 could not be searched.

- **2026-08-07** `df7478fc8f3b` — 1 info
  - added the non-success response with the status `429`

[Change history](https://skmtc.dev/composiohq/apis/composio-platform-api/changes/api/v3/tool_router/session/post.md)

---

[API](https://skmtc.dev/composiohq/apis/composio-platform-api.md) · [All operations](https://skmtc.dev/composiohq/apis/composio-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/composiohq/composio-platform-api/revisions/368fb7851f42/schema)
