Administración
Activar webhook de Autopilot
Inicia una ejecución de Autopilot que sigue el prompt del cuerpo de la solicitud. Es útil para pedir a Autopilot que actualice tu documentación desde pipelines CI/CD, scripts de publicación o herramientas internas.
Autentícate con una clave de API de organización que tenga acceso de escritura.
POST
/
v2
/
autopilot
/
{projectId}
/
webhook
Activar webhook de 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>"
}Usa este endpoint para iniciar una ejecución de Autopilot desde tus propias herramientas. Cada solicitud pone en cola una ejecución que sigue el
Autopilot trabaja en el prompt como en cualquier otra ejecución. Cuando abre o actualiza una solicitud de extracción, asigna revisores y notifica a tu equipo de la misma forma que lo hace con los cambios de código. Cada ejecución aparece como su propio hilo en la página de Autopilot.
Si Autopilot está en pausa, la ejecución espera hasta que reanudes Autopilot.
Este endpoint comparte un límite de tasa con Trigger update, Activar automatización y Activar webhook de automatización: hasta 10 solicitudes cada 10 segundos por organización.
Una ejecución cuesta 250 créditos cuando abre o actualiza una solicitud de extracción. Consulta Créditos de Autopilot.
prompt del cuerpo de la solicitud, con el mismo contexto, las mismas habilidades y la misma configuración de revisión que las demás ejecuciones de Autopilot.
Autopilot debe estar habilitado para el proyecto.
- Scripts de publicación: Indica a Autopilot qué se publicó cuando creas una etiqueta o publicas una nueva versión de un SDK.
- Pipelines CI/CD: Pide a Autopilot que revise la documentación después de un despliegue o de una fusión a
main. - Herramientas internas: Envía solicitudes de documentación desde dashboards internos, herramientas de soporte o tareas programadas que ya ejecutas.
Authorization: Bearer <api-key>.
Sustituye <api-key> por una clave de API de organización sin caducar con acceso de escritura. Crea o gestiona claves en la página API keys.
Pide a Autopilot que documente cada publicación desde una 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 }}
Autorizaciones
El encabezado Authorization requiere un token de tipo Bearer. Usa una clave de API de administrador. Esta es una clave secreta del lado del servidor. Genera una en la página de claves de API de tu dashboard.
Parámetros de ruta
El ID de tu proyecto. Cópialo desde la página API keys de tu dashboard.
Cuerpo
application/json
⌘I
Activar webhook de 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>"
}