Sessions (Prev Tool Router)
Create a link session for a toolkit in a tool router session
Initiates an authentication link session for a specific toolkit within a tool router session. Returns a link token and redirect URL that users can use to complete the OAuth flow.
POST
/
api
/
v3
/
tool_router
/
session
/
{session_id}
/
link
Create a link session for a toolkit in a tool router session
import requests
url = "https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link"
payload = {
"toolkit": "github",
"alias": "<string>",
"callback_url": "https://myapp.com/callback",
"experimental": { "acl_config_for_shared": {
"allow_all_users": True,
"allowed_user_ids": ["<string>"],
"not_allowed_user_ids": ["<string>"]
} }
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
toolkit: 'github',
alias: '<string>',
callback_url: 'https://myapp.com/callback',
experimental: {
acl_config_for_shared: {
allow_all_users: true,
allowed_user_ids: ['<string>'],
not_allowed_user_ids: ['<string>']
}
}
})
};
fetch('https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"toolkit": "github",
"alias": "<string>",
"callback_url": "https://myapp.com/callback",
"experimental": {
"acl_config_for_shared": {
"allow_all_users": true,
"allowed_user_ids": [
"<string>"
],
"not_allowed_user_ids": [
"<string>"
]
}
}
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link"
payload := strings.NewReader("{\n \"toolkit\": \"github\",\n \"alias\": \"<string>\",\n \"callback_url\": \"https://myapp.com/callback\",\n \"experimental\": {\n \"acl_config_for_shared\": {\n \"allow_all_users\": true,\n \"allowed_user_ids\": [\n \"<string>\"\n ],\n \"not_allowed_user_ids\": [\n \"<string>\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"toolkit\": \"github\",\n \"alias\": \"<string>\",\n \"callback_url\": \"https://myapp.com/callback\",\n \"experimental\": {\n \"acl_config_for_shared\": {\n \"allow_all_users\": true,\n \"allowed_user_ids\": [\n \"<string>\"\n ],\n \"not_allowed_user_ids\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-api-key", "<api-key>");
request.AddJsonBody("{\n \"toolkit\": \"github\",\n \"alias\": \"<string>\",\n \"callback_url\": \"https://myapp.com/callback\",\n \"experimental\": {\n \"acl_config_for_shared\": {\n \"allow_all_users\": true,\n \"allowed_user_ids\": [\n \"<string>\"\n ],\n \"not_allowed_user_ids\": [\n \"<string>\"\n ]\n }\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
false{
"link_token": "lt_abc123xyz",
"redirect_url": "https://app.composio.dev/link/lt_abc123xyz",
"connected_account_id": "ca_abc123xyz",
"experimental": {
"account_type": "PRIVATE",
"acl_config_for_shared": {
"allow_all_users": true,
"allowed_user_ids": [
"<string>"
],
"not_allowed_user_ids": [
"<string>"
]
}
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}Authorizations
Path Parameters
Body
application/json
Response
Successfully created link session. Returns link token, redirect URL, and connected account ID.
Create a link session for a toolkit in a tool router session
import requests
url = "https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link"
payload = {
"toolkit": "github",
"alias": "<string>",
"callback_url": "https://myapp.com/callback",
"experimental": { "acl_config_for_shared": {
"allow_all_users": True,
"allowed_user_ids": ["<string>"],
"not_allowed_user_ids": ["<string>"]
} }
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
toolkit: 'github',
alias: '<string>',
callback_url: 'https://myapp.com/callback',
experimental: {
acl_config_for_shared: {
allow_all_users: true,
allowed_user_ids: ['<string>'],
not_allowed_user_ids: ['<string>']
}
}
})
};
fetch('https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"toolkit": "github",
"alias": "<string>",
"callback_url": "https://myapp.com/callback",
"experimental": {
"acl_config_for_shared": {
"allow_all_users": true,
"allowed_user_ids": [
"<string>"
],
"not_allowed_user_ids": [
"<string>"
]
}
}
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link"
payload := strings.NewReader("{\n \"toolkit\": \"github\",\n \"alias\": \"<string>\",\n \"callback_url\": \"https://myapp.com/callback\",\n \"experimental\": {\n \"acl_config_for_shared\": {\n \"allow_all_users\": true,\n \"allowed_user_ids\": [\n \"<string>\"\n ],\n \"not_allowed_user_ids\": [\n \"<string>\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"toolkit\": \"github\",\n \"alias\": \"<string>\",\n \"callback_url\": \"https://myapp.com/callback\",\n \"experimental\": {\n \"acl_config_for_shared\": {\n \"allow_all_users\": true,\n \"allowed_user_ids\": [\n \"<string>\"\n ],\n \"not_allowed_user_ids\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://backend.composio.dev/api/v3/tool_router/session/{session_id}/link");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-api-key", "<api-key>");
request.AddJsonBody("{\n \"toolkit\": \"github\",\n \"alias\": \"<string>\",\n \"callback_url\": \"https://myapp.com/callback\",\n \"experimental\": {\n \"acl_config_for_shared\": {\n \"allow_all_users\": true,\n \"allowed_user_ids\": [\n \"<string>\"\n ],\n \"not_allowed_user_ids\": [\n \"<string>\"\n ]\n }\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
false{
"link_token": "lt_abc123xyz",
"redirect_url": "https://app.composio.dev/link/lt_abc123xyz",
"connected_account_id": "ca_abc123xyz",
"experimental": {
"account_type": "PRIVATE",
"acl_config_for_shared": {
"allow_all_users": true,
"allowed_user_ids": [
"<string>"
],
"not_allowed_user_ids": [
"<string>"
]
}
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}{
"error": {
"message": "<string>",
"code": 123,
"slug": "<string>",
"status": 123,
"request_id": "<string>",
"suggested_fix": "<string>",
"errors": [
"<string>"
]
}
}