SegOps AIDocs

Explorer API

Look up users by ID, inspect event history, check segment membership, run per-condition explain breakdowns, and simulate events with the Sandbox.

Search Users#

GET /api/explorer/users/?q=alice&limit=20

bash
curl "https://api.segops.ai/api/explorer/users/?q=alice&limit=20" \
  -H "Authorization: Bearer $JWT"
json
{
  "count": 3,
  "results": [
    {
      "user_id": "[email protected]",
      "event_count": 412,
      "first_seen": "2026-01-03T09:15:00Z",
      "last_seen": "2026-04-24T18:02:00Z"
    }
  ]
}

Get User Profile#

GET /api/explorer/users/<user_id>/

bash
curl "https://api.segops.ai/api/explorer/users/[email protected]/" \
  -H "Authorization: Bearer $JWT"
json
{
  "user_id": "[email protected]",
  "event_count": 412,
  "event_type_count": 14,
  "first_seen": "2026-01-03T09:15:00Z",
  "last_seen": "2026-04-24T18:02:00Z",
  "properties": {
    "email": "[email protected]",
    "plan": "starter",
    "company": "Acme Corp"
  }
}

List User Events#

GET /api/explorer/users/<user_id>/events/

bash
curl "https://api.segops.ai/api/explorer/users/[email protected]/events/?event_type=order_placed&limit=50" \
  -H "Authorization: Bearer $JWT"
json
{
  "count": 8,
  "results": [
    {
      "event_type": "order_placed",
      "occurred_at": "2026-04-20T11:30:00Z",
      "payload": { "total": 89.95 }
    }
  ]
}

List User's Segments#

GET /api/explorer/users/<user_id>/segments/

bash
curl "https://api.segops.ai/api/explorer/users/[email protected]/segments/" \
  -H "Authorization: Bearer $JWT"
json
[
  {
    "segment_id": 7,
    "segment_name": "High-Value Churners",
    "member_count": 3482,
    "computed_at": "2026-04-25T12:00:00Z"
  }
]

Explain Segment Membership#

GET /api/explorer/users/<user_id>/segments/<segment_id>/explain/

bash
curl "https://api.segops.ai/api/explorer/users/[email protected]/segments/7/explain/" \
  -H "Authorization: Bearer $JWT"
json
[
  {
    "index": 0,
    "type": "monetary",
    "label": "sum(order_placed.total) ≥ 500",
    "actual_value": 623.45,
    "threshold": 500,
    "matches": true
  },
  {
    "index": 1,
    "type": "recency",
    "label": "page_viewed within last 30 days",
    "actual_value": 42,
    "threshold": 30,
    "matches": false
  }
]

Sandbox — Publish & Detect Delta#

POST /api/explorer/sandbox/publish/

Test an event without permanent storage. Returns which segments the user would enter or exit.

bash
curl -X POST https://api.segops.ai/api/explorer/sandbox/publish/ \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user-test",
    "event_type": "order_placed",
    "occurred_at": "2026-04-25T14:00:00Z",
    "payload": { "total": 520 }
  }'
json
{
  "published": true,
  "entered": [
    { "id": 7, "name": "High-Value Churners" }
  ],
  "exited": [],
  "unchanged_count": 4
}