> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 列出测试调用

GET https://api.elevenlabs.io/v1/convai/test-invocations

列出所有测试调用，支持分页和可选的搜索筛选。

Reference: https://elevenlabs.io/docs/api-reference/tests/test-invocations/list

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Query parameters

- `agent_id` (string, optional, nullable) — 按智能体 ID 筛选
- `branch_id` (string, optional, nullable) — 按分支 ID 筛选
- `test_id` (string, optional, nullable) — 筛选包含此测试 ID 运行记录的调用
- `start_time` (integer, optional, nullable) — created_at 的包含式下限，以 Unix 秒数表示
- `end_time` (integer, optional, nullable) — created_at 的包含式上限，以 Unix 秒数表示
- `version_id` (string, optional, nullable) — 按测试运行时使用的智能体版本筛选
- `page_size` (integer, optional, default: 30) — 最多返回的测试数量。不能超过 100，默认为 30。
- `search` (string, optional, nullable) — 按名称筛选测试和文件夹的搜索查询。
- `cursor` (string, optional, nullable) — 用于获取下一页。响应中会返回游标。

## Response

### 200

成功响应

- `results` (list of TestInvocationSummaryResponseModel, required)
- `has_more` (boolean, required) — 是否还有更多可用结果
- `meta` (ListResponseMeta, optional)
- `next_cursor` (string, optional, nullable) — 用于获取下一页结果的游标

## Errors

### 422 Unprocessable Entity Error

验证错误。

- `detail` (list of ValidationError, optional)

## Types

### TestInvocationSummaryResponseModel

- `id` (string, required) — 测试调用的 ID
- `created_at_unix_secs` (integer, required) — 以 Unix 秒表示的测试调用创建时间
- `test_run_count` (integer, required) — 本次调用中的测试运行次数
- `passed_count` (integer, required) — 通过的测试运行次数
- `failed_count` (integer, required) — 失败的测试运行次数
- `pending_count` (integer, required) — 待处理的测试运行次数
- `cancelled_count` (integer, required) — 已取消的测试运行次数
- `title` (string, required) — 测试调用的标题：文件夹运行时为文件夹名称，否则为单个测试名称或测试数量。
- `agent_id` (string, optional, nullable) — 此测试调用所属的智能体 ID
- `branch_id` (string, optional, nullable) — 运行此测试调用的分支 ID
- `version_id` (string, optional, nullable) — 此测试调用所针对的智能体版本 ID。对于草稿或配置覆盖运行，这是应用未提交更改的基础版本。仅在此字段出现前记录的运行中为 None。
- `ran_against_draft` (boolean, optional, default: false) — 此次运行是否包含叠加在 version_id 之上的未提交变更（已保存的草稿或临时配置覆盖）。
- `runs_diverged_from_version` (boolean, optional, default: false) — 此次调用中的测试运行是否并非全部基于同一版本执行。当原始运行后重新提交了部分运行时会出现这种情况。为 true 时，version_id 描述的是最近一次重新提交，而非每次运行。
- `access_info` (ResourceAccessInfo, optional, nullable) — 测试调用的访问信息
- `repeat_count` (integer, optional, default: 1) — 本次调用中每项测试的重复次数
- `cancelled` (boolean, optional, default: false) — 此次测试调用是否已取消
- `credits_used` (integer, optional, nullable) — 此次调用中所有测试运行计费的积分总数。没有运行包含成本数据时为 None。
- `total_price` (double, optional, nullable) — 此次调用中所有测试运行的美元价格总额。没有运行包含价格数据时为 None。

### ListResponseMeta

- `total` (integer, optional, nullable)
- `page` (integer, optional, nullable)
- `page_size` (integer, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ResourceAccessInfo

- `is_creator` (boolean, required) — 发出请求的用户是否为该智能体的创建者
- `creator_name` (string, required) — 智能体创建者名称
- `creator_email` (string, required) — 智能体创建者的邮箱
- `role` (enum, required) — 发出请求的用户角色
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `anonymous_access_level_override` (enum, optional, nullable) — 匿名用户的访问级别。若为 None，该资源不会公开共享。
  - Allowed values: `admin`, `editor`, `commenter`, `viewer`
- `access_source` (enum, optional, nullable) — 请求用户拥有此资源访问权限的原因。'creator' = 调用者是所有者。'explicit' = 调用者（或其所属的某个工作区群组）列于 role_to_group_ids 中，且不包括工作区范围的所有人群组。'workspace_default' = 工作区范围的所有人群组列于 role_to_group_ids 中（所有非匿名工作区成员，包括管理员，均可查看此资源）。'workspace_admin' = 调用者是工作区管理员，且管理员席位是 *唯一* 的访问路径；此项仅用于其他人均无法查看的文档。这样 UI 可说明管理员绕过权限的查看者为何能看到未明确向其共享的文档。
  - Allowed values: `creator`, `explicit`, `workspace_admin`, `workspace_default`

### ValidationErrorLocItems

- string
- integer

## Examples

**Response**

```json
{
  "results": [
    {
      "id": "string",
      "created_at_unix_secs": 1,
      "test_run_count": 1,
      "passed_count": 1,
      "failed_count": 1,
      "pending_count": 1,
      "cancelled_count": 1,
      "title": "string",
      "agent_id": "string",
      "branch_id": "string",
      "version_id": "string",
      "ran_against_draft": false,
      "runs_diverged_from_version": false,
      "access_info": {
        "is_creator": true,
        "creator_name": "John Doe",
        "creator_email": "john.doe@example.com",
        "role": "admin",
        "access_source": "creator"
      },
      "repeat_count": 1,
      "cancelled": false,
      "credits_used": 1,
      "total_price": 1.1
    }
  ],
  "has_more": true,
  "meta": {
    "total": 1,
    "page": 1,
    "page_size": 1
  },
  "next_cursor": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/test-invocations"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/test-invocations';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/test-invocations"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.elevenlabs.io/v1/convai/test-invocations")

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
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/convai/test-invocations")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/test-invocations');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/test-invocations");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/test-invocations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```