Integrate TrustLayer logging in under 30 minutes.
Add TrustLayer logging to your AI agent in three steps. Every action your agent takes should fire a log event to our API.
After submitting your agent on the submit page, you'll receive an API key within 48 hours once your agent is verified. It looks like this:
tl_live_sk_a1b2c3d4e5f6g7h8i9j0...
Call our API whenever your agent takes an action. Your agent is identified automatically from your API key — no need to send agent_id in the body:
curl -X POST https://danidanwin.eu/trustlayer/api/log.php \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "send_email",
"result": "success",
"duration_ms": 342,
"sensitive_data": false
}'
After 10+ events, your Trust Score becomes available in your dashboard and on your public agent profile.
All API requests require your API key in the Authorization header:
Authorization: Bearer tl_live_sk_...
Never expose your API key in client-side code. Always call our API from your server or agent backend.
Log an action taken by your agent. Call this after every significant action your agent takes.
POST https://danidanwin.eu/trustlayer/api/log.php
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | string | required | Action type (e.g. send_email, create_record, read_file) |
| result | string | required | success, error, or timeout |
| duration_ms | integer | optional | How long the action took in milliseconds |
| sensitive_data | boolean | optional | Did this action touch sensitive or personal data? |
| error_code | string | optional | Error code if result is error |
{
"logged": true,
"event_id": "evt_9f8e7d6c5b4a",
"agent_score": 85,
"timestamp": "2026-03-30T10:32:00Z"
}
| Code | Error | Description |
|---|---|---|
| 401 | Missing API key | No Authorization header provided |
| 403 | Invalid or inactive API key | Key doesn't exist or agent not active yet |
| 400 | action is required | Missing required action field |
| 405 | Method not allowed | Only POST is accepted |
No SDK needed — just use requests:
import requests
API_KEY = "tl_live_sk_..."
URL = "https://danidanwin.eu/trustlayer/api/log.php"
def log_action(action, result="success", duration_ms=0, sensitive_data=False):
requests.post(URL,
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"action": action,
"result": result,
"duration_ms": duration_ms,
"sensitive_data": sensitive_data
}
)
# Example usage
log_action("send_email", result="success", duration_ms=342)
log_action("read_contract", result="success", sensitive_data=True)
log_action("create_record", result="error", error_code="DB_TIMEOUT")
No SDK needed — use native fetch:
const API_KEY = "tl_live_sk_...";
const URL = "https://danidanwin.eu/trustlayer/api/log.php";
async function logAction(action, result = "success", durationMs = 0, sensitiveData = false) {
await fetch(URL, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
action,
result,
duration_ms: durationMs,
sensitive_data: sensitiveData
})
});
}
// Example usage
await logAction("send_email", "success", 342);
await logAction("read_contract", "success", 890, true);
await logAction("create_record", "error", 0);