轮换仓库凭据
curl --request POST \
--url https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"authorization_token": "<string>"
}
'import requests
url = "https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}"
payload = { "authorization_token": "<string>" }
headers = {
"zai-version": "<zai-version>",
"zai-beta": "<zai-beta>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'zai-version': '<zai-version>',
'zai-beta': '<zai-beta>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({authorization_token: '<string>'})
};
fetch('https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}")
.header("zai-version", "<zai-version>")
.header("zai-beta", "<zai-beta>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"authorization_token\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}"
payload := strings.NewReader("{\n \"authorization_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("zai-version", "<zai-version>")
req.Header.Add("zai-beta", "<zai-beta>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'authorization_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"zai-beta: <zai-beta>",
"zai-version: <zai-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"type": "github_repository",
"url": "<string>",
"mount_path": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"checkout": {
"type": "branch",
"name": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": {}
},
"request_id": "req_01J..."
}Resources
轮换仓库凭据
轮换 Session 中 GitHub 仓库资源使用的凭据。
使用说明
使用说明
仅 github_repository 支持,已归档返回 400;File Resource 不支持更新。
POST
/
agent
/
managed
/
v1
/
sessions
/
{sessionId}
/
resources
/
{resourceId}
轮换仓库凭据
curl --request POST \
--url https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"authorization_token": "<string>"
}
'import requests
url = "https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}"
payload = { "authorization_token": "<string>" }
headers = {
"zai-version": "<zai-version>",
"zai-beta": "<zai-beta>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'zai-version': '<zai-version>',
'zai-beta': '<zai-beta>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({authorization_token: '<string>'})
};
fetch('https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}")
.header("zai-version", "<zai-version>")
.header("zai-beta", "<zai-beta>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"authorization_token\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}"
payload := strings.NewReader("{\n \"authorization_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("zai-version", "<zai-version>")
req.Header.Add("zai-beta", "<zai-beta>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agent-api.bigmodel.cn/api/agent/managed/v1/sessions/{sessionId}/resources/{resourceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'authorization_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"zai-beta: <zai-beta>",
"zai-version: <zai-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"type": "github_repository",
"url": "<string>",
"mount_path": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"checkout": {
"type": "branch",
"name": "<string>"
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": {}
},
"request_id": "req_01J..."
}Headers
Managed Agents API 入口要求的基础协议标识,当前只接受 2026-05-26;响应兼容形态由 zai-beta 选择。两个头均需携带。
Available options:
2026-05-26 Example:
"2026-05-26"
声明 Managed Agents Beta 协议并选择响应字段与兼容行为。新接入使用 managed-agents-2026-09-22;旧客户端仍可使用 managed-agents-2026-05-26。必须同时携带 zai-version: 2026-05-26。字段差异见 /cn/managed-agents/protocol-versions。
Example:
"managed-agents-2026-09-22"
Body
application/json
Required string length:
1 - 4096Was this page helpful?