Valta Docs

Audit SDK

AuditEntry type

FieldTypeDescription
idstringEntry ID, prefixed ae_.
actionstringEvent type (e.g. transaction_blocked, agent_frozen).
agentIdstringAgent the entry is scoped to.
userIdstringUser who triggered the event, where applicable.
metadataobjectAction-specific details (amount, rule violated, etc.).
hashstringSHA-256 hash of this entry.
previousHashstringHash of the preceding entry in the chain.
createdAtstringISO 8601 timestamp.

valta.audit.list(params?)

Returns a paginated list of audit entries.

Parameters

FieldTypeDescription
agentIdstringFilter entries to a specific agent.
limitnumberResults per page.
pagenumberPage number, starting at 1.

Returns PaginatedResponse<AuditEntry>

ts
import { ValtaClient } from 'valta-sdk'

const valta = new ValtaClient({ apiKey: process.env.VALTA_API_KEY })

const { data, total } = await valta.audit.list({
  agentId: agent.id,
  limit: 50,
})

for (const entry of data) {
  console.log(entry.action, entry.createdAt)
}

valta.audit.get(entryId)

Fetches a single audit entry by ID, including its hash chain fields.

Returns AuditEntry

ts
const entry = await valta.audit.get('ae_...')

console.log(entry.action)        // e.g. 'transaction_blocked'
console.log(entry.hash)          // SHA-256 hash of this entry
console.log(entry.previousHash)  // Hash of the preceding entry
console.log(entry.metadata)      // { amount: 50, rule: 'maxPerTransaction' }

valta.audit.export(params?)

Fetches all audit entries for an agent, auto-paginating until complete. Returns the full array.

Parameters

FieldTypeDescription
agentIdstringAgent to export entries for.

Returns AuditEntry[]

ts
const entries = await valta.audit.export({ agentId: agent.id })

console.log(`Exporting ${entries.length} entries`)

// Write to a local file
import { writeFileSync } from 'fs'
writeFileSync('audit.json', JSON.stringify(entries, null, 2))

// Or stream to S3, push to a compliance system, etc.

The export includes hash and previousHash on every entry so downstream systems can independently verify the chain.


valta.audit.verify(agentId)

Walks the entire hash chain for an agent client-side and confirms no entries have been tampered with. Hashes are computed locally — the result is not influenced by Valta's servers.

Returns { intact: boolean, entriesChecked: number, firstFailedId?: string }

FieldTypeDescription
intactbooleantrue if no tampering detected.
entriesCheckednumberNumber of entries verified.
firstFailedIdstringID of the first entry where the chain broke. Only present if intact is false.
ts
const result = await valta.audit.verify(agent.id)

if (result.intact) {
  console.log(`Chain intact. ${result.entriesChecked} entries verified.`)
} else {
  console.error(`Chain broken at entry ${result.firstFailedId}`)
}

Next steps