Get Session Status
curl --request GET \
--url https://api.example.com/v1/identity/sessions/{session_id}import requests
url = "https://api.example.com/v1/identity/sessions/{session_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/identity/sessions/{session_id}', 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://api.example.com/v1/identity/sessions/{session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/identity/sessions/{session_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/identity/sessions/{session_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/identity/sessions/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "<string>",
"error": "<string>"
}Identity
Get Session Status
Poll the status of an auth session
GET
/
v1
/
identity
/
sessions
/
{session_id}
Get Session Status
curl --request GET \
--url https://api.example.com/v1/identity/sessions/{session_id}import requests
url = "https://api.example.com/v1/identity/sessions/{session_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/identity/sessions/{session_id}', 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://api.example.com/v1/identity/sessions/{session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/identity/sessions/{session_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/identity/sessions/{session_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/identity/sessions/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "<string>",
"error": "<string>"
}Get Session Status
Poll the status of a JIT authentication session. Use this to know when the user has completed OAuth authorization.Request
curl https://api.mcprank.com/v1/identity/sessions/sess_abc123 \
-H "X-API-Key: sk_mcp_rank_..."
Path Parameters
string
required
The session ID returned from Create Auth Session
Response
string
Session status:
pending, complete, or errorstring
Error message if status is
errorStatus Values
| Status | Meaning |
|---|---|
pending | User hasn’t completed auth yet - keep polling |
complete | Auth successful - tokens stored, ready to make requests |
error | Auth failed - check error field for details |
Example Responses
Pending:{
"status": "pending"
}
{
"status": "complete"
}
{
"status": "error",
"error": "User denied access"
}
Polling Example
import asyncio
async def wait_for_auth(client, session_id, timeout=300):
"""Poll until auth completes or times out."""
elapsed = 0
while elapsed < timeout:
status = await client.check_session_status(session_id)
if status["status"] == "complete":
return True
elif status["status"] == "error":
raise Exception(f"Auth failed: {status.get('error')}")
await asyncio.sleep(1)
elapsed += 1
raise Exception("Auth timed out")
Notes
- Poll every 1-2 seconds
- Sessions expire after 5 minutes
- Once
complete, you should callinitialize()to refresh the client’s MIT - The session ID is single-use - don’t poll after receiving
completeorerror