Skip to content

Consuming Fabric

Fabric is the canonical source of truth for identity, tenancy, and authorization. All services must defer to Fabric for permission decisions, tenant state, and canonical IDs.

Use Fabric as the canonical source for:

  • Organizations
  • Teams
  • Memberships
  • Invitations
  • Effective permissions
  1. Authenticate user (JWT or API key)
  2. Fetch GET /v1/me to get the current principal
  3. Fetch memberships, orgs, and teams
  4. Fetch effective permissions for the active context
  5. Cache only for UX convenience
  6. Never trust frontend-only authorization
import { FabricClient } from "@fabric-platform/sdk";
const fabric = new FabricClient({ apiKey: "fab_xxx" });
// Get current user
const me = await fabric.getMe();
// Get their organizations
const orgs = await fabric.getMyOrganizations();
// Check a permission
const result = await fabric.checkPermission({
resourceType: "organization",
resourceId: orgId,
action: "read",
});

Backend services should:

  • Call Fabric for authz checks or embed a trusted decision token
  • Use Fabric org/team IDs as canonical
  • Avoid duplicating org/team/role truth
  • Use API keys or service account tokens for service-to-service calls
// Check permission before a sensitive action
const allowed = await fabric.checkPermission({
action: "organization.invite",
});
if (!allowed) throw new Error("Forbidden");

Every Fabric response conforms to a consistent envelope structure:

FieldDescription
metarequest_id, trace_id, timestamp, status, version
contextprincipal_id, organization_id, team_id
dataThe response payload
errorError details (if applicable)
linksPagination and related resource links

This applies uniformly across REST, SSE, WebSockets, and webhooks.

SSE payloads emit serialized envelope JSON in the data field of the event.