curl --request POST \
--url https://{tenant_id}.hanko.io/sessions/validate \
--header 'Content-Type: application/json' \
--data '
{
"session_token": "<string>"
}
'import requests
url = "https://{tenant_id}.hanko.io/sessions/validate"
payload = { "session_token": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({session_token: '<string>'})
};
fetch('https://{tenant_id}.hanko.io/sessions/validate', 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://{tenant_id}.hanko.io/sessions/validate",
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([
'session_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://{tenant_id}.hanko.io/sessions/validate"
payload := strings.NewReader("{\n \"session_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{tenant_id}.hanko.io/sessions/validate")
.header("Content-Type", "application/json")
.body("{\n \"session_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_id}.hanko.io/sessions/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"session_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"is_valid": true,
"expiration_time": "2023-11-07T05:31:56Z",
"user_id": "<string>",
"claims": {
"subject": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"expiration": "2023-11-07T05:31:56Z",
"session_id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"issued_at": "2023-11-07T05:31:56Z",
"audience": [
"<string>"
],
"issuer": "<string>",
"email": {
"address": "jsmith@example.com",
"is_primary": true,
"is_verified": true
},
"amr": [
"pwd"
]
},
"idle_expires_at": "2023-11-07T05:31:56Z"
}{
"code": 400,
"message": "Bad Request"
}{
"code": 500,
"message": "Internal Server Error"
}Validate a session
Validate a session using a session token in a request body. This endpoint updates the session’s internal last activity timestamp. This extends the idle timeout window if configured).
curl --request POST \
--url https://{tenant_id}.hanko.io/sessions/validate \
--header 'Content-Type: application/json' \
--data '
{
"session_token": "<string>"
}
'import requests
url = "https://{tenant_id}.hanko.io/sessions/validate"
payload = { "session_token": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({session_token: '<string>'})
};
fetch('https://{tenant_id}.hanko.io/sessions/validate', 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://{tenant_id}.hanko.io/sessions/validate",
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([
'session_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://{tenant_id}.hanko.io/sessions/validate"
payload := strings.NewReader("{\n \"session_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{tenant_id}.hanko.io/sessions/validate")
.header("Content-Type", "application/json")
.body("{\n \"session_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_id}.hanko.io/sessions/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"session_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"is_valid": true,
"expiration_time": "2023-11-07T05:31:56Z",
"user_id": "<string>",
"claims": {
"subject": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"expiration": "2023-11-07T05:31:56Z",
"session_id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"issued_at": "2023-11-07T05:31:56Z",
"audience": [
"<string>"
],
"issuer": "<string>",
"email": {
"address": "jsmith@example.com",
"is_primary": true,
"is_verified": true
},
"amr": [
"pwd"
]
},
"idle_expires_at": "2023-11-07T05:31:56Z"
}{
"code": 400,
"message": "Bad Request"
}{
"code": 500,
"message": "Internal Server Error"
}Body
The session token (JWT) to validate
Response
Session validation response
Indicates whether the session is valid or not
Date-time indicating the expiration of the session. Deprecated, please use claims.expiration instead.
The ID of the user the session is associated with. Deprecated, please use claims.subject instead.
The claims extracted from a JWT.
Show child attributes
Show child attributes
Timestamp (in UTC) indicating when the session will expire due to inactivity, assuming no further activity occurs before this time. Only present when idle timeout is configured. The value is capped to the JWT expiration time.
Was this page helpful?