curl --request POST \
--url https://app.blockgence.com/v1/audit/{audit_id}/copilot \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "<string>",
"history": [
{}
],
"context": {}
}
'import requests
url = "https://app.blockgence.com/v1/audit/{audit_id}/copilot"
payload = {
"message": "<string>",
"history": [{}],
"context": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<string>', history: [{}], context: {}})
};
fetch('https://app.blockgence.com/v1/audit/{audit_id}/copilot', 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://app.blockgence.com/v1/audit/{audit_id}/copilot",
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([
'message' => '<string>',
'history' => [
[
]
],
'context' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.blockgence.com/v1/audit/{audit_id}/copilot"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"history\": [\n {}\n ],\n \"context\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.blockgence.com/v1/audit/{audit_id}/copilot")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"history\": [\n {}\n ],\n \"context\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.blockgence.com/v1/audit/{audit_id}/copilot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"history\": [\n {}\n ],\n \"context\": {}\n}"
response = http.request(request)
puts response.read_body{
"detail": "<string>",
"error": "<string>"
}{
"detail": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error": "<string>"
}Consultar al copiloto de una auditoría
Responde en lenguaje natural preguntas sobre una auditoría (su mapa, modelo de amenazas, hallazgos, pistas,
invariantes, pruebas, ejecución y revisiones) y puede registrar solicitudes de trabajo. La respuesta es un
stream SSE (text/event-stream).
Cuerpo del pedido (JSON).
message(obligatorio): la pregunta, de 1 a 4000 caracteres.history: turnos previos{role: user|assistant, content}; se usan los últimos 12.context: lo que el usuario tiene en pantalla,{section, selection: {kind, id}}. Se valida contra la auditoría: lo que no existe en ella se ignora.
Eventos, en este orden.
start{audit_id}: comienzo de la respuesta.token{text}: texto del modelo.tool{name, input}ytool_result{name, audit_id, ok, request?}: cada herramienta que usó el copiloto.requestaparece cuando registró una solicitud.notice{audit_id, notice, detail}: aviso del sistema.model_fallback(se usó el modelo por defecto),truncated(la respuesta se cortó por longitud) oempty(el modelo no devolvió texto).error{audit_id, error, detail}: falla durante la respuesta (llm_erroroaudit_source_unavailable).done{audit_id}: fin de la respuesta.
Ni notice ni error son texto del modelo.
Qué puede afirmar. Lo que dice el copiloto no es un hallazgo. Cita los hallazgos por id, con la severidad y
el grado de validación que ya tienen, y las pistas por id como «pista sin probar», sin severidad. Lo que observe
en el código y no sea un hallazgo lo plantea como pregunta. Está acotado a esta auditoría, con el mismo control
de acceso que GET /v1/audit/{audit_id}/{section}, y no tiene las herramientas de investigación de
POST /v1/copilot.
Solicitudes. request_poc (una prueba de concepto sobre una pista) y request_review (la revisión de una
función del mapa) solo registran una solicitud pendiente, que se consulta en
GET /v1/audit/{audit_id}/requests; no ejecutan nada. Se registran como máximo 3 solicitudes nuevas por
mensaje.
Errores antes del stream. Con cuerpo {"error": …, "detail": …}; en ninguno se consulta al modelo:
400 bad_ido400 audit_id_mismatch, como enGET /v1/audit/{audit_id}.403 ai_disabled: la organización desactivó la IA. No se cobra.403 read_only: el rol es de solo lectura, y las solicitudes escriben.404 not_found: la auditoría no existe o es de otra organización.422:messagevacío o de más de 4000 caracteres.503 llm_not_configured: el copiloto no está disponible en este momento.503 audit_source_unavailable: no se pudieron leer los datos de la auditoría.
Costo: 40 créditos de base. Algunas operaciones cobran menos si reutilizan un resultado guardado; nunca más.
curl --request POST \
--url https://app.blockgence.com/v1/audit/{audit_id}/copilot \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "<string>",
"history": [
{}
],
"context": {}
}
'import requests
url = "https://app.blockgence.com/v1/audit/{audit_id}/copilot"
payload = {
"message": "<string>",
"history": [{}],
"context": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<string>', history: [{}], context: {}})
};
fetch('https://app.blockgence.com/v1/audit/{audit_id}/copilot', 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://app.blockgence.com/v1/audit/{audit_id}/copilot",
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([
'message' => '<string>',
'history' => [
[
]
],
'context' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.blockgence.com/v1/audit/{audit_id}/copilot"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"history\": [\n {}\n ],\n \"context\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.blockgence.com/v1/audit/{audit_id}/copilot")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"history\": [\n {}\n ],\n \"context\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.blockgence.com/v1/audit/{audit_id}/copilot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"history\": [\n {}\n ],\n \"context\": {}\n}"
response = http.request(request)
puts response.read_body{
"detail": "<string>",
"error": "<string>"
}{
"detail": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error": "<string>"
}Autorizaciones
Encabezados
Parámetros de ruta
Cuerpo
Respuesta
Stream SSE (text/event-stream) con los eventos start, token, tool, tool_result, notice, error y done.