GET /api/audit/export
Export audit log entries in CSV format with optional filtering. The CSV includes all audit fields and can be imported into spreadsheet applications or data analysis tools.Authentication
Requires session authentication via Bearer token in theAuthorization header.
Query Parameters
Start timestamp in milliseconds (Unix epoch). Filters entries with
timestamp >= from.End timestamp in milliseconds (Unix epoch). Filters entries with
timestamp <= to.Filter by service name (e.g.,
openai, anthropic, binance, custom.github).Filter by policy decision. Values:
approved, denied.Response
Returns a CSV file with the following columns:id- Unique entry IDtimestamp- Unix timestamp in millisecondsintent_type- Type of intent (currently alwaysapi_call)service- Service nameaction- HTTP method and pathdecision- Policy decision (approvedordenied)reason- Denial reason (empty for approved requests)cost_usd- Cost in USD (8 decimal places, empty if N/A)policy_version_hash- Hex-encoded Keccak256 hash of policy configintent_hash- Hex-encoded Keccak256 hash of request intentpermit_hash- Reserved for on-chain permits (currently empty)merkle_root- Hex-encoded Merkle root for integrity verification
Response Headers
Filename includes current UTC date in YYYYMMDD format.
Maximum number of rows that can be exported (100,000).
Set to
true if export was truncated due to row limit, false otherwise.Export Limits
- Maximum rows per export: 100,000
- Entries are ordered by ID descending (newest first)
- If the result exceeds 100,000 rows,
X-Export-Truncated: trueis set - Use timestamp filters (
from,to) to export data in batches
CSV Format Details
- Formula injection protection: Cells starting with
=,+,-,@, tab, or carriage return are prefixed with' - Escaping: Cells containing commas, quotes, or newlines are quoted and internal quotes are doubled
- Numeric precision:
cost_usdis formatted with 8 decimal places when present - Empty values: Null fields are represented as empty strings
Examples
Example CSV Output
Error Responses
Use Cases
- Compliance auditing: Export complete audit trails for regulatory compliance
- Cost analysis: Import into Excel/Google Sheets to analyze API costs over time
- Security investigation: Export denied requests to identify potential security threats
- Data archival: Regular exports for long-term storage and backup
- Custom reporting: Import into BI tools for custom dashboards and visualizations
Best Practices
- Batch exports: For large datasets, use
fromandtotimestamps to export in batches - Monitor truncation: Check
X-Export-Truncatedheader to detect when exports are limited - Automate backups: Schedule regular exports to maintain off-site audit log backups
- Filter strategically: Use service and decision filters to reduce export size