Register a webhook endpoint
curl --request POST \
--url https://app.trustivan.com/api/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"url": "https://hooks.example.com/trustivan",
"events": []
}
'import requests
url = "https://app.trustivan.com/api/v1/webhooks"
payload = {
"name": "<string>",
"url": "https://hooks.example.com/trustivan",
"events": []
}
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({name: '<string>', url: 'https://hooks.example.com/trustivan', events: []})
};
fetch('https://app.trustivan.com/api/v1/webhooks', 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/webhooks"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"url\": \"https://hooks.example.com/trustivan\",\n \"events\": []\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))
}{}Register a webhook endpoint
Requires webhooks:manage, which is not grantable to an API key.
An endpoint is a destination every future event is copied to, so a
machine credential that could add one could stream a tenant’s findings
somewhere the tenant never chose.
The destination is validated before it is stored (loopback, private, link-local and metadata-service addresses are refused), but that check is the shallow half. The real control runs at connection time, on the resolved address. See docs/architecture/27-webhooks.md.
POST
/
webhooks
Register a webhook endpoint
curl --request POST \
--url https://app.trustivan.com/api/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"url": "https://hooks.example.com/trustivan",
"events": []
}
'import requests
url = "https://app.trustivan.com/api/v1/webhooks"
payload = {
"name": "<string>",
"url": "https://hooks.example.com/trustivan",
"events": []
}
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({name: '<string>', url: 'https://hooks.example.com/trustivan', events: []})
};
fetch('https://app.trustivan.com/api/v1/webhooks', 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/webhooks"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"url\": \"https://hooks.example.com/trustivan\",\n \"events\": []\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))
}{}Authorizations
Body
application/json
The event types this endpoint receives. An endpoint that received everything would be one whose owner cannot reason about what it will be sent.
Minimum array length:
1Available options:
scan.completed, verdict.recorded, finding.state_changed, finding.sla_breached, audit.recorded, nhi.finding.state_changed, nhi.credential.expiring, nhi.action.denied Response
Created. The response carries secret, the only time it is ever
returned.
The response is of type object.