PBCP API Reference
Base URL: https://pbcp-api.pcampus.co
Local dev: http://localhost:9999
APIs
| API | Path | Purpose |
|---|---|---|
| Event API | /events | Ingest business events into the platform |
| Context API | /v1/context/* | Read aggregated business context per entity |
| Story API | /v1/story/* | Compose and resolve business stories |
| Intelligence API | /v1/intelligence/* /v1/recommendations/* | Insights, funnel analysis, recommendations |
| Business Pulse | /metrics/business-pulse | Today's business summary (Pulse dashboard) |
Authentication
Bootstrap (Phase 1): tenant scoping via header only — no token required.
x-tenant-id: pharmacy-demoProduction auth (API keys + RBAC) is deferred to a later goal.
Common headers
| Header | Required | Description |
|---|---|---|
x-tenant-id | Yes (all endpoints) | Tenant identifier |
Content-Type | Yes (POST) | application/json |
Error format
All errors return:
{
"code": "ERROR_CODE",
"message": "Human-readable description",
"details": [{ "path": "fieldName", "message": "..." }]
}| HTTP | Code | When |
|---|---|---|
400 | VALIDATION_ERROR | Missing fields or bad format |
400 | SCHEMA_VERSION_UNSUPPORTED | Unknown event schema version |
404 | NOT_FOUND | No context/story for this entity |
409 | DUPLICATE_EVENT | Same (tenantId, eventId) already stored |
500 | INTERNAL | Unexpected server error |
Health check
GET /health{ "status": "ok", "service": "pbcp-api" }