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>"
}Ask the copilot of an audit
Answers natural-language questions about an audit (its map, threat model, findings, leads, invariants, proofs,
execution and reviews) and can register work requests. The response is an SSE stream (text/event-stream).
Request body (JSON).
message(required): the question, 1 to 4000 characters.history: previous turns{role: user|assistant, content}; the last 12 are used.context: what the user has on screen,{section, selection: {kind, id}}. It is validated against the audit: anything that does not exist in it is ignored.
Events, in this order.
start{audit_id}: start of the response.token{text}: model text.tool{name, input}andtool_result{name, audit_id, ok, request?}: each tool the copilot used.requestappears when it registered a request.notice{audit_id, notice, detail}: system notice.model_fallback(the default model was used),truncated(the response was cut for length) orempty(the model returned no text).error{audit_id, error, detail}: failure during the response (llm_errororaudit_source_unavailable).done{audit_id}: end of the response.
Neither notice nor error is model text.
What it can assert. What the copilot says is not a finding. It cites findings by id, with the severity and
validation grade they already have, and leads by id as “unproven lead”, without severity. Anything it observes
in the code that is not a finding is raised as a question. It is limited to this audit, with the same access
control as GET /v1/audit/{audit_id}/{section}, and does not have the investigation tools of
POST /v1/copilot.
Requests. request_poc (a proof of concept on a lead) and request_review (the review of a function in the
map) only register a pending request, which is listed in GET /v1/audit/{audit_id}/requests; they do not run
anything. At most 3 new requests are registered per message.
Errors before the stream. With body {"error": …, "detail": …}; none of them queries the model:
400 bad_idor400 audit_id_mismatch, as inGET /v1/audit/{audit_id}.403 ai_disabled: the organization disabled AI. No charge.403 read_only: the role is read-only, and requests write.404 not_found: the audit does not exist or belongs to another organization.422:messageis empty or longer than 4000 characters.503 llm_not_configured: the copilot is not available at this time.503 audit_source_unavailable: the audit data could not be read.
Cost: 40 credits base. Some operations charge less when they reuse a saved result; never more.
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>"
}Authorizations
Headers
Path Parameters
Body
Response
SSE stream (text/event-stream) with the start, token, tool, tool_result, notice, error and done events.