Receive real-time notifications when memories are created or updated.

Webhooks

CortexDB can send webhook notifications when specific events occur, enabling real-time integrations with your systems.

Supported Events

EventDescription
episode.createdA new episode was ingested
episode.forgottenAn episode was forgotten
entity.createdA new entity was extracted
entity.updatedAn entity's relationships changed
extraction.completedEntity extraction finished for an episode

Configuration

Register webhooks via the admin API:

curl -X POST https://api-v1.cortexdb.ai/v1/admin/webhooks \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/cortex",
    "events": ["episode.created", "entity.created"],
    "tenant_id": "my-app",
    "secret": "your-webhook-secret"
  }'

Payload Format

{
  "event": "episode.created",
  "timestamp": "2026-03-15T10:30:01Z",
  "tenant_id": "my-app",
  "data": {
    "episode_id": "ep_abc123",
    "event_id": 42,
    "episode_type": "message",
    "source": "slack"
  }
}

Verification

Each webhook request includes an X-Cortex-Signature header (HMAC-SHA256 of the request body using your webhook secret). Verify this signature to ensure authenticity.

import hmac, hashlib

def verify_webhook(body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(f"sha256={expected}", signature)