Create agent job (v1)
deprecated
Deprecated: use a custom automation with a webhook trigger instead. Creates a new agent job that can generate and edit documentation based on provided messages and branch information.
Authenticate with an admin API key.
POST
/
v1
/
agent
/
{projectId}
/
job
Create agent 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>This endpoint is deprecated. Use a custom automation with a webhook trigger instead.
Rate limits
The agent API has the following limits:- 100 uses per organization per hour
Suggested usage
For best results, use the useChat hook from ai-sdk to send requests and handle responses.Authorizations
The Authorization header expects a Bearer token. Use an admin API key. This is a server-side secret key. Generate one on the API keys page in your dashboard.
Path Parameters
Your project ID. Can be copied from the API keys page in your dashboard.
Body
application/json
Response
Agent job created successfully. Returns a streaming response with Server-Sent Events.
Server-Sent Events stream containing the agent job execution details and results.
⌘I
Create agent 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>