查詢會話
curl --request GET \
--url https://api.pathors.com/project/{projectId}/session/{sessionId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pathors.com/project/{projectId}/session/{sessionId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pathors.com/project/{projectId}/session/{sessionId}', 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.pathors.com/project/{projectId}/session/{sessionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$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.pathors.com/project/{projectId}/session/{sessionId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.pathors.com/project/{projectId}/session/{sessionId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/project/{projectId}/session/{sessionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"state": {}
}已棄用 API
查詢會話
透過會話 ID 查詢會話資訊,查看對話上下文和變數。
GET
/
project
/
{projectId}
/
session
/
{sessionId}
查詢會話
curl --request GET \
--url https://api.pathors.com/project/{projectId}/session/{sessionId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pathors.com/project/{projectId}/session/{sessionId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pathors.com/project/{projectId}/session/{sessionId}', 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.pathors.com/project/{projectId}/session/{sessionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$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.pathors.com/project/{projectId}/session/{sessionId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.pathors.com/project/{projectId}/session/{sessionId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/project/{projectId}/session/{sessionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"state": {}
}已棄用。 此端點已棄用,將於 2026-07-11 下架。在此之前仍可使用。請改用 V1 路徑—完整的新舊路徑對照見遷移指南。
基礎 URL
https://api.pathors.com
查詢會話
GET /project/{projectId}/session/{sessionId}
路徑參數
您的專案 ID
要查詢的會話唯一識別符
請求標頭
使用您的 Project API Key(以
sk_ 開頭)進行 Bearer 令牌認證。格式:Bearer {your-api-key}回應
會話 ID
包含變數、訊息和其他執行狀態資訊的會話狀態
範例
請求
curl -X GET https://api.pathors.com/project/{projectId}/session/user-123-session-456 \
--header 'Authorization: Bearer <token>'
回應
{
"sessionId": "user-123-session-456",
"state": {
"variables": {
"userName": "王小明",
"userRole": "admin"
},
"messages": [
{
"role": "user",
"content": "你好"
},
{
"role": "assistant",
"content": "您好!有什麼可以幫助您的嗎?"
}
]
}
}
使用說明
- 會話 ID: 使用透過建立會話端點建立的相同會話 ID
- 狀態結構:
state欄位包含會話執行狀態,包括變數和對話歷史記錄
錯誤回應
| 狀態碼 | 描述 |
|---|---|
| 400 | 缺少 projectId 或 sessionId |
| 401 | 無效的認證 |
| 404 | 找不到會話 |
| 500 | 內部伺服器錯誤 |
{
"error": "Session not found"
}
{
"error": {
"message": "Invalid authentication"
}
}
相關 API
⌘I
