API Reference

REST API

Nexus exposes a RESTful API for triggering webhook events, managing BOM imports, and controlling user data.

Base URL:https://nexus-integration.vercel.app/api
POST/api/integrations/webhook/triggerAUTH REQUIRED

Trigger a webhook event for a specific integration. Creates an activity log entry and broadcasts a real-time event via Pusher.

Request Body

{
  "integrationId": "sap-erp",
  "event": "inventory.sync.completed",
  "payload": {
    "records_processed": 1247,
    "sync_type": "incremental"
  }
}

Response

{
  "success": true,
  "log": {
    "id": 42,
    "integration_id": "sap-erp",
    "event": "inventory.sync.completed",
    "status": "success",
    "duration": "245ms",
    "created_at": "2026-02-13T09:30:00Z"
  }
}
POST/api/bomAUTH REQUIRED

Upload and persist a validated BOM import. Stores the file metadata and parsed row data for later retrieval.

Request Body

{
  "filename": "components_q1.csv",
  "totalRows": 150,
  "validRows": 142,
  "invalidRows": 5,
  "warningRows": 3,
  "data": [...]
}

Response

{
  "success": true,
  "import": {
    "id": 7,
    "filename": "components_q1.csv",
    "total_rows": 150,
    "created_at": "2026-02-13T10:00:00Z"
  }
}
GET/api/bomAUTH REQUIRED

Retrieve all BOM imports for the authenticated user, ordered by most recent.

Response

{
  "imports": [
    {
      "id": 7,
      "filename": "components_q1.csv",
      "total_rows": 150,
      "valid_rows": 142,
      "created_at": "2026-02-13T10:00:00Z"
    }
  ]
}
POST/api/user/resetAUTH REQUIRED

Reset all user data and re-seed with demo data. Useful for returning to a known state.

Response

{
  "success": true,
  "message": "Data reset and demo data re-seeded"
}
POST/api/user/clearAUTH REQUIRED

Clear all user data without re-seeding. Leaves the dashboard in a clean, empty state.

Response

{
  "success": true,
  "message": "All data cleared"
}
POST/api/auth/magic-link

Send a passwordless login link to the specified email address. Link expires in 10 minutes.

Request Body

{
  "email": "user@company.com"
}

Response

{
  "success": true,
  "message": "Magic link sent"
}

Authentication

Most endpoints require authentication via a NextAuth.js session cookie. When making requests from the browser, the session cookie is automatically included. For programmatic access, use the API Playground.

Cookie: authjs.session-token=eyJhbGciOi...