Skip to main content

Audit

Every significant action in AgentHiFive is recorded as an audit event -- token vends, execution requests, policy changes, approval decisions, rate limit violations, and more. The audit API provides querying and export capabilities for compliance and debugging.

Endpoint Summary

MethodEndpointDescription
GET/v1/auditList audit events (paginated)
GET/v1/audit/exportExport audit events as JSON or CSV

Audit Event Shape

Each audit event contains:

{
"id": "uuid",
"auditId": "uuid",
"timestamp": "2025-06-01T12:00:00Z",
"actor": "user-id",
"agentId": "uuid-or-null",
"connectionId": "uuid-or-null",
"action": "execution_completed",
"decision": "allowed",
"metadata": {
"model": "B",
"method": "GET",
"path": "/gmail/v1/users/me/messages",
"responseStatus": 200,
"dataSize": 4096,
"provider": "google"
}
}
FieldTypeDescription
idstringInternal row ID
auditIdstringPublic audit event ID (used as cursor for pagination)
timestampstringISO 8601 timestamp
actorstringUser ID who triggered the action
agentIdstring?Agent involved (if applicable)
connectionIdstring?Connection involved (if applicable)
actionstringEvent type (see action types below)
decisionstringOutcome: allowed, denied, etc.
metadataobjectAction-specific details

Action Types

ActionDescription
token_vendedModel A: access token successfully returned
token_vend_deniedModel A: token vend blocked (policy, time window, rate limit)
execution_requestedModel B: proxy request initiated
execution_completedModel B: proxy request completed successfully
execution_deniedModel B: request blocked (allowlist, SSRF, policy rule, chat restriction)
execution_errorModel B: provider request failed
rate_limit_exceededRequest blocked by rate limiting
approval_requestedStep-up approval created
approval_approvedStep-up approval granted
approval_deniedStep-up approval rejected
approval_expiredStep-up approval expired (5 min timeout)
connection_revokedConnection revoked by user
connection_needs_reauthConnection marked as needing reauthentication
credential_resolvedCredential resolved via /credentials/resolve
policy_createdNew policy created
policy_updatedPolicy settings, allowlists, rate limits, time windows, or rules updated
policy_deletedPolicy removed
agent_updatedAgent name/description/icon changed
agent_deletedAgent permanently deleted

List Audit Events

GET /v1/audit

Returns paginated audit events for the current workspace, ordered by timestamp (newest first). Uses cursor-based pagination.

Query Parameters

ParameterTypeDescription
agentIduuidFilter by agent
connectionIduuidFilter by connection
actionstringFilter by action type (e.g., token_vended, execution_completed)
dateFromdatetimeStart of date range (ISO 8601)
dateTodatetimeEnd of date range (ISO 8601)
cursorstringCursor (auditId) from previous page's nextCursor
limitnumberPage size (default: 50, max: 200)

Response

{
"events": [ ... ],
"nextCursor": "audit-id-or-null"
}

Pass nextCursor as the cursor query parameter to fetch the next page. When nextCursor is null, there are no more results.

Example: Paginated Query

# First page
curl -H "Authorization: Bearer $JWT" \
"http://localhost:8080/v1/audit?limit=20&action=execution_completed"

# Next page (use nextCursor from previous response)
curl -H "Authorization: Bearer $JWT" \
"http://localhost:8080/v1/audit?limit=20&action=execution_completed&cursor=prev-audit-id"

Example: Filter by Date Range

curl -H "Authorization: Bearer $JWT" \
"http://localhost:8080/v1/audit?dateFrom=2025-06-01T00:00:00Z&dateTo=2025-06-30T23:59:59Z"

Export Audit Events

GET /v1/audit/export

Exports all matching audit events as a downloadable file. Supports the same filters as the list endpoint but returns the full dataset without pagination.

Query Parameters

ParameterTypeDescription
formatstringExport format: json (default) or csv
agentIduuidFilter by agent
connectionIduuidFilter by connection
actionstringFilter by action type
dateFromdatetimeStart of date range
dateTodatetimeEnd of date range

Example: JSON Export

curl -H "Authorization: Bearer $JWT" \
"http://localhost:8080/v1/audit/export?format=json&dateFrom=2025-06-01T00:00:00Z" \
-o audit-export.json

Example: CSV Export

curl -H "Authorization: Bearer $JWT" \
"http://localhost:8080/v1/audit/export?format=csv" \
-o audit-export.csv

CSV columns: audit_id, timestamp, actor, agent_id, connection_id, action, decision, metadata

Workspace Scoping

Audit events are scoped to the current workspace. An event is visible if any of the following are true:

  • The actor matches the authenticated user
  • The agentId belongs to a workspace agent
  • The connectionId belongs to a workspace connection

This ensures workspace isolation while still showing all relevant activity.