创建代理任务 (v1)
deprecated
已废弃:请改用 v2 create agent job。此操作会创建一个新的代理任务,该任务可根据提供的消息和 Git branch 信息生成并编辑文档。
使用管理员 API 密钥进行身份验证。
POST
/
v1
/
agent
/
{projectId}
/
job
创建代理任务(v1)
curl --request POST \
--url https://api.mintlify.com/v1/agent/{projectId}/job \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>"
}
],
"branch": "<string>",
"asDraft": false,
"model": "sonnet"
}
'import requests
url = "https://api.mintlify.com/v1/agent/{projectId}/job"
payload = {
"messages": [{ "content": "<string>" }],
"branch": "<string>",
"asDraft": False,
"model": "sonnet"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>'}],
branch: '<string>',
asDraft: false,
model: 'sonnet'
})
};
fetch('https://api.mintlify.com/v1/agent/{projectId}/job', 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.mintlify.com/v1/agent/{projectId}/job",
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([
'messages' => [
[
'content' => '<string>'
]
],
'branch' => '<string>',
'asDraft' => false,
'model' => 'sonnet'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/agent/{projectId}/job"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"branch\": \"<string>\",\n \"asDraft\": false,\n \"model\": \"sonnet\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}HttpResponse<String> response = Unirest.post("https://api.mintlify.com/v1/agent/{projectId}/job")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"branch\": \"<string>\",\n \"asDraft\": false,\n \"model\": \"sonnet\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/agent/{projectId}/job")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"branch\": \"<string>\",\n \"asDraft\": false,\n \"model\": \"sonnet\"\n}"
response = http.request(request)
puts response.read_body"<string>"此端点已废弃。请改用 v2 创建代理任务 端点。
速率限制
- 每个 Mintlify 项目每小时最多可调用 100 次
建议用法
Authorizations
Body
application/json
提供给代理的消息列表。系统始终会自动在前面添加一条默认的系统提示,因此通常只需包含用户消息。
Show child attributes
Show child attributes
代理应处理的 Git branch 名称。如省略,代理会根据消息内容生成一个 branch 名称。
控制拉取请求(PR;亦称“合并请求”/Merge Request)是以草稿模式还是非草稿模式创建。为 true 时,会创建草稿拉取请求(PR;亦称“合并请求”/Merge Request)。为 false 时(默认),会创建可供评审的常规拉取请求(PR;亦称“合并请求”/Merge Request)。
用于代理任务的 AI 模型。使用 sonnet 可获得更快、更具成本效益的处理。使用 opus 可获得能力更强但速度较慢的处理。
Available options:
sonnet, opus Response
200 - text/event-stream
代理任务创建成功。返回 Server-Sent Events 流式响应。
包含代理任务执行详情和结果的 Server-Sent Events 流。
⌘I
创建代理任务(v1)
curl --request POST \
--url https://api.mintlify.com/v1/agent/{projectId}/job \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>"
}
],
"branch": "<string>",
"asDraft": false,
"model": "sonnet"
}
'import requests
url = "https://api.mintlify.com/v1/agent/{projectId}/job"
payload = {
"messages": [{ "content": "<string>" }],
"branch": "<string>",
"asDraft": False,
"model": "sonnet"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>'}],
branch: '<string>',
asDraft: false,
model: 'sonnet'
})
};
fetch('https://api.mintlify.com/v1/agent/{projectId}/job', 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.mintlify.com/v1/agent/{projectId}/job",
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([
'messages' => [
[
'content' => '<string>'
]
],
'branch' => '<string>',
'asDraft' => false,
'model' => 'sonnet'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/agent/{projectId}/job"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"branch\": \"<string>\",\n \"asDraft\": false,\n \"model\": \"sonnet\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}HttpResponse<String> response = Unirest.post("https://api.mintlify.com/v1/agent/{projectId}/job")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"branch\": \"<string>\",\n \"asDraft\": false,\n \"model\": \"sonnet\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/agent/{projectId}/job")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"branch\": \"<string>\",\n \"asDraft\": false,\n \"model\": \"sonnet\"\n}"
response = http.request(request)
puts response.read_body"<string>"