Skip to main content

Error Events

View individual occurrences of an error.

List Events

Get all occurrences of an error:
GET /api/v1/errors/:id/events

Request

curl "https://reflex.brainzlab.ai/api/v1/errors/err_abc123/events?limit=20" \
  -H "Authorization: Bearer sk_live_xxx"

Query Parameters

ParameterTypeDescription
limitintegerMax results (default: 50)
offsetintegerPagination offset

Response

{
  "data": [
    {
      "id": "evt_xyz789",
      "timestamp": "2024-01-15T14:30:00Z",
      "user": {
        "id": "123",
        "email": "[email protected]"
      },
      "tags": {
        "feature": "checkout",
        "environment": "production"
      },
      "context": {
        "request": {
          "url": "/checkout",
          "method": "POST"
        }
      }
    }
  ],
  "meta": {
    "total": 45,
    "limit": 50,
    "offset": 0
  }
}

Get Event Details

GET /api/v1/events/:id

Response

{
  "data": {
    "id": "evt_xyz789",
    "error_id": "err_abc123",
    "timestamp": "2024-01-15T14:30:00Z",
    "exception": {
      "type": "PaymentError",
      "message": "Card declined",
      "backtrace": [
        {
          "file": "app/services/payment.rb",
          "line": 45,
          "function": "charge",
          "context": {
            "pre": ["  def charge", "    response = gateway.charge(amount)"],
            "line": "    raise PaymentError if response.failed?",
            "post": ["  end", ""]
          }
        }
      ]
    },
    "user": {
      "id": "123",
      "email": "[email protected]",
      "name": "John Doe"
    },
    "tags": {
      "feature": "checkout",
      "environment": "production"
    },
    "extra": {
      "order_id": 456,
      "amount": 99.99
    },
    "breadcrumbs": [
      {
        "timestamp": "2024-01-15T14:29:50Z",
        "category": "http",
        "message": "GET /cart",
        "level": "info"
      },
      {
        "timestamp": "2024-01-15T14:29:55Z",
        "category": "ui",
        "message": "Clicked checkout button",
        "level": "info"
      }
    ],
    "context": {
      "request": {
        "url": "https://app.example.com/checkout",
        "method": "POST",
        "headers": {
          "User-Agent": "Mozilla/5.0..."
        },
        "params": {
          "order_id": 456
        }
      },
      "environment": {
        "ruby_version": "3.2.0",
        "rails_version": "7.1.0",
        "server": "web-1"
      }
    }
  }
}

Event Stats

Get statistics about error occurrences:
GET /api/v1/errors/:id/stats

Response

{
  "data": {
    "total_occurrences": 45,
    "users_affected": 12,
    "by_hour": [
      { "hour": "2024-01-15T10:00:00Z", "count": 5 },
      { "hour": "2024-01-15T11:00:00Z", "count": 8 },
      { "hour": "2024-01-15T12:00:00Z", "count": 12 }
    ],
    "by_environment": {
      "production": 40,
      "staging": 5
    },
    "by_version": {
      "abc123": 30,
      "def456": 15
    }
  }
}