Create Event

Store a single audit event with full metadata, actor, target, and cryptographic hashing.

POST /events
Required Scope
This endpoint requires the events:write scope.

Request Body

Parameter Type Required Description
action string Yes The action performed (e.g., user.login, document.deleted)
actor.id string No Unique identifier of the actor performing the action
actor.type string No Type of actor (e.g., user, service, api_key)
actor.meta object No Additional metadata about the actor (name, email, IP, etc.)
target.type string No Type of resource being acted upon (e.g., document, user)
target.id string No Unique identifier of the target resource
target.meta object No Additional metadata about the target resource
context object No Contextual information (IP address, user agent, location, etc.)
diff object No State changes with before and after properties
metadata object No Additional custom metadata for the event
occurred_at string No ISO 8601 timestamp when the event occurred. Defaults to current time

Response

Returns the created event with a 201 status code.

{
  "data": {
    "id": "evt_2Nz9Q8kL3Fy",
    "sequence_number": 42315,
    "action": "document.updated",
    "actor": {
      "id": "usr_4Hx8K9mP1Qz",
      "type": "user",
      "meta": {
        "name": "Jane Doe",
        "email": "jane@example.com"
      }
    },
    "target": {
      "type": "document",
      "id": "doc_6Ry2M3nT5Wx",
      "meta": {
        "title": "Q4 Financial Report"
      }
    },
    "context": {
      "ip": "203.0.113.42",
      "user_agent": "Mozilla/5.0..."
    },
    "diff": {
      "before": { "status": "draft" },
      "after": { "status": "published" }
    },
    "metadata": {
      "department": "finance"
    },
    "hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
    "previous_hash": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
    "occurred_at": "2026-02-10T14:32:15.000000Z",
    "received_at": "2026-02-10T14:32:15.123456Z",
    "created_at": "2026-02-10T14:32:15.123456Z"
  }
}

Examples

curl -X POST https://logproof.de/v1/events \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "document.updated",
    "actor": {
      "id": "usr_4Hx8K9mP1Qz",
      "type": "user",
      "meta": {
        "name": "Jane Doe",
        "email": "jane@example.com"
      }
    },
    "target": {
      "type": "document",
      "id": "doc_6Ry2M3nT5Wx",
      "meta": {
        "title": "Q4 Financial Report"
      }
    },
    "context": {
      "ip": "203.0.113.42"
    },
    "diff": {
      "before": { "status": "draft" },
      "after": { "status": "published" }
    },
    "metadata": {
      "department": "finance"
    },
    "occurred_at": "2026-02-10T14:32:15Z"
  }'
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://logproof.de/v1/',
    'headers' => [
        'Authorization' => 'Bearer YOUR_API_KEY',
        'Content-Type' => 'application/json',
    ]
]);

$response = $client->post('events', [
    'json' => [
        'action' => 'document.updated',
        'actor' => [
            'id' => 'usr_4Hx8K9mP1Qz',
            'type' => 'user',
            'meta' => [
                'name' => 'Jane Doe',
                'email' => 'jane@example.com',
            ]
        ],
        'target' => [
            'type' => 'document',
            'id' => 'doc_6Ry2M3nT5Wx',
            'meta' => [
                'title' => 'Q4 Financial Report',
            ]
        ],
        'context' => [
            'ip' => '203.0.113.42',
        ],
        'diff' => [
            'before' => ['status' => 'draft'],
            'after' => ['status' => 'published'],
        ],
        'metadata' => [
            'department' => 'finance',
        ],
        'occurred_at' => '2026-02-10T14:32:15Z',
    ]
]);

$event = json_decode($response->getBody(), true);
const axios = require('axios');

const response = await axios.post('https://logproof.de/v1/events', {
  action: 'document.updated',
  actor: {
    id: 'usr_4Hx8K9mP1Qz',
    type: 'user',
    meta: {
      name: 'Jane Doe',
      email: 'jane@example.com'
    }
  },
  target: {
    type: 'document',
    id: 'doc_6Ry2M3nT5Wx',
    meta: {
      title: 'Q4 Financial Report'
    }
  },
  context: {
    ip: '203.0.113.42'
  },
  diff: {
    before: { status: 'draft' },
    after: { status: 'published' }
  },
  metadata: {
    department: 'finance'
  },
  occurred_at: '2026-02-10T14:32:15Z'
}, {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

const event = response.data;
import requests
from datetime import datetime

response = requests.post(
    'https://logproof.de/v1/events',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'action': 'document.updated',
        'actor': {
            'id': 'usr_4Hx8K9mP1Qz',
            'type': 'user',
            'meta': {
                'name': 'Jane Doe',
                'email': 'jane@example.com'
            }
        },
        'target': {
            'type': 'document',
            'id': 'doc_6Ry2M3nT5Wx',
            'meta': {
                'title': 'Q4 Financial Report'
            }
        },
        'context': {
            'ip': '203.0.113.42'
        },
        'diff': {
            'before': {'status': 'draft'},
            'after': {'status': 'published'}
        },
        'metadata': {
            'department': 'finance'
        },
        'occurred_at': '2026-02-10T14:32:15Z'
    }
)

event = response.json()