Developer docs
Core API Integration·

Core API Integration

Read core data (employees, departments, spaces) with niyase.core under granted scopes.

As a rule, plugins should be self-contained within their own tables, but when you need to read core data, use useNiyase().core (direct DB access and fetch to arbitrary servers are not allowed).

The niyase.core API

const niyase = useNiyase();

await niyase.core.workspace(); // The current space (minimal fields)
await niyase.core.employees(); // { items, total } — minimal, masked info
await niyase.core.employee(id);
await niyase.core.departments(); // { items }

niyase.core.grantedScopes; // Scopes granted at activation (for conditional UI)

Internally this calls the in-app proxy /nplg-core/v1/:pluginId/*. What it returns is a minimal projection (e.g., for employees, only name, email, and employment status; it does not return things like My Number).

Granted scopes (grantedScopes)

Core data can only be read within the scope the space's owner granted at activation.

ScopeContents
core:workspace:readSpace information
core:employee:readEmployee list and individuals
core:department:readDepartments

For features that are not granted, the server returns 403 SCOPE_DENIED. By inspecting niyase.core.grantedScopes you can adapt the UI without waiting for a 403.

if (niyase.core.grantedScopes.includes("core:employee:read")) {
  // Show the assignee-selection UI
}

Handling errors

Bridge errors are normalized to a stable set of codes (NiyaseErrorCode) (SCOPE_DENIED / NOT_FOUND / VALIDATION / OFFLINE / MAINTENANCE, etc.). Branch on status and code, and return appropriate feedback to the user.