Documentation Index
Fetch the complete documentation index at: https://docs.shieldhq.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Access Logs
Retrieve the complete access history for a policy.
Endpoint
GET /api/access-logs/{policyId}
Authorization: Bearer {token}
Parameters
| Parameter | Type | Required | Description |
|---|
policyId | string | ✅ | Policy identifier |
Response
Success (200)
{
"success": true,
"logs": [
{
"timestamp": "2025-02-22T10:30:00Z",
"txHash": "0xabc...",
"success": true,
"blockNumber": 12345678
},
{
"timestamp": "2025-02-22T11:15:00Z",
"txHash": "0xdef...",
"success": false,
"error": "Policy expired"
}
]
}
Log Entry Fields
| Field | Type | Description |
|---|
timestamp | string | ISO 8601 timestamp |
txHash | string | On-chain transaction hash |
success | boolean | Whether access was granted |
blockNumber | number | Block containing transaction |
error | string | Error message (if failed) |
Example Usage
async function getAccessLogs(policyId: string) {
const response = await fetch(`/api/access-logs/${policyId}`, {
headers: {
'Authorization': `Bearer ${token}`,
},
});
const data = await response.json();
return data.logs;
}
// Usage
const logs = await getAccessLogs('0xabc...');
const successful = logs.filter(l => l.success);
console.log(`Accessed ${successful.length} times`);
Access Control
Only the sender or recipient of a policy can view its access logs.
{
"error": "Unauthorized"
}
Rate Limits
| Limit | Value |
|---|
| Requests | 30 per minute |
On-Chain Storage
Logs are stored on-chain via the logAttempt function. The API queries both:
- Blockchain events:
VerificationAttempt events
- Database: Cached logs for performance
Data Retention
| Plan | Retention |
|---|
| Free | 30 days |
| Pro | 90 days |
| Enterprise | Unlimited |