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>"
}Copiloto de IA de una auditoría — acotado a ella, streaming SSE
El copiloto de IA de una auditoría: responde sobre su mapa, amenazas, hallazgos, pistas, pruebas y corrida, y puede dejarle pedidos al motor. Devuelve un stream SSE.
Eventos, en este orden: start {audit_id}; token {text} (el texto del modelo); tool {name, input} y
tool_result {name, audit_id, ok, request?} por cada herramienta; notice {audit_id, notice, detail} con un
aviso del sistema (model_fallback, truncated o empty); error {audit_id, error, detail} si algo falló a
mitad (llm_error, audit_source_unavailable); done {audit_id} al final. Ni notice ni error son texto
del modelo.
Está acotado a esta auditoría: sus herramientas no reciben otro id y cada lectura pasa por el mismo aislamiento que
GET /v1/audit/{id}/{section}. No tiene las herramientas forenses del copiloto de /v1/copilot. Lo que dice no
es un hallazgo: cita hallazgos por id con su severidad y grado, y pistas por id como «sin probar». Las acciones
(request_poc sobre una pista, request_review sobre una función del mapa) solo dejan una solicitud pendiente del
motor (GET /v1/audit/{id}/requests); no corren nada.
Errores antes del stream, con cuerpo {"error":..., "detail":...}: 400 bad_id, 400 audit_id_mismatch,
404 not_found (no existe o es de otra organización), 403 ai_disabled (la organización apagó la IA, sin llamar
al modelo ni cobrar), 403 read_only (rol de solo lectura: las acciones escriben), 503 llm_not_configured (el
servidor no tiene key del LLM) y 503 audit_source_unavailable.
Costo: 40 créditos de base (solo si la respuesta es < 400; algunas rutas cobran menos si reusan un resultado guardado).
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
Caso activo (opcional): el token de un caso que podés ver. La consulta queda en el registro de actividad de ese caso y resuelve también sus labels propias. Un caso que no existe, se borró o ya no está compartido con vos da 400 case_unavailable y la consulta no se hace (sin cobro).
Parámetros de ruta
Cuerpo
Respuesta
Successful Response