Audit
Compliance audit trail. The Audit API provides a complete record of all system operations and changes, enabling regulatory compliance and forensic analysis.
Methods​
| Method (TypeScript) | Method (Python) | Description | HTTP |
|---|---|---|---|
list(options?) | list(options=None) | List audit logs | GET /audit/logs |
get(logId) | get(log_id) | Retrieve audit log entry | GET /audit/logs/{id} |
create(entry) | create(entry) | Create audit log entry | POST /audit/logs |
Example​
- TypeScript
- Python
import { OptropicClient } from 'optropic';
const client = new OptropicClient({ apiKey: 'optr_live_...' });
// List audit logs with filters
const logs = await client.audit.list({
actor: 'user-456',
resource: 'asset-123',
action: 'update',
limit: 50
});
logs.entries.forEach(entry => {
console.log(`${entry.timestamp}: ${entry.action} by ${entry.actor}`);
});
from optropic import Optropic
client = Optropic(api_key="optr_live_...")
# List audit logs with filters
logs = client.audit.list({
'actor': 'user-456',
'resource': 'asset-123',
'action': 'update',
'limit': 50
})
for entry in logs['entries']:
print(f"{entry['timestamp']}: {entry['action']} by {entry['actor']}")