API Reference

Activity Stream

Create Activity

  • API Name: Create Activity
  • API Route: POST /api/v1/activity-stream
  • Request:
    • Body:
json
    {
      "action": "string (required)",
      "description": "string (optional)"
    }
  • What it does: Creates a new activity entry in the activity stream for the currently authenticated user. Records the user's name, role, the action performed, and an optional description.
  • Returns: 201 with the created activity object { id, userId, userName, role, action, description, createdAt }

List Activities

  • API Name: List Activities
  • API Route: GET /api/v1/activity-stream
  • Request:
    • Query Params:

- limit (number, default: 20) - offset (number, default: 0) - userId (string, optional) — filter by user - action (string, optional) — filter by action text

  • What it does: Returns a paginated list of activity stream entries. Can be filtered by a specific user or action type. Useful for audit logs and activity feeds.
  • Returns: Array of activity objects [ { id, userId, userName, role, action, description, createdAt } ]

Get Activity

  • API Name: Get Activity by ID
  • API Route: GET /api/v1/activity-stream/[id]
  • Request:
    • Params: id (string) — Activity ID
    • Auth: Session required
  • What it does: Fetches a single activity entry by its ID.
  • Returns: The activity object. 404 if not found.

Delete Activity

  • API Name: Delete Activity
  • API Route: DELETE /api/v1/activity-stream/[id]
  • Request:
    • Params: id (string) — Activity ID
    • Auth: Session required
  • What it does: Permanently deletes a single activity entry from the activity stream.
  • Returns: { "success": true }. 404 if not found.