Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/lamassuiot/lamassuiot/llms.txt

Use this file to discover all available pages before exploring further.

Get Latest Events

Retrieve the latest event per event type, including metadata about when the event was last seen and how many times it has occurred.

Response

Returns an array of latest events grouped by event type.
event_type
string
Event type identifier
event
object
CloudEvent payload for the latest event
seen_at
string
Timestamp when the event was last seen
counter
integer
Number of times this event type has occurred

Example Request

curl -X GET "https://api.lamassu.io/api/alerts/v1/events/latest" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

[
  {
    "event_type": "certificate.issued",
    "event": {
      "specversion": "1.0",
      "type": "certificate.issued",
      "source": "ca-service",
      "id": "evt-123",
      "time": "2025-11-08T10:30:00Z",
      "data": {
        "certificate_id": "cert-789",
        "ca_id": "ca-1",
        "subject": "CN=device-001"
      }
    },
    "seen_at": "2025-11-08T10:30:00Z",
    "counter": 42
  },
  {
    "event_type": "device.enrolled",
    "event": {
      "specversion": "1.0",
      "type": "device.enrolled",
      "source": "dms-service",
      "id": "evt-456",
      "time": "2025-11-08T09:15:00Z",
      "data": {
        "device_id": "device-123",
        "dms_id": "dms-1"
      }
    },
    "seen_at": "2025-11-08T09:15:00Z",
    "counter": 15
  }
]

List User Subscriptions

Retrieve all alert subscriptions for a specific user.
userId
string
required
User identifier

Response

Returns an array of subscription objects.
id
string
Subscription identifier
user_id
string
User identifier
event_type
string
Event type this subscription monitors
subscription_ts
string
Timestamp when subscription was created
conditions
array
Array of condition objects for filtering events
channel
object
Notification channel configuration

Example Request

curl -X GET "https://api.lamassu.io/api/alerts/v1/user/user-123/subscriptions" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

[
  {
    "id": "sub-789",
    "user_id": "user-123",
    "event_type": "certificate.revoked",
    "subscription_ts": "2025-11-01T10:00:00Z",
    "conditions": [
      {
        "type": "JSON-PATH",
        "condition": "$.data.ca_id == 'root-ca-1'"
      }
    ],
    "channel": {
      "type": "EMAIL",
      "name": "Security Alerts",
      "config": {
        "email": "admin@example.com"
      }
    }
  },
  {
    "id": "sub-456",
    "user_id": "user-123",
    "event_type": "device.enrolled",
    "subscription_ts": "2025-10-15T14:30:00Z",
    "conditions": [],
    "channel": {
      "type": "MSTEAMS",
      "name": "Operations Channel",
      "config": {
        "webhook_url": "https://outlook.office.com/webhook/..."
      }
    }
  }
]

Subscribe to Event Type

Create a new alert subscription for a user.
userId
string
required
User identifier

Request Body

event_type
string
required
Event type to subscribe to (e.g., certificate.issued, device.enrolled, certificate.expiring)
conditions
array
Optional array of conditions to filter events
channel
object
required
Notification channel configuration

Response

Returns the updated list of all subscriptions for the user.

Example Request - Simple Email Subscription

curl -X POST "https://api.lamassu.io/api/alerts/v1/user/user-123/subscribe" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "certificate.expiring",
    "channel": {
      "type": "EMAIL",
      "name": "Certificate Expiration Alerts",
      "config": {
        "email": "admin@example.com"
      }
    }
  }'

Example Request - Conditional MS Teams Subscription

curl -X POST "https://api.lamassu.io/api/alerts/v1/user/user-123/subscribe" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "certificate.revoked",
    "conditions": [
      {
        "type": "JSON-PATH",
        "condition": "$.data.ca_id == '"'"'root-ca-1'"'"'"
      }
    ],
    "channel": {
      "type": "MSTEAMS",
      "name": "Critical Security Alerts",
      "config": {
        "webhook_url": "https://outlook.office.com/webhook/abc123..."
      }
    }
  }'

