Core Resources API

ProBeya organizes data in a three-level hierarchy: Organization > Workspace > Project. This maps directly to how pharma companies structure operations: the organization is the tenant (e.g., Acme Pharma), workspaces are sites, departments, or areas (up to 3 levels deep), and projects are where boards, items, KPIs, and actions live.

Quick Start

Create a site workspace, add a quality department, then create a project — all in under 30 seconds:

# 1. Create the site workspace
curl -X POST https://acme.probeya.com/api/v1/workspaces \
  -H "Authorization: Bearer probeya_sk_live_7f3a..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Brussels Manufacturing Site",
    "slug": "brussels-site"
  }'

# 2. Create the quality department under the site
curl -X POST https://acme.probeya.com/api/v1/workspaces \
  -H "Authorization: Bearer probeya_sk_live_7f3a..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Quality Assurance",
    "slug": "qa-dept",
    "parentId": "clx9ws001"
  }'

# 3. Create the OEE project inside the QA department
curl -X POST https://acme.probeya.com/api/v1/projects \
  -H "Authorization: Bearer probeya_sk_live_7f3a..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "OEE Improvement Q2-2026",
    "slug": "oee-q2-2026",
    "workspaceId": "clx9ws002"
  }'

Authentication

All endpoints require a valid Bearer token (API key) or session cookie. Organization context is resolved from the API key’s bound organization.

curl -H "Authorization: Bearer probeya_sk_live_7f3a..." \
     https://acme.probeya.com/api/v1/organizations

Generate an API key from Settings > API Keys in the ProBeya web app. Each key is scoped to a specific organization and user.


Organizations

GET /api/v1/organizations

List all organizations the authenticated user is a member of.

tRPC: organizations.list | Scope: read:items | Org context: Not required

curl -H "Authorization: Bearer probeya_sk_live_7f3a..." \
     https://acme.probeya.com/api/v1/organizations

Response:

{
  "data": [
    {
      "id": "clx9abc123def",
      "name": "Acme Pharma",
      "slug": "acme",
      "plan": "pro",
      "logo": "https://cdn.probeya.com/orgs/acme-logo.png",
      "createdAt": "2026-01-15T10:00:00.000Z",
      "role": "org_owner",
      "roles": ["org_owner"]
    },
    {
      "id": "clx9xyz789ghi",
      "name": "Acme Biologics (EU)",
      "slug": "acme-bio-eu",
      "plan": "enterprise",
      "logo": null,
      "createdAt": "2026-03-01T08:00:00.000Z",
      "role": "org_member",
      "roles": ["org_member", "workspace_admin"]
    }
  ]
}

Errors:

CodeDescriptionCauseFix
401UNAUTHORIZEDMissing or expired Bearer tokenRegenerate your API key from Settings > API Keys
500INTERNAL_SERVER_ERRORDatabase connection failureRetry after a brief delay; contact support if persistent

Workspaces

Workspaces represent the physical or logical structure of your organization. They nest up to 3 levels deep following the pattern Site (L1) > Department (L2) > Area (L3).

GET /api/v1/workspaces

List all workspaces in the current organization. Returns a flat list with parentId and level fields for client-side tree rendering.

tRPC: workspaces.list | Scope: read:items | Org context: Required

curl -H "Authorization: Bearer probeya_sk_live_7f3a..." \
     https://acme.probeya.com/api/v1/workspaces

Response:

{
  "data": [
    {
      "id": "clx9ws001",
      "name": "Brussels Manufacturing Site",
      "slug": "brussels-site",
      "level": 1,
      "parentId": null,
      "organizationId": "clx9abc123def",
      "createdAt": "2026-01-20T08:00:00.000Z",
      "updatedAt": "2026-01-20T08:00:00.000Z"
    },
    {
      "id": "clx9ws002",
      "name": "Quality Assurance",
      "slug": "qa-dept",
      "level": 2,
      "parentId": "clx9ws001",
      "organizationId": "clx9abc123def",
      "createdAt": "2026-01-21T09:00:00.000Z",
      "updatedAt": "2026-01-21T09:00:00.000Z"
    },
    {
      "id": "clx9ws003",
      "name": "Sterile Filling Area",
      "slug": "sterile-filling",
      "level": 3,
      "parentId": "clx9ws002",
      "organizationId": "clx9abc123def",
      "createdAt": "2026-02-10T07:30:00.000Z",
      "updatedAt": "2026-02-10T07:30:00.000Z"
    }
  ]
}

tRPC-only: Use workspaces.getTree to get a pre-built nested tree structure instead of a flat list.

Errors:

CodeDescriptionCauseFix
401UNAUTHORIZEDMissing or invalid authenticationCheck your Bearer token
403FORBIDDENNo organization context resolvedEnsure the API key is bound to an organization

POST /api/v1/workspaces

Create a new workspace. Optionally nest it under a parent (max depth: 3 levels).

