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

# Create agent job

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

## Request

- Base URL: `https://api.mintlify.com`
- URL: `https://api.mintlify.com/v2/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 runs in the background. The job processes the prompt asynchronously. Poll the get job endpoint to track progress. If the agent edits files successfully, a pull request is automatically created.

Authenticate with an admin API key.

## Path parameters

- `projectId` string, required

## Request body

- object
  - `prompt` string, required: The instruction for the agent to execute.

## Response `201`

Agent job created successfully

- AgentJob
  - `id` string: Unique identifier for the agent job.
  - `status` 'active' | 'completed' | 'archived' | 'failed': Current status of the job. `active` — the agent is currently processing the prompt. `completed` — the agent finished successfully and a PR may have been created (check `prLink`). `archived` — the job has been archived. `failed` — the agent encountered an unrecoverable error. Poll until status is `completed`, `archived`, or `failed`.
  - `source` object: Source repository information.
    - `repository` string: Full URL of the GitHub repository.
    - `ref` string, nullable: Git branch the agent is working on.
  - `model` string: The AI model used for this job.
  - `prLink` string, uri, nullable: GitHub pull request URL created by the agent. `null` while the job is still `active` or if no files were changed. Populated once the agent successfully creates a PR.
  - `createdAt` string, date-time: Timestamp when the job was created.
  - `archivedAt` string, date-time, nullable: Timestamp when the job was archived.

## Other responses

- `400`: The request is invalid. The `prompt` is missing or empty, the project's primary Git source isn't GitHub, the GitHub app isn't configured for the project, or the project ID is malformed.
- `401`: The API key is missing or invalid, or your plan doesn't include API access or the agent.
- `403`: 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, or your organization created more than 20 agent jobs in the past hour.
- `500`: An unexpected server error occurred. Retry the request. If the error continues, contact support.

## Changes

- **2026-11-10** `c184400a78ef`: 1 info
  - endpoint deprecated
- **2026-10-30** `3eb6a2a4ba24`: 4 info
  - 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`
  - added the non-success response with the status `500`
- **2026-03-12** `fe8388a0be80`: 1 warning
  - added the new `archived` enum value to the `status` response property for the response status `201`
- **2026-03-10** `2a52ec342266`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/mintlify/apis/mintlify-admin-api/changes/v2/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)
