Search API

ProBeya provides a global search endpoint that queries across all entity types — items, projects, and workspaces — within the current organization. Results are grouped by type and limited to 5 per group for fast, responsive command palette integration.

Search uses PostgreSQL case-insensitive substring matching (ILIKE %query%). All three entity type queries run in parallel for minimal latency.

Endpoints


Search across items, projects, and workspaces by name.

tRPC: search.query Auth: Bearer token required (scope: read:search) or session cookie Org context: Required

Parameters:

NameTypeRequiredDescription
qstring (query)YesSearch query (min 1 char, max 200 chars). Alias: query

Example:

curl -H "Authorization: Bearer probeya_sk_live_..." \
     "https://acme.probeya.com/api/v1/search?q=calibration"

Response:

{
  "data": {
    "items": [
      {
        "id": "clx9it001",
        "name": "Calibrate pH meter #7",
        "boardId": "clx9bd001"
      },
      {
        "id": "clx9it015",
        "name": "Calibration schedule review",
        "boardId": "clx9bd003"
      }
    ],
    "projects": [
      {
        "id": "clx9pj005",
        "name": "Equipment Calibration Program",
        "slug": "equipment-calibration",
        "workspaceId": "clx9ws001"
      }
    ],
    "workspaces": []
  }
}

Errors:

CodeDescription
400Query string is empty or exceeds 200 characters
401Missing or invalid authentication

Search Behavior

Matching

  • Case-insensitive: “OEE” matches “oee”, “OEE”, “Oee”
  • Substring: “road” matches “Product Roadmap”, “roadblock”, “crossroads”
  • Pattern: %query% (both leading and trailing wildcards)

Limits

Each entity type returns a maximum of 5 results. This keeps the command palette responsive and avoids overwhelming users with too many matches.

Tenant Isolation

All queries are filtered by the current organizationId — users can never see entities from other organizations. This is enforced server-side regardless of the search query content.

Result Fields

EntityFields returned
Itemsid, name, boardId
Projectsid, name, slug, workspaceId
Workspacesid, name, slug

The slug and workspaceId/boardId fields enable the client to construct navigation URLs directly from search results without additional API calls.


Performance Considerations

The current implementation uses PostgreSQL ILIKE with leading wildcards, which cannot leverage B-tree indexes. For the current scale this is fast enough. At higher volumes, ProBeya can be configured with:

  • Trigram indexes: PostgreSQL pg_trgm extension with GIN indexes for substring search
  • Full-text search: PostgreSQL tsvector/tsquery for weighted, ranked results
  • External search service: Meilisearch or Typesense for sub-millisecond results with typo tolerance

Additional REST Endpoints

Two additional read endpoints are available through the REST API but are less commonly used:

GET /api/v1/notifications

List notifications for the authenticated user with cursor-based pagination.

tRPC: notifications.list Scope: read:notifications

ParameterTypeRequiredDescription
limitnumber (query)NoResults per page
cursorstring (query)NoPagination cursor from previous response

GET /api/v1/dashboard/stats

Get aggregate dashboard statistics for the current organization.

tRPC: dashboard.stats Scope: read:dashboard

No parameters required.