Example Request - Webhook with JavaScript Filter

curl -X POST "https://api.lamassu.io/api/alerts/v1/user/user-123/subscribe" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "device.enrolled",
    "conditions": [
      {
        "type": "JAVASCRIPT",
        "condition": "event.data.tags && event.data.tags.includes('"'"'production'"'"') && event.data.metadata.region === '"'"'us-east-1'"'"'"
      }
    ],
    "channel": {
      "type": "WEBHOOK",
      "name": "Custom Integration",
      "config": {
        "webhook_url": "https://api.example.com/alerts/device-enrolled",
        "webhook_method": "POST"
      }
    }
  }'

Unsubscribe from Event

Remove an alert subscription.
userId
string
required
User identifier
subId
string
required
Subscription identifier

Response

Returns the updated list of all subscriptions for the user.

Example Request

curl -X POST "https://api.lamassu.io/api/alerts/v1/user/user-123/unsubscribe/sub-789" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Condition Types Reference

JSON Schema

Validate event payload against a JSON Schema. The condition should be a JSON Schema object as a string. Example: Only notify if severity is critical or high
{
  "type": "JSON-SCHEMA",
  "condition": "{\"type\":\"object\",\"properties\":{\"severity\":{\"enum\":[\"critical\",\"high\"]}}}"
}

JSONPath

Use JSONPath expressions to filter events. The condition should evaluate to a boolean or match a value. Example: Only notify for specific CA
{
  "type": "JSON-PATH",
  "condition": "$.data.ca_id == 'root-ca-1'"
}
Example: Only notify if count exceeds threshold
{
  "type": "JSON-PATH",
  "condition": "$.data.failed_attempts > 5"
}

JavaScript

Use JavaScript expressions for complex filtering logic. The event is available as the event variable. Example: Multiple conditions
{
  "type": "JAVASCRIPT",
  "condition": "event.data.tags.includes('production') && event.data.severity === 'critical'"
}
Example: Time-based filtering
{
  "type": "JAVASCRIPT",
  "condition": "new Date(event.time).getHours() >= 9 && new Date(event.time).getHours() <= 17"
}

Channel Configuration Examples

Email Channel

{
  "type": "EMAIL",
  "name": "Admin Notifications",
  "config": {
    "email": "admin@example.com"
  }
}

Microsoft Teams Channel

  1. Create an Incoming Webhook in your Teams channel
  2. Copy the webhook URL
  3. Configure the channel:
{
  "type": "MSTEAMS",
  "name": "Security Team Channel",
  "config": {
    "webhook_url": "https://outlook.office.com/webhook/abc-123-def-456/IncomingWebhook/xyz-789/uuid"
  }
}

Webhook Channel (POST)

{
  "type": "WEBHOOK",
  "name": "Custom API Integration",
  "config": {
    "webhook_url": "https://api.example.com/alerts",
    "webhook_method": "POST"
  }
}

Webhook Channel (GET)

{
  "type": "WEBHOOK",
  "name": "Trigger External System",
  "config": {
    "webhook_url": "https://api.example.com/trigger?event={event_type}",
    "webhook_method": "GET"
  }
}

Best Practices

Instead of receiving notifications for every event, use conditions to filter only critical or relevant events. This prevents alert fatigue and ensures important notifications don’t get missed.
Before subscribing to critical events, test your channel configuration with less critical event types to ensure notifications are delivered correctly.
  • Email: Good for alerts that can be handled asynchronously
  • MS Teams: Best for team notifications and collaboration
  • Webhooks: Ideal for automated responses and integrations
Regularly review your subscriptions to ensure they’re still relevant and that channel configurations (webhook URLs, email addresses) are up to date.
Use JavaScript conditions to combine multiple filters for precise control over which events trigger notifications.