Skip to content

Collector API

The HealthGuard Collector provides REST APIs for SDK event ingestion and Dashboard data queries.

Base URL: http://your-collector-host:3100

POST /api/events/batch

Batch event ingestion endpoint. The SDK calls this endpoint to report captured events.

Request

json
{
  "appKey": "web_abc123",
  "events": [
    {
      "eventId": "evt_xxx",
      "appKey": "web_abc123",
      "platform": "web",
      "type": "error",
      "timestamp": 1716192000000,
      "sessionId": "session_xxx",
      "anonymousId": "anon_xxx",
      "sdkVersion": "0.1.0",
      "errorType": "js",
      "message": "Cannot read property 'foo' of undefined",
      "stack": "...",
      "fingerprint": "js:abc123",
      "breadcrumbs": []
    }
  ]
}

Response

json
{
  "accepted": 1
}

Fields

FieldTypeRequiredDescription
appKeystringYesUnique app identifier
eventsarrayYesEvent array, min 1, max 50 items

POST /api/auth/register

User registration.

Request

json
{
  "email": "user@example.com",
  "password": "your-password"
}

Response

json
{
  "token": "session_xxx",
  "user": {
    "id": "user_xxx",
    "email": "user@example.com",
    "createdAt": 1716192000000
  }
}

POST /api/auth/login

User login.

Request

Same as /api/auth/register.

Response

Same as /api/auth/register.

GET /api/auth/me

Get current user info.

Headers

Authorization: Bearer <token>

GET /api/apps

List apps for the current user.

Headers

Authorization: Bearer <token>

POST /api/apps

Create a new app.

Headers

Authorization: Bearer <token>

Request

json
{
  "name": "My Web App",
  "type": "web"
}

GET /api/overview

Get data overview.

Query Parameters

ParameterTypeRequiredDescription
appKeystringNoFilter by app

Response

json
{
  "totals": {
    "events": 128,
    "errors": 12,
    "failedRequests": 3,
    "affectedUsers": 8,
    "issues": 5
  }
}

GET /api/issues

List issues.

Query Parameters

ParameterTypeRequiredDescription
appKeystringNoFilter by app

GET /api/issues/:id

Get issue details.

Response

json
{
  "issue": {
    "id": "web_abc123:js:def456",
    "appKey": "web_abc123",
    "fingerprint": "js:def456",
    "message": "Cannot read property 'foo' of undefined",
    "errorType": "js",
    "eventCount": 15,
    "firstSeenAt": 1716100000000,
    "lastSeenAt": 1716192000000
  },
  "events": [...]
}

Released under the MIT License.