Valta Docs
Audit SDK
AuditEntry type
| Field | Type | Description |
|---|---|---|
id | string | Entry ID, prefixed ae_. |
action | string | Event type (e.g. transaction_blocked, agent_frozen). |
agentId | string | Agent the entry is scoped to. |
userId | string | User who triggered the event, where applicable. |
metadata | object | Action-specific details (amount, rule violated, etc.). |
hash | string | SHA-256 hash of this entry. |
previousHash | string | Hash of the preceding entry in the chain. |
createdAt | string | ISO 8601 timestamp. |
valta.audit.list(params?)
Returns a paginated list of audit entries.
Parameters
| Field | Type | Description |
|---|---|---|
agentId | string | Filter entries to a specific agent. |
limit | number | Results per page. |
page | number | Page 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
| Field | Type | Description |
|---|---|---|
agentId | string | Agent 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 }
| Field | Type | Description |
|---|---|---|
intact | boolean | true if no tampering detected. |
entriesChecked | number | Number of entries verified. |
firstFailedId | string | ID 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}`)
}