> 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/agents/{agent_id}/versions/{version_id}

获取指定智能体版本的元数据

Reference: https://elevenlabs.io/docs/eleven-agents/api-reference/agents/versions/get

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

### Path parameters

- `agent_id` (string, required) — 智能体 ID。创建智能体时返回此值。
- `version_id` (string, required) — 版本的唯一标识符。

## Response

### 200

成功响应

- `id` (string, required)
- `agent_id` (string, required)
- `branch_id` (string, required)
- `version_description` (string, required)
- `seq_no_in_branch` (integer, required)
- `time_committed_secs` (integer, required)
- `parents` (AgentVersionParents, required)
- `access_info` (ResourceAccessInfo, optional)
- `merged_authors` (list of ResourceAccessInfo, optional) — 对于合并到主分支的操作，指在源分支上发布合并更改的人员（access_info 为执行合并的人员）。未记录时为 Null。

## Errors

### 422 Versions Get Request Unprocessable Entity Error

验证错误。

- `detail` (list of ValidationError, optional)

## Types

### AgentVersionParents

- `in_branch_parent_id` (string, optional)
- `out_of_branch_parent_id` (string, optional)
- `merged_into_branch_id` (string, optional)
- `merged_from_branch_id` (string, optional)
- `merged_from_version_id` (string, optional)
- `rebased_from_version_id` (string, optional)

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

### ValidationError

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

### ValidationErrorLocItem

- string
- integer

## Examples

**Response**

```json
{
  "id": "id",
  "agent_id": "agent_id",
  "branch_id": "branch_id",
  "version_description": "version_description",
  "seq_no_in_branch": 1,
  "time_committed_secs": 1,
  "parents": {
    "in_branch_parent_id": "in_branch_parent_id",
    "out_of_branch_parent_id": "out_of_branch_parent_id",
    "merged_into_branch_id": "merged_into_branch_id",
    "merged_from_branch_id": "merged_from_branch_id",
    "merged_from_version_id": "merged_from_version_id",
    "rebased_from_version_id": "rebased_from_version_id"
  },
  "access_info": {
    "is_creator": true,
    "creator_name": "John Doe",
    "creator_email": "john.doe@example.com",
    "role": "admin",
    "anonymous_access_level_override": "admin",
    "access_source": "creator"
  },
  "merged_authors": [
    {
      "is_creator": true,
      "creator_name": "John Doe",
      "creator_email": "john.doe@example.com",
      "role": "admin",
      "anonymous_access_level_override": "admin",
      "access_source": "creator"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t';
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/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t"

	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/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t")

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/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t");
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/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/versions/agtvrsn_0901k4aafjxxfxt93gd841r7tv5t")! 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()
```