tRPC: workspaces.create | Scope: write:items | Org context: Required

Parameters:

NameTypeRequiredDescription
namestringYesWorkspace display name
slugstringYesURL-safe slug (unique within org)
parentIdstringNoParent workspace ID for nesting (level auto-computed from parent)
descriptionstringNoOptional description
curl -X POST https://acme.probeya.com/api/v1/workspaces \
  -H "Authorization: Bearer probeya_sk_live_7f3a..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Packaging Line 3",
    "slug": "packaging-l3",
    "parentId": "clx9ws002"
  }'

Response:

{
  "data": {
    "id": "clx9ws004",
    "name": "Packaging Line 3",
    "slug": "packaging-l3",
    "level": 3,
    "parentId": "clx9ws002",
    "organizationId": "clx9abc123def",
    "createdAt": "2026-04-13T12:00:00.000Z",
    "updatedAt": "2026-04-13T12:00:00.000Z"
  }
}

Errors:

CodeDescriptionCauseFix
400BAD_REQUESTMax nesting depth exceeded (3 levels)Move the workspace under a shallower parent
400BAD_REQUESTSlug already in use within this orgChoose a unique slug
401UNAUTHORIZEDMissing or invalid authenticationCheck your Bearer token
403FORBIDDENPlan workspace limit reachedUpgrade your plan or delete unused workspaces
404NOT_FOUNDParent workspace not found in this orgVerify the parentId belongs to your organization

Projects

GET /api/v1/projects

List projects within a workspace.

tRPC: projects.list | Scope: read:items | Org context: Required

Parameters:

NameTypeRequiredDescription
workspaceIdstring (query)YesThe workspace to list projects for
curl -H "Authorization: Bearer probeya_sk_live_7f3a..." \
     "https://acme.probeya.com/api/v1/projects?workspaceId=clx9ws001"

Response:

{
  "data": [
    {
      "id": "clx9pj001",
      "name": "OEE Improvement Q2-2026",
      "slug": "oee-q2-2026",
      "workspaceId": "clx9ws001",
      "organizationId": "clx9abc123def",
      "createdAt": "2026-02-01T10:00:00.000Z",
      "updatedAt": "2026-02-15T14:30:00.000Z"
    },
    {
      "id": "clx9pj002",
      "name": "CAPA Tracking",
      "slug": "capa-tracking",
      "workspaceId": "clx9ws001",
      "organizationId": "clx9abc123def",
      "createdAt": "2026-03-10T08:00:00.000Z",
      "updatedAt": "2026-04-01T11:20:00.000Z"
    }
  ]
}

POST /api/v1/projects

Create a new project. Automatically creates a default board with three groups (To Do, In Progress, Done) and four columns (Status, Person, Date, Priority).

tRPC: projects.create | Scope: write:items | Org context: Required

Parameters:

NameTypeRequiredDescription
namestringYesProject display name
slugstringYesURL-safe slug (unique within workspace)
workspaceIdstringYesParent workspace ID
descriptionstringNoOptional description
curl -X POST https://acme.probeya.com/api/v1/projects \
  -H "Authorization: Bearer probeya_sk_live_7f3a..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Batch Release Tracker",
    "slug": "batch-release-tracker",
    "workspaceId": "clx9ws001",
    "description": "Track batch release status for all production lines"
  }'

Response:

{
  "data": {
    "id": "clx9pj003",
    "name": "Batch Release Tracker",
    "slug": "batch-release-tracker",
    "workspaceId": "clx9ws001",
    "organizationId": "clx9abc123def",
    "createdAt": "2026-04-13T12:05:00.000Z",
    "updatedAt": "2026-04-13T12:05:00.000Z"
  }
}

Errors:

CodeDescriptionCauseFix
400BAD_REQUESTInvalid input (missing name or slug)Provide all required fields
401UNAUTHORIZEDMissing or invalid authenticationCheck your Bearer token
403FORBIDDENPlan board limit reachedUpgrade your plan or archive unused projects

Pharma Integration Scenario


Rate Limiting

All core endpoints are subject to Redis-based sliding window rate limiting:

PlanRequests/minBurst (10s window)
Free6015
Starter12030
Pro30075
Enterprise600150

Rate limit headers are included on every response:

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 287
X-RateLimit-Reset: 1711792800

When the limit is exceeded, the API returns 429 Too Many Requests with a Retry-After header in seconds.


tRPC-Only Procedures

These procedures are available via the tRPC client but not exposed as REST endpoints:

ProcedureDescription
workspaces.getTreeGet workspaces as a nested tree structure (with children arrays)
workspaces.updateUpdate workspace name, slug, description, or reparent
workspaces.deleteDelete a workspace (cascades to children and all contained projects)
projects.updateUpdate project name, slug, or description
projects.deleteDelete a project and its board (cascades to items, values, KPIs)
organizations.getBySlugGet organization details by slug (for subdomain resolution)