360
Entity index, graph, events

360 API Docs

Integration contract and Lovable prompts for writing entities, events, and relationships into the 360 company intelligence layer.

Entity Index

Every business object gets one searchable identity in 360.

Relationship Graph

Systems link records using subject, relationship, and object.

Event Timeline

Important actions become structured timeline and audit events.

How To Use 360

Why 360 Exists

360 is the company memory layer. Each business system still does its own job, but 360 keeps the shared index of what exists, how things connect, and what happened over time. That is what makes company matters searchable and queryable across departments.

The Simple Model

Everything becomes one of three simple things: Entity, Relationship, or Event. An Entity is a thing such as an employee, client, project, invoice, approval, benefit claim, or commission. A Relationship explains how two things connect. An Event records something important that happened.

Why This Works

Most company questions are really graph and timeline questions. Who worked on this project? Which invoice belongs to this client? Which approval allowed this payment? What happened to this employee this year? 360 can answer these because every module sends the same three kinds of records.

How To Use It Day To Day

Use Search when you know a name, ID, invoice number, client, project, or keyword. Open the 360 page for any result to see connected records and timeline events. Use Relationships to inspect the graph. Use Events to audit what happened recently.

How To Build Future Modules

Every new module should keep owning its own detailed business records, then send summary records to 360. When it creates or updates a record, upsert an Entity. When something important happens, create an Event. When that record connects to another record, create a Relationship.

What To Do Next

Start with shared IDs. Use one employee_id, client_id, project_id, invoice_id, approval_request_id, and claim_id across modules. Then decide which records deserve to be searchable, which events matter for audit, and which relationships help people understand context.

Questions 360 Should Answer

Show everything connected to Alice Tan.
Which approvals are linked to Receipt Claim RC-220?
What happened on Project Alpha this month?
Which invoices, claims, and approvals belong to ABC Pte Ltd?
Show annual reviews and approval history for one employee.
Which commission payouts are waiting for management approval?

Production Base URL

https://360.otg-lab.com

Field Rules

tenantIdRequired internally. Every record must belong to one tenant.
entityTypeUse lowercase snake_case such as employee, project, invoice.
entityIdUse the source system primary ID. Do not use display names as IDs.
sourceSystemUse stable names such as people_center, pm_kit, invoice_center.
visibilityLevelUse internal, finance, hr, management, or public.
correlationIdReuse one ID for a chain of actions triggered by the same workflow.
causationIdUse the ID of the event or record that caused this event.
metadataStore useful small context only. Full business records stay in the source system.

API Contract

GET/health

Health Check

Check whether 360 is deployed, which commit is running, and whether the database is configured/connected without exposing secrets.

{
  "status": "ok",
  "databaseConfigured": true,
  "databaseConnected": true,
  "checkedAt": "2026-05-27T00:00:00.000Z",
  "commit": {
    "sha": "c48f7085ef28716bc4d7bc186b90f0bcc78b0fec",
    "shortSha": "c48f708",
    "committedAt": "2026-05-24T21:16:17+08:00",
    "branch": "main"
  }
}
POST/api/360/entities/upsert

Upsert Entity

Create or update the searchable index record for any business object.

{
  "entityType": "project",
  "entityId": "project_alpha",
  "sourceSystem": "pm_kit",
  "displayName": "Project Alpha Website Revamp",
  "status": "in_progress",
  "visibilityLevel": "internal",
  "searchableText": "Project Alpha Website Revamp ABC Pte Ltd",
  "metadata": {
    "budget": 18000,
    "currency": "SGD",
    "stage": "Build"
  }
}
POST/api/360/events

Create Event

Record a timeline/audit event for an indexed company matter.

{
  "eventType": "project.status_changed",
  "sourceSystem": "pm_kit",
  "entityType": "project",
  "entityId": "project_alpha",
  "entityDisplayName": "Project Alpha Website Revamp",
  "actorEmployeeId": "emp_alice_tan",
  "occurredAt": "2026-05-23T03:00:00.000Z",
  "correlationId": "corr_project_alpha_status",
  "changeSummary": "Project Alpha moved from Kickoff to Build.",
  "oldValue": { "status": "kickoff" },
  "newValue": { "status": "build" },
  "visibilityLevel": "internal",
  "permissionScope": "tenant",
  "metadata": {
    "reason": "Kickoff completed"
  }
}
POST/api/360/relationships

Link Entities

Create a graph relationship between two company objects.

