Python
token = niadra.subject_token(
phone("+14155550123"),
verification="V1",
conversation_id="call-4471",
)
# Open the MCP connection to niadra.mcp_url with the source key
# and token.headers ({"Niadra-Subject-Token": ...})const { data: token } = await niadra.subjectToken({
subject: handles.phone("+14155550123"),
verification: "V1",
conversation_id: "call-4471",
});
// Open the MCP connection with the source key and the
// "Niadra-Subject-Token" header set to token.tokencurl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/subject-tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": {
"type": "phone_e164",
"value": "+14155550123"
},
"verification": "V1",
"conversation_id": "call-4471"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subject: {type: 'phone_e164', value: '+14155550123'},
verification: 'V1',
conversation_id: 'call-4471'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/subject-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{space}.{region}.api.niadra.com/v1/subject-tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subject' => [
'type' => 'phone_e164',
'value' => '+14155550123'
],
'verification' => 'V1',
'conversation_id' => 'call-4471'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{space}.{region}.api.niadra.com/v1/subject-tokens"
payload := strings.NewReader("{\n \"subject\": {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n \"verification\": \"V1\",\n \"conversation_id\": \"call-4471\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{space}.{region}.api.niadra.com/v1/subject-tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n \"verification\": \"V1\",\n \"conversation_id\": \"call-4471\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/subject-tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subject\": {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n \"verification\": \"V1\",\n \"conversation_id\": \"call-4471\"\n}"
response = http.request(request)
puts response.read_body{
"token": "nst1.eyJleHAiOjE3NTg1NjIxMjN9.Q2sX...",
"expires_at": "2026-09-22T17:22:03Z"
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Contexto
Emitir subject_token
Um token de até 15 minutos que amarra uma conexão MCP a um cliente, e à conta dele quando houver.
POST
/
v1
/
subject-tokens
Python
token = niadra.subject_token(
phone("+14155550123"),
verification="V1",
conversation_id="call-4471",
)
# Open the MCP connection to niadra.mcp_url with the source key
# and token.headers ({"Niadra-Subject-Token": ...})const { data: token } = await niadra.subjectToken({
subject: handles.phone("+14155550123"),
verification: "V1",
conversation_id: "call-4471",
});
// Open the MCP connection with the source key and the
// "Niadra-Subject-Token" header set to token.tokencurl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/subject-tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": {
"type": "phone_e164",
"value": "+14155550123"
},
"verification": "V1",
"conversation_id": "call-4471"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subject: {type: 'phone_e164', value: '+14155550123'},
verification: 'V1',
conversation_id: 'call-4471'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/subject-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{space}.{region}.api.niadra.com/v1/subject-tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subject' => [
'type' => 'phone_e164',
'value' => '+14155550123'
],
'verification' => 'V1',
'conversation_id' => 'call-4471'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{space}.{region}.api.niadra.com/v1/subject-tokens"
payload := strings.NewReader("{\n \"subject\": {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n \"verification\": \"V1\",\n \"conversation_id\": \"call-4471\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{space}.{region}.api.niadra.com/v1/subject-tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n \"verification\": \"V1\",\n \"conversation_id\": \"call-4471\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/subject-tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subject\": {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n \"verification\": \"V1\",\n \"conversation_id\": \"call-4471\"\n}"
response = http.request(request)
puts response.read_body{
"token": "nst1.eyJleHAiOjE3NTg1NjIxMjN9.Q2sX...",
"expires_at": "2026-09-22T17:22:03Z"
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Autorizações
nia_sk_...
Corpo
application/json
Emitido pelo seu backend com a chave da fonte. O handle viaja lacrado dentro do token.
Um identificador de um sujeito num canal ou sistema: um telefone, um e-mail, um id do CRM.
Show child attributes
Show child attributes
A conta ou o parceiro em nome de quem a pessoa age.
Show child attributes
Show child attributes
Required string length:
1 - 512Required string length:
1 - 512O nível provado nesta conversa. Limitado pelo teto da fonte.
Opções disponíveis:
V0, V1, V2, V3, V4, no_customer 
