curl --request GET \
--url https://app.trustivan.com/api/v1/audit/export \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.trustivan.com/api/v1/audit/export"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.trustivan.com/api/v1/audit/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/audit/export"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}"<string>"{
"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"
}Export the tamper-evident audit trail
STREAMED, not buffered: a tenant’s trail is unbounded in time, and buffering one export would cost every other tenant the memory.
Every exported event carries where it came from (source_ip,
user_agent, request_id, schema version 3) and its chain columns:
chain_seq, prev_hash, entry_hash and chain_version.
What the chain proves: tamper-EVIDENCE within the database. Each row’s
digest covers its content and its predecessor’s digest, so a row
changed, deleted or reordered in place breaks verification at that
position. The export itself is NOT signed: the digest is an unkeyed
SHA-256 computed by a trigger, so someone with full database access
can rewrite rows and recompute every later digest. An operator anchors
the chains outside the database with a signed auditctl checkpoint,
which auditctl verify --checkpoint checks history against. The header’s chain_head (position and digest at export time)
is the anchor you keep: a later export whose digest at that position
differs shows history was rewritten after this one was taken.
Recomputing digests from the exported bytes alone is not supported;
verification runs in the database (GET /authz/audit-chain, or
verify_identity_audit_chain in psql).
The chain is verified before the stream opens and the result is in the header record, along with any recorded tenant erasures. A break WITH a recorded erasure is a lawful deletion, dated and accounted for; a break WITHOUT one is somebody removing evidence, and the two must never be collapsed. A broken chain does not refuse the export: the events are still the record, and refusing would mean a tampered trail cannot be examined.
The stream is framed by a header record and a TRAILER record. The
trailer is what makes truncation detectable: a response cut off by a
proxy is indistinguishable from a complete one to a client reading to
EOF, so a missing trailer is the signal that the export is incomplete.
complete: false in the trailer means the row cap was reached.
Entitlement-gated on audit_export, checked BEFORE any row is read.
Reading the trail is not gated: a plan lapse must not hide evidence a
customer may be legally required to produce.
CSV cells beginning with a formula character are prefixed with an apostrophe. An audit trail records values a user supplied, and a spreadsheet executes such a cell on open, against exactly the person this endpoint is for.
curl --request GET \
--url https://app.trustivan.com/api/v1/audit/export \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.trustivan.com/api/v1/audit/export"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.trustivan.com/api/v1/audit/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/audit/export"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}"<string>"{
"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
Query Parameters
Response
The audit trail, streamed.
The response is of type string.