---
title: "Create agent job (v1)"
method: POST
path: "/v1/agent/{projectId}/job"
deprecated: true
language: "en"
---

# Create agent job (v1)

`POST /v1/agent/{projectId}/job`

## Request

- Base URL: `https://api.mintlify.com`
- URL: `https://api.mintlify.com/v1/agent/{projectId}/job`
- Auth: HTTP bearer

> **Deprecated.**

Deprecated: use a [custom automation with a webhook trigger](/api/automations/webhook) 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.

## Path parameters

- `projectId` string, required

## Request body

- object
  - `branch` string: The name of the Git branch that the agent should work on. If omitted, the agent generates a branch name based on the message content.
  - `messages` object[], 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.
    - `role` 'system' | 'user' | 'assistant', required: The role of the message sender. Use `user` for task instructions. Use `system` to add supplementary instructions that are appended after the default system prompt (does not replace it). Use `assistant` to provide example assistant responses for few-shot prompting.
    - `content` string, required: The content of the message.
  - `asDraft` boolean: 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.
  - `model` 'sonnet' | 'opus': The AI model to use for the agent job. Use `sonnet` for faster, cost-effective processing. Use `opus` for more capable, but slower processing.

## Response `200`

Agent job created successfully. Returns a streaming response with Server-Sent Events.

## Other responses

- `400`: The request body is invalid, or the project ID is malformed. The response body describes the error.
- `401`: The API key is missing or invalid, or your plan doesn't include API access or the agent.
- `403`: AI features aren't available in your region, your API key doesn't have write access, or your request came from an IP address that isn't on your API key's allowlist.
- `404`: The project doesn't exist or doesn't belong to your organization.
- `429`: You exceeded the rate limit of 100 requests per hour per organization.

## Changes

- **2026-10-30** `3eb6a2a4ba24`: 5 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `401`
  - added the non-success response with the status `403`
  - added the non-success response with the status `404`
  - …1 more
- **2026-03-23** `ee61746251b2`: 1 breaking, 1 warning, 1 info
  - removed the media type `text/plain` for the response with the status `200`
  - the optional response header `X-Message-Id` removed for the status `200`
  - added the media type `text/event-stream` for the response with the status `200`
- **2026-03-10** `2a52ec342266`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/mintlify/apis/mintlify-admin-api/changes/v1/agent/:projectId/job/post.md)

---

[API](https://skmtc.dev/mintlify/apis/mintlify-admin-api.md) - [All operations](https://skmtc.dev/mintlify/apis/mintlify-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mintlify/apis/mintlify-admin-api/revisions/20f9b4a4a842?raw)
