curl --request POST \
--url https://app.trustivan.com/api/v1/scans/{id}/verdict \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://app.trustivan.com/api/v1/scans/{id}/verdict"
payload = { "policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
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({policy_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://app.trustivan.com/api/v1/scans/{id}/verdict', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/scans/{id}/verdict"
payload := strings.NewReader("{\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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))
}{
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_version": 123,
"result": "pass",
"blocking": true,
"summary": "<string>",
"evaluated_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_name": "<string>",
"considered": 123,
"suppressed": 123,
"exempt": 123,
"truncated": true,
"rules": [
{
"rule_id": "<string>",
"description": "<string>",
"effect": "fail",
"fired": true,
"matched": 123,
"threshold": 123,
"findings": [
{}
]
}
]
}{
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_version": 123,
"result": "pass",
"blocking": true,
"summary": "<string>",
"evaluated_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_name": "<string>",
"considered": 123,
"suppressed": 123,
"exempt": 123,
"truncated": true,
"rules": [
{
"rule_id": "<string>",
"description": "<string>",
"effect": "fail",
"fired": true,
"matched": 123,
"threshold": 123,
"findings": [
{}
]
}
]
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Decide whether a scan satisfied the policy
The endpoint a CI job calls to learn whether to ship.
It returns the whole decision (result, policy, version, and every rule with its match count), so a pipeline never has to interpret individual findings. TRUSTIVAN’s policy is the source of truth.
The RESULT is in the body, never in the status code. A failing verdict
is a successful request: a pipeline that treated a policy failure as an
HTTP error could not distinguish “the build should stop” from “TRUSTIVAN
is down”, and those demand opposite reactions. Branch on blocking.
Idempotent per (scan, policy version), enforced by a unique constraint:
a retried request returns 200 with the same decision rather than
recording a second one.
curl --request POST \
--url https://app.trustivan.com/api/v1/scans/{id}/verdict \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://app.trustivan.com/api/v1/scans/{id}/verdict"
payload = { "policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
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({policy_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://app.trustivan.com/api/v1/scans/{id}/verdict', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/scans/{id}/verdict"
payload := strings.NewReader("{\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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))
}{
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_version": 123,
"result": "pass",
"blocking": true,
"summary": "<string>",
"evaluated_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_name": "<string>",
"considered": 123,
"suppressed": 123,
"exempt": 123,
"truncated": true,
"rules": [
{
"rule_id": "<string>",
"description": "<string>",
"effect": "fail",
"fired": true,
"matched": 123,
"threshold": 123,
"findings": [
{}
]
}
]
}{
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_version": 123,
"result": "pass",
"blocking": true,
"summary": "<string>",
"evaluated_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"policy_name": "<string>",
"considered": 123,
"suppressed": 123,
"exempt": 123,
"truncated": true,
"rules": [
{
"rule_id": "<string>",
"description": "<string>",
"effect": "fail",
"fired": true,
"matched": 123,
"threshold": 123,
"findings": [
{}
]
}
]
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Body
Post the decision back to a GitHub pull request as a single summary comment, replacing the one the previous run left.
Supplied by the caller rather than looked up: the caller is the pipeline and the pipeline is the only thing that knows which pull request it is building: the same commit can be the head of several, and a scan carries none of its own.
Best effort. The verdict is recorded and returned whether or not GitHub accepted the comment, and a deployment with no GitHub App configured simply posts nothing.
Show child attributes
Show child attributes
Response
A decision, with its reasoning. Branch on blocking, not on the HTTP
status.