Exchange a magic link token for a session
Consumes the one-time portal redirect (magic link) token emailed during bot signup and returns an API session. The token is a UUIDv7 that encodes its creation time; it expires after a configurable validity window (15 minutes by default) and is cleared on first use. Although the action creates a session, the route uses the GET verb because it is opened from an email link. On first use the account is also initialized. For bot signup (freemium) accounts the response is a minimal envelope containing only the api_v2_token; accounts that are permitted to use magic links but are not freemium accounts may instead receive an extended session payload when additional steps (such as two-factor authentication or identity verification) are required. This endpoint is public; the magic link token in the query string is the credential.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const response of client.botSessions.list()) {
console.log(response);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.bot_sessions.list()
print(page.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
botSessions, err := client.BotSessions.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", botSessions.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var page = client.botSessions().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.bot_sessions.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->botSessions->list();
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx bot-sessions list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/bot_sessions{
"data": {
"api_v2_token": "KEY0189A1B2C3D4E5F6071829AB3C4D5E_5FhZonmFvcw8Yq0dME27Bg"
}
}{
"errors": [
{
"detail": "Account could not be initialized"
}
]
}{
"errors": [
{
"detail": "Your sign-in link has expired. Please request a new one-time sign-in link."
}
]
}{
"errors": [
{
"detail": "Your registration cannot be accepted as it does not comply with our security standards. You may contact support for assistance."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"source": {
"pointer": "/"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}Query Parameters
Email address associated with the magic link token.
"agent-owner@example.com"
Single-use portal redirect (magic link) token, a UUIDv7 sent to the account owner's email.
"01890a7e-e2f7-7c3d-8dbb-9a2c5f3d1e0b"
Response
Session created. Bot signup accounts receive a minimal token envelope.
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const response of client.botSessions.list()) {
console.log(response);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.bot_sessions.list()
print(page.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
botSessions, err := client.BotSessions.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", botSessions.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var page = client.botSessions().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.bot_sessions.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->botSessions->list();
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx bot-sessions list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/bot_sessions{
"data": {
"api_v2_token": "KEY0189A1B2C3D4E5F6071829AB3C4D5E_5FhZonmFvcw8Yq0dME27Bg"
}
}{
"errors": [
{
"detail": "Account could not be initialized"
}
]
}{
"errors": [
{
"detail": "Your sign-in link has expired. Please request a new one-time sign-in link."
}
]
}{
"errors": [
{
"detail": "Your registration cannot be accepted as it does not comply with our security standards. You may contact support for assistance."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"source": {
"pointer": "/"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}