Skip to main content
POST
/
organizations
/
{organization_id}
/
token
Generate portal token
curl --request POST \
  --url https://sandbox-api.togai.com/organizations/{organization_id}/token \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>"
}
'
import requests

url = "https://sandbox-api.togai.com/organizations/{organization_id}/token"

payload = { "email": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: '<string>'})
};

fetch('https://sandbox-api.togai.com/organizations/{organization_id}/token', 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://sandbox-api.togai.com/organizations/{organization_id}/token",
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([
'email' => '<string>'
]),
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://sandbox-api.togai.com/organizations/{organization_id}/token"

payload := strings.NewReader("{\n \"email\": \"<string>\"\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://sandbox-api.togai.com/organizations/{organization_id}/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.togai.com/organizations/{organization_id}/token")

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 \"email\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "token": "eyJraWQiOiI5YWNhYTQzNC1jYjVkLTQzOTgtOTc4OS0yZDdjNjViNzc4MDgiLCJhbGciOiJFUzI1NiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAA_72SXUvDMBiF_8oIu1hL0zad_TB3pXcyFPzCi6LEmLaBtilJOh3O_27qnBOnIjh6lbyHk3OeF_IMuFIAg0rrTmHP46Rxq1WnhUtFAxzAiQYYxSiO4yiM5w5gT91GSKLgeBCWTJr3yPWNu1fDvZItvj6hmt9IlZ5j2iuETS7sFZOeHxRhUKAQRon_AI_MCO_nUQgTlDDkk4IlcWSShCxN0i7FSKzVXNesMedA3DmTL0VvJZ2oOV156WJxl2bZ2dXp5cVfKp3J7XfYuoTm1KIx5IMw3fe59meXyvNpyXS2HZ0JqWvxmLdj4RJKRd9qz7V_ZH23DKgzw7quudKWa4-K6m1QZrxdCk6ZWne9pBVRTFm_oW_9H3ZrrCX-_an3V8I72vIgBQdcOG_Byys183uiHAQAAA.Ji5sLX1cD814Wv1kmXmJMXqW3y-HJ6oEXfggrpdf571otTywIR3fXgcKXFciUDAyt8awgp5v5wQUoGINHoirSA"
}

Authorizations

Authorization
string
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

organization_id
string
required
Id of the organization. An organization is a tenant in Togai.

Body

email
string
required
email id of the contact whose token.

Response

token
string
required
JWT bearer token of the contact.
{
  "token": "eyJraWQiOiI5YWNhYTQzNC1jYjVkLTQzOTgtOTc4OS0yZDdjNjViNzc4MDgiLCJhbGciOiJFUzI1NiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAA_72SXUvDMBiF_8oIu1hL0zad_TB3pXcyFPzCi6LEmLaBtilJOh3O_27qnBOnIjh6lbyHk3OeF_IMuFIAg0rrTmHP46Rxq1WnhUtFAxzAiQYYxSiO4yiM5w5gT91GSKLgeBCWTJr3yPWNu1fDvZItvj6hmt9IlZ5j2iuETS7sFZOeHxRhUKAQRon_AI_MCO_nUQgTlDDkk4IlcWSShCxN0i7FSKzVXNesMedA3DmTL0VvJZ2oOV156WJxl2bZ2dXp5cVfKp3J7XfYuoTm1KIx5IMw3fe59meXyvNpyXS2HZ0JqWvxmLdj4RJKRd9qz7V_ZH23DKgzw7quudKWa4-K6m1QZrxdCk6ZWne9pBVRTFm_oW_9H3ZrrCX-_an3V8I72vIgBQdcOG_Byys183uiHAQAAA.Ji5sLX1cD814Wv1kmXmJMXqW3y-HJ6oEXfggrpdf571otTywIR3fXgcKXFciUDAyt8awgp5v5wQUoGINHoirSA"
}