Passer au contenu principal
POST
/
agent
/
{projectId}
/
job
Create agent job
curl --request POST \
  --url https://api.mintlify.com/v2/agent/{projectId}/job \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>"
}
'
{
  "id": "<string>",
  "status": "active",
  "source": {
    "repository": "<string>",
    "ref": "<string>"
  },
  "model": "<string>",
  "prLink": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "archivedAt": "2023-11-07T05:31:56Z"
}
Cet endpoint crée une tâche agent qui s’exécute en arrière-plan. Contrairement à l’API v1 qui diffuse les réponses, l’API v2 renvoie immédiatement un ID de tâche que vous pouvez utiliser pour interroger le statut.

Différences clés avec v1

  • Fire-and-forget : La requête renvoie immédiatement l’ID de la tâche
  • Basé sur le polling : Utilisez Obtenir une tâche agent pour vérifier le statut et récupérer le lien PR
  • Requête simplifiée : Utilise une seule chaîne prompt au lieu d’un tableau de messages
  • Conversationnel : Envoyez des messages de suivi avec Envoyer un message

Workflow

  1. Créez une tâche avec cet endpoint
  2. Stockez l’id retourné
  3. Interrogez l’endpoint Obtenir une tâche agent jusqu’à ce que le status soit completed ou failed
  4. Récupérez le prLink de la réponse une fois la PR créée

Limites de taux

L’API agent a les limites suivantes :
  • 100 utilisations par projet Mintlify par heure

Autorisations

Authorization
string
header
requis

The Authorization header expects a Bearer token. Use an admin API key (prefixed with mint_). This is a server-side secret key. Generate one on the API keys page in your dashboard.

Paramètres de chemin

projectId
string
requis

Your project ID. Can be copied from the API keys page in your dashboard.

Corps

application/json
prompt
string
requis

The task instructions for the agent to execute.

Réponse

Agent job created successfully. The job runs in the background.

id
string

Unique identifier for the agent job.

status
enum<string>

Current status of the agent job.

Options disponibles:
active,
completed,
archived,
failed
source
object

Information about the source repository.

model
string

The AI model used for this job.

URL of the pull request created by the agent. Null until the PR is created.

createdAt
string<date-time>

Timestamp when the job was created.

archivedAt
string<date-time> | null

Timestamp when the job was archived. Null if still active.