Skip to content
POST /link-token

Request Body

contextRecord<string, any>

The context of the integrated account. You can find these in the Variables section of an integrated account in the Truto UI.

Example: { "label": "Production Hubspot Account" }
integrated_account_idstring · uuid

The ID of the integrated account you want to reauthorize. Do NOT specify tenant_id if you are reauthorizing an integrated account.

Example: 1ba1f401-7183-47c5-9e39-e8e257e3c795
persist_previous_contextboolean

If set to true, the context of the integrated account will be persisted when reconnecting. Set to false by default.

Example: false
redirect_uristring

The URI where the user should be redirected after the connection flow is complete. This is especially useful when you are authenticating via a Desktop app.

Example: https://example.com/redirect
regionstring

The region where the new integrated account will be placed. Only applies when creating a new integrated account via the link token (ignored for reauthorization).

Example: wnam
Possible values:
wnamenamapaceu
scopesstring[]

OAuth scopes to request during authentication. These scopes will take precedence over unified model scopes and integration default scopes.

Example: ["read:users","write:contacts"]
tenant_idstring

The ID of the tenant you want to create a link token for. Required if you are creating a link token for a new integrated account.

Example: acme-1
truto_static_gate_idstring · uuid

The ID of the static gate to associate with this integrated account. The static gate must be accessible to the user's environment.

Example: 1ba1f401-7183-47c5-9e39-e8e257e3c795

Response Body

link_tokenstring

The link token that can be used to initiate a connection flow.

Example: efe6413c-941a-4ca6-8f22-defbf758b824
curl -X POST 'https://api.truto.one/link-token' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "tenant_id": "acme-1",
  "integrated_account_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
  "context": "{\n  \"label\": \"Production Hubspot Account\"\n}\n",
  "redirect_uri": "https://example.com/redirect",
  "scopes": [
    "read:users",
    "write:contacts"
  ],
  "persist_previous_context": false,
  "truto_static_gate_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
  "region": "wnam"
}'
const body = {
  "tenant_id": "acme-1",
  "integrated_account_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
  "context": "{\n  \"label\": \"Production Hubspot Account\"\n}\n",
  "redirect_uri": "https://example.com/redirect",
  "scopes": [
    "read:users",
    "write:contacts"
  ],
  "persist_previous_context": false,
  "truto_static_gate_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
  "region": "wnam"
};

const response = await fetch('https://api.truto.one/link-token', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.truto.one/link-token"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "tenant_id": "acme-1",
    "integrated_account_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
    "context": "{\n  \"label\": \"Production Hubspot Account\"\n}\n",
    "redirect_uri": "https://example.com/redirect",
    "scopes": [
        "read:users",
        "write:contacts"
    ],
    "persist_previous_context": False,
    "truto_static_gate_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
    "region": "wnam"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.linkToken.createForNewIntegration({
  "tenant_id": "<tenant_id>"
});

console.log(result);
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    result = await truto_api.link_tokens.create({
        "tenant_id": "<tenant_id>"
    })
    print(result)

asyncio.run(main())