Create link token
/link-token
Request Body
The context of the integrated account. You can find these in the Variables section of an integrated account in the Truto UI.
{
"label": "Production Hubspot Account"
}
The ID of the integrated account you want to reauthorize. Do NOT specify tenant_id if you are reauthorizing an integrated account.
1ba1f401-7183-47c5-9e39-e8e257e3c795If set to true, the context of the integrated account will be persisted when reconnecting. Set to false by default.
falseThe 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.
https://example.com/redirectThe region where the new integrated account will be placed. Only applies when creating a new integrated account via the link token (ignored for reauthorization).
wnamwnamenamapaceu
OAuth scopes to request during authentication. These scopes will take precedence over unified model scopes and integration default scopes.
["read:users","write:contacts"]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.
acme-1The ID of the static gate to associate with this integrated account. The static gate must be accessible to the user's environment.
1ba1f401-7183-47c5-9e39-e8e257e3c795Response Body
The link token that can be used to initiate a connection flow.
efe6413c-941a-4ca6-8f22-defbf758b824curl -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())