{
  "subjectType": "invoice",
  "subjectId": "inv_1001",
  "relationshipType": "billed_for",
  "objectType": "project",
  "objectId": "project_alpha",
  "sourceSystem": "invoice_center",
  "sourceRecordType": "invoice",
  "sourceRecordId": "inv_1001",
  "createdBy": "emp_ben_lim",
  "metadata": {
    "amount": 9000,
    "currency": "SGD"
  }
}
GET/api/360/entities/:entityType/:entityId

Get Entity 360

Return profile, inbound links, outbound links, events, notes, and attachments for one object.

{
  "entity": {},
  "inboundRelationships": [],
  "outboundRelationships": [],
  "events": [],
  "notes": [],
  "attachments": []
}

Lovable Prompts

For Any New Lovable System

Build this system so every important record writes into OTG Lab 360.

360 production base URL:
https://360.otg-lab.com

Before integrating, check:
GET https://360.otg-lab.com/health

Use the 360 contract:
1. When a record is created or updated, call:
   POST https://360.otg-lab.com/api/360/entities/upsert
2. When something important happens, call:
   POST https://360.otg-lab.com/api/360/events
3. When this record is connected to another record, call:
   POST https://360.otg-lab.com/api/360/relationships

Use these shared identifiers where available:
- employee_id
- client_id
- project_id
- invoice_id
- approval_request_id

Do not create separate unlinked staff, client, or project identities. Reference the shared IDs.

People Center Prompt

Integrate People Center with OTG Lab 360.

360 production base URL:
https://360.otg-lab.com

Health check:
GET https://360.otg-lab.com/health

When an employee is created or updated:
Call POST https://360.otg-lab.com/api/360/entities/upsert
- upsert entityType "employee"
- entityId must be the employee_id
- sourceSystem must be "people_center"
- searchableText should include name, email, department, title, and manager name
- metadata should include department, title, employmentStatus, employmentType, managerEmployeeId

Create relationships:
Call POST https://360.otg-lab.com/api/360/relationships
- employee reports_to employee
- employee belongs_to department

Create events:
Call POST https://360.otg-lab.com/api/360/events
- employee.created
- employee.manager_changed
- employee.status_changed
- employee.offboarded

Approval Center Prompt

Integrate Approval Center with OTG Lab 360.

360 production base URL:
https://360.otg-lab.com

Health check:
GET https://360.otg-lab.com/health

When an approval request is created:
Call POST https://360.otg-lab.com/api/360/entities/upsert
- upsert entityType "approval_request"
- entityId must be approval_request_id
- sourceSystem must be "approval_center"
- status should be pending_approval, approved, rejected, or cancelled

Create relationships:
Call POST https://360.otg-lab.com/api/360/relationships
- approval_request approves [target entity]
- employee requested approval_request
- employee approved approval_request
- employee rejected approval_request

Create events:
Call POST https://360.otg-lab.com/api/360/events
- approval.created
- approval.step_assigned
- approval.approved
- approval.rejected
- approval.completed

Benefit Center Prompt

Integrate Benefit Center with OTG Lab 360.

360 production base URL:
https://360.otg-lab.com

Health check:
GET https://360.otg-lab.com/health

When a benefit claim is submitted:
Call POST https://360.otg-lab.com/api/360/entities/upsert
- upsert entityType "benefit_claim"
- entityId must be benefit_claim_id
- sourceSystem must be "benefit_center"
- visibilityLevel should usually be "hr" or "finance"

Create relationships:
Call POST https://360.otg-lab.com/api/360/relationships
- employee submitted benefit_claim
- benefit_claim requires approval_request
- benefit_claim linked_to benefit_policy

Create events:
Call POST https://360.otg-lab.com/api/360/events
- benefit_claim.submitted
- benefit_claim.approved
- benefit_claim.rejected
- benefit_claim.paid

Commission Center Prompt

Integrate Commission Center with OTG Lab 360.

360 production base URL:
https://360.otg-lab.com

Health check:
GET https://360.otg-lab.com/health

When commission is calculated:
Call POST https://360.otg-lab.com/api/360/entities/upsert
- upsert entityType "commission"
- entityId must be commission_id
- sourceSystem must be "commission_center"
- visibilityLevel should be "management" or "finance"

Create relationships:
Call POST https://360.otg-lab.com/api/360/relationships
- employee earned commission
- commission generated_from deal
- commission based_on invoice
- commission requires approval_request

Create events:
Call POST https://360.otg-lab.com/api/360/events
- commission.calculated
- commission.adjusted
- commission.approved
- commission.paid