PT EN

Auditoria

URL base: $BUSINESS_API

Exportar eventos de auditoria

Registos

GET /audit/export

Time-bounded audit export in CSV or JSONL with a SHA-256 digest header

Streams every audit event of the tenant between from and to, oldest first, as a file download (Content-Disposition attachment). Response headers carry the SHA-256 of the exact bytes returned, a signature over that digest, the event count and the hash of the last event in the chain, so a recipient can check the file with sha256sum and confirm the signature through the export verify endpoint. The range must not exceed 366 days and may hold at most 200,000 events; otherwise the call answers 400 and you should narrow it. Requires audit:read.

Parâmetros

fromstring (date-time) · consulta · obrigatório

Required start of the export window as an RFC 3339 timestamp (for example 2026-01-01T00:00:00Z); it must be before to.

tostring (date-time) · consulta · obrigatório

Required end of the export window as an RFC 3339 timestamp; the window may span at most 366 days.

formatstring · consulta · opcional

Output format: jsonl (one JSON event per line, the default) or csv (header row plus one row per event, with details as a JSON string and the prev_hash and hash columns).

um de csv, jsonl

Devolve

200 Exported events

Erros 400 · 401

curl -X GET "$BUSINESS_API/audit/export" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200

Exported events

Verificar uma exportação de auditoria

Registos

POST /audit/export/verify

Check that an audit export's signature was issued by this installation

Confirms that a digest and signature taken from the headers of an audit export (GET $BUSINESS_API/audit/export) were issued by this server for the caller's tenant, so a recipient can trust a file whose SHA-256 they computed themselves. Send sha256 as the bare hexadecimal digest (without the "sha256=" prefix the X-Audit-Digest header carries) and signature as returned, with or without its "sha256=" prefix. The answer is 200 with valid true or false; a mismatch is not an error. Both fields are required (400). Requires audit:read.

Corpo application/json

sha256string · obrigatório

Hexadecimal SHA-256 of the exported file, without a prefix.

signaturestring · obrigatório

Signature from the export response headers; a leading "sha256=" is accepted.

Devolve

200 Verification result

Mostrar atributos
validboolean · obrigatório

True when this server issued the signature for this digest and the caller's tenant.

Erros 400 · 401 · 403

Permissões audit:read · Funções: admin, analyst, owner

curl -X POST "$BUSINESS_API/audit/export/verify" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "signature": "sha256=4b8e1c0f2a9d6e7b3c5a1f0e9d8c7b6a5f4e3d2c1b0a99887766554433221100"
}'
Resposta 200
{
  "valid": true
}