跳轉到主要內容
POST
/
v1
/
projects
/
{projectId}
/
test-cases
建立測試案例
curl --request POST \
  --url https://api.pathors.com/v1/projects/{projectId}/test-cases \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "systemPrompt": "<string>",
  "maxTurns": 123,
  "variables": {},
  "acceptanceCriteria": [
    {}
  ]
}
'

請求

POST https://api.pathors.com/v1/projects/{projectId}/test-cases

路徑參數

projectId
string
必填
專案 ID

標頭

Authorization
string
必填
使用您的 Developer Key 進行 Bearer 令牌認證

請求主體

name
string
必填
測試案例的名稱
systemPrompt
string
必填
測試中用於模擬使用者的系統提示
maxTurns
integer
必填
對話的最大輪數(最小值為 1)
variables
object
要注入測試中的變數鍵值對
acceptanceCriteria
array
驗收標準描述的陣列(字串)

回應

回傳建立的測試案例,狀態碼為 201

範例

curl -X POST https://api.pathors.com/v1/projects/{projectId}/test-cases \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Greeting flow",
    "systemPrompt": "You are a customer asking about pricing",
    "maxTurns": 5,
    "variables": { "language": "en" },
    "acceptanceCriteria": [
      "Agent should greet the user",
      "Agent should provide pricing info"
    ]
  }'
{
  "data": {
    "id": "test-case-uuid",
    "projectId": "project-uuid",
    "name": "Greeting flow",
    "systemPrompt": "You are a customer asking about pricing",
    "maxTurns": 5,
    "variables": { "language": "en" },
    "acceptanceCriteria": [
      {
        "id": "criterion-uuid-1",
        "testCaseId": "test-case-uuid",
        "description": "Agent should greet the user"
      },
      {
        "id": "criterion-uuid-2",
        "testCaseId": "test-case-uuid",
        "description": "Agent should provide pricing info"
      }
    ],
    "createdAt": "2026-03-23T00:00:00.000Z",
    "updatedAt": "2026-03-23T00:00:00.000Z"
  }
}