curl -X POST https://api.mintlify.com/v1/agent/your_project_id/job \
-H "Authorization: Bearer mint_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"branch": "agent-updates",
"messages": [
{
"role": "user",
"content": "Update the getting started guide to include installation instructions for npm, yarn, and pnpm"
}
],
"asDraft": false,
"model": "sonnet"
}'
const response = await fetch(
'https://api.mintlify.com/v1/agent/your_project_id/job',
{
method: 'POST',
headers: {
'Authorization': 'Bearer mint_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
branch: 'agent-updates',
messages: [
{
role: 'user',
content: 'Update the getting started guide to include installation instructions for npm, yarn, and pnpm'
}
],
asDraft: false,
model: 'sonnet'
}),
}
);
// Handle streaming response
const reader = response.body.getReader();
while (true) {
const { done, value } = await reader.read();
if (done) break;
console.log(new TextDecoder().decode(value));
}
import requests
response = requests.post(
'https://api.mintlify.com/v1/agent/your_project_id/job',
headers={
'Authorization': 'Bearer mint_your_api_key_here',
'Content-Type': 'application/json'
},
json={
'branch': 'agent-updates',
'messages': [
{
'role': 'user',
'content': 'Update the getting started guide to include installation instructions for npm, yarn, and pnpm'
}
],
'asDraft': False,
'model': 'sonnet'
},
stream=True
)
# Handle streaming response
for chunk in response.iter_content(chunk_size=None):
print(chunk.decode('utf-8'))
Agent job created successfully (streaming response)
X-Message-Id: msg_abc123def456
Agent
Create Agent Job
Create an agent job to automatically edit your documentation
POST
/
v1
/
agent
/
{projectId}
/
job
curl -X POST https://api.mintlify.com/v1/agent/your_project_id/job \
-H "Authorization: Bearer mint_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"branch": "agent-updates",
"messages": [
{
"role": "user",
"content": "Update the getting started guide to include installation instructions for npm, yarn, and pnpm"
}
],
"asDraft": false,
"model": "sonnet"
}'
const response = await fetch(
'https://api.mintlify.com/v1/agent/your_project_id/job',
{
method: 'POST',
headers: {
'Authorization': 'Bearer mint_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
branch: 'agent-updates',
messages: [
{
role: 'user',
content: 'Update the getting started guide to include installation instructions for npm, yarn, and pnpm'
}
],
asDraft: false,
model: 'sonnet'
}),
}
);
// Handle streaming response
const reader = response.body.getReader();
while (true) {
const { done, value } = await reader.read();
if (done) break;
console.log(new TextDecoder().decode(value));
}
import requests
response = requests.post(
'https://api.mintlify.com/v1/agent/your_project_id/job',
headers={
'Authorization': 'Bearer mint_your_api_key_here',
'Content-Type': 'application/json'
},
json={
'branch': 'agent-updates',
'messages': [
{
'role': 'user',
'content': 'Update the getting started guide to include installation instructions for npm, yarn, and pnpm'
}
],
'asDraft': False,
'model': 'sonnet'
},
stream=True
)
# Handle streaming response
for chunk in response.iter_content(chunk_size=None):
print(chunk.decode('utf-8'))
Agent job created successfully (streaming response)
X-Message-Id: msg_abc123def456
This endpoint creates an agent job based on provided messages and branch information. The job executes asynchronously and returns a streaming response with the execution details and results.
If a branch doesn’t exist, the agent creates one. If files are edited successfully, a pull request is automatically created at the end of the job.
Authentication
Requires an admin API key (prefixed withmint_). Generate one on the API keys page in your dashboard.
Path Parameters
Body Parameters
string
required
The name of the Git branch that the agent should work on, will be automatically created if it doesn’t exist.
array
required
A list of messages to provide to the agent. A default system prompt is always prepended automatically, so you typically only need to include user messages.
boolean
default:false
Control whether the pull request is created in draft or non-draft mode. When true, creates a draft pull request. When false (default), creates a regular pull request ready for review.
string
default:"sonnet"
The AI model to use for the agent job. Use
sonnet for faster, cost-effective processing. Use opus for more capable, but slower processing.Possible values: sonnet, opusResponse
The endpoint returns a streaming response containing the agent job execution details and results.string
Message identifier for the created job (returned in response header).
Rate limits
The agent API has the following limits:- 100 uses per Mintlify project per hour
Suggested usage
For best results, use the useChat hook from ai-sdk to send requests and handle responses.curl -X POST https://api.mintlify.com/v1/agent/your_project_id/job \
-H "Authorization: Bearer mint_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"branch": "agent-updates",
"messages": [
{
"role": "user",
"content": "Update the getting started guide to include installation instructions for npm, yarn, and pnpm"
}
],
"asDraft": false,
"model": "sonnet"
}'
const response = await fetch(
'https://api.mintlify.com/v1/agent/your_project_id/job',
{
method: 'POST',
headers: {
'Authorization': 'Bearer mint_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
branch: 'agent-updates',
messages: [
{
role: 'user',
content: 'Update the getting started guide to include installation instructions for npm, yarn, and pnpm'
}
],
asDraft: false,
model: 'sonnet'
}),
}
);
// Handle streaming response
const reader = response.body.getReader();
while (true) {
const { done, value } = await reader.read();
if (done) break;
console.log(new TextDecoder().decode(value));
}
import requests
response = requests.post(
'https://api.mintlify.com/v1/agent/your_project_id/job',
headers={
'Authorization': 'Bearer mint_your_api_key_here',
'Content-Type': 'application/json'
},
json={
'branch': 'agent-updates',
'messages': [
{
'role': 'user',
'content': 'Update the getting started guide to include installation instructions for npm, yarn, and pnpm'
}
],
'asDraft': False,
'model': 'sonnet'
},
stream=True
)
# Handle streaming response
for chunk in response.iter_content(chunk_size=None):
print(chunk.decode('utf-8'))
Agent job created successfully (streaming response)
X-Message-Id: msg_abc123def456