Administration
Déclencher le webhook Autopilot
Lance une exécution d’Autopilot qui suit le prompt du corps de la requête. Utile pour demander à Autopilot de mettre à jour votre documentation depuis des pipelines CI/CD, des scripts de publication ou des outils internes.
Authentifiez-vous avec une clé d’API d’organisation disposant d’un accès en écriture.
POST
/
v2
/
autopilot
/
{projectId}
/
webhook
Déclencher le webhook Autopilot
curl --request POST \
--url https://api.mintlify.com/v2/autopilot/{projectId}/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "We released v2.4 of the CLI. Add the new --watch flag to the CLI reference."
}
'import requests
url = "https://api.mintlify.com/v2/autopilot/{projectId}/webhook"
payload = { "prompt": "We released v2.4 of the CLI. Add the new --watch flag to the CLI reference." }
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({
prompt: 'We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.'
})
};
fetch('https://api.mintlify.com/v2/autopilot/{projectId}/webhook', 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/v2/autopilot/{projectId}/webhook",
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([
'prompt' => 'We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.'
]),
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/v2/autopilot/{projectId}/webhook"
payload := strings.NewReader("{\n \"prompt\": \"We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.\"\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/v2/autopilot/{projectId}/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v2/autopilot/{projectId}/webhook")
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 \"prompt\": \"We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"runId": "<string>"
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}Utilisez cet endpoint pour lancer une exécution d’Autopilot depuis vos propres outils. Chaque requête met en file d’attente une exécution qui suit le
Autopilot traite le prompt comme n’importe quelle autre exécution. Lorsqu’il ouvre ou met à jour une pull request, il assigne des relecteurs et notifie votre équipe de la même manière que pour les modifications de code. Chaque exécution apparaît comme son propre fil sur la page Autopilot.
Si Autopilot est en pause, l’exécution attend que vous repreniez Autopilot.
Cet endpoint partage une limite de débit avec Déclencher un déploiement, Déclencher une automatisation et Déclencher un webhook d’automatisation : jusqu’à 10 requêtes toutes les 10 secondes par organisation.
Une exécution coûte 250 crédits lorsqu’elle ouvre ou met à jour une pull request. Consultez Crédits Autopilot.
prompt du corps de la requête, avec le même contexte, les mêmes compétences et les mêmes paramètres de revue que les autres exécutions d’Autopilot.
Autopilot doit être activé pour le projet.
- Scripts de publication : Indiquez à Autopilot ce qui a été publié lorsque vous créez un tag ou publiez une nouvelle version d’un SDK.
- Pipelines CI/CD : Demandez à Autopilot de vérifier la documentation après un déploiement ou une fusion dans
main. - Outils internes : Envoyez des demandes de documentation depuis des tableaux de bord internes, des outils de support ou des tâches planifiées que vous exécutez déjà.
Authorization: Bearer <api-key>.
Remplacez <api-key> par une clé d’API d’organisation non expirée disposant d’un accès en écriture. Créez ou gérez vos clés sur la page API keys.
Demandez à Autopilot de documenter chaque publication depuis une GitHub Action :
.github/workflows/autopilot-release.yml
on:
release:
types: [published]
jobs:
autopilot:
runs-on: ubuntu-latest
steps:
- run: |
curl -fsS -X POST \
"https://api.mintlify.com/v2/autopilot/$PROJECT_ID/webhook" \
-H "Authorization: Bearer ${{ secrets.MINTLIFY_API_KEY }}" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg tag "$TAG" '{prompt: "Release \($tag) was published. Update the changelog and any docs it affects."}')"
env:
PROJECT_ID: ${{ vars.MINTLIFY_PROJECT_ID }}
TAG: ${{ github.event.release.tag_name }}
Autorisations
L'en-tête Authorization requiert un jeton Bearer. Utilisez une clé d'API administrateur. Il s'agit d'une clé secrète côté serveur. Générez-en une depuis la page des clés d'API de votre Dashboard.
Paramètres de chemin
L'ID de votre projet. Copiez-le depuis la page API keys de votre tableau de bord.
Corps
application/json
⌘I
Déclencher le webhook Autopilot
curl --request POST \
--url https://api.mintlify.com/v2/autopilot/{projectId}/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "We released v2.4 of the CLI. Add the new --watch flag to the CLI reference."
}
'import requests
url = "https://api.mintlify.com/v2/autopilot/{projectId}/webhook"
payload = { "prompt": "We released v2.4 of the CLI. Add the new --watch flag to the CLI reference." }
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({
prompt: 'We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.'
})
};
fetch('https://api.mintlify.com/v2/autopilot/{projectId}/webhook', 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/v2/autopilot/{projectId}/webhook",
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([
'prompt' => 'We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.'
]),
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/v2/autopilot/{projectId}/webhook"
payload := strings.NewReader("{\n \"prompt\": \"We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.\"\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/v2/autopilot/{projectId}/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v2/autopilot/{projectId}/webhook")
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 \"prompt\": \"We released v2.4 of the CLI. Add the new --watch flag to the CLI reference.\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"runId": "<string>"
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}