Audit logging.
How the platform records agent API requests and how to monitor them.
The platform records every authenticated Agent API request in the Activity logs. You get a complete audit trail of machine-to-machine operations for security reviews and compliance work.
How it works
Audit logging runs in the terminate phase, after the response has gone out to the client. This means:
- Zero latency impact: The client gets their response without waiting for the log write
- No configuration: The platform logs every authenticated request through the same Activity Log system as all other platform events
What each entry contains
Each agent request creates an activity log entry with:
| Field | Example | Description |
|---|---|---|
| Log Name | agent_api |
Category for filtering |
| Event | agent_read, agent_write, agent_delete |
Derived from HTTP method |
| Description | Agent GET /api/agent/v1/partner/clubs → 200 |
Human-readable summary |
| Causer | Partner "Coffee Corner" | The key's owner (who) |
| Subject | AgentKey "POS Terminal 1" | The key used (which) |
| Endpoint | /api/agent/v1/partner/clubs |
Full request path |
| Method | GET |
HTTP method |
| Status Code | 200 |
Response status |
| Key Prefix | rl_agent_a8f3k2m1 |
Key identification |
| Owner Type | Partner |
Role type |
| Scopes | ["read", "write:transactions"] |
Key's permissions |
| IP Address | 192.168.1.100 |
Client IP |
| User Agent | curl/8.1.2 |
Client identifier |
| Timestamp | 2026-03-06 10:15:32 |
When the request occurred |
Event types
The HTTP method determines the event:
| HTTP Method | Event | Description |
|---|---|---|
GET |
agent_read |
Data retrieval |
POST |
agent_write |
Creation or operation |
PUT / PATCH |
agent_write |
Update |
DELETE |
agent_delete |
Deletion |
Viewing agent logs
Agent API activity appears in Activity logs alongside all other platform events.
In the partner dashboard
Partners see their own agent API activity under Activity → Activity logs:
- Category filter: Select
Agent Keysto show only agent requests - Event filter: Select
Agent Read,Agent Write, orAgent Delete - Subject filter: Select
Agent Keyto see which key made the call - Agent events carry visual badges: 👁 Read (info), ⚡ Write (primary), ❌ Delete (danger)
In the admin dashboard
Admins see all agent API activity across all partners:
- Same filters as above, plus filtering by partner (causer)
- Useful for monitoring platform-wide API usage and investigating issues
See Viewing activity logs for the full filtering interface.
What the platform leaves out
For security and performance, some data never reaches the log:
- Request and response bodies: The platform never stores them. Requests may contain PII, and responses can be large.
- Failed authentication attempts: These never reach the middleware that writes the log; AuthenticateAgent rejects them earlier.
- Health checks: The platform logs them like any other request, and they contain no sensitive data.
Monitoring patterns
Detect unusual activity
Watch for:
| Pattern | What It Might Mean |
|---|---|
High volume of agent_delete events |
Unexpected bulk deletion |
| Requests from unfamiliar IPs | Key may be compromised |
Many 403 status codes |
Calls outside the key's scope |
| Requests outside business hours | Automated system or unauthorized use |
| Sudden spike in request volume | Integration error or abuse |
Audit after key compromise
If you suspect a compromised key:
- Revoke the key at once (see Managing Keys)
- Filter Activity logs for that key's prefix
- Review which endpoints the key called and what data it touched
- Create a new key with the same scopes for your legitimate integration
For developers
Agent logs use the same Activity model as all other platform logs. If you're building custom analytics or monitoring:
use App\Models\Activity;
// Get all agent API logs
$agentLogs = Activity::agentApi()->latest()->get();
// Get agent logs for a specific partner
$partnerLogs = Activity::agentApi()
->where('causer_id', $partnerId)
->where('causer_type', Partner::class)
->latest()
->get();
// Get agent write operations only
$writes = Activity::agentApi()
->forEvents(['agent_write', 'agent_delete'])
->latest()
->get();
Related topics
- Activity logs overview: The full audit trail system
- Viewing activity logs: Filtering and searching logs
- Activity log analytics: Charts and metrics
- Authentication: Key security model
- Managing Keys: Revoking compromised keys