Skip to content

Managing Organizations and Multi-Tenant Workspaces

Create isolated workspaces, partition custom domains and links across teams or clients, and monitor security audit logs.

Managing Organizations and Multi-Tenant Workspaces

Agencies, holding companies, and multi-brand enterprises need strict isolation between client domains, team members, and billing without creating fragmented user logins. This guide demonstrates how to provision isolated organization workspaces, switch contexts instantly, and inspect compliance audit logs.


Prerequisites

  • An active Shaf user account.
  • Workspace permissions: Owner or Admin role to manage settings in existing organizations.
  • Distinct slug identifiers for each new workspace.

Implementation Recipe

  1. Understand Workspace Isolation Boundaries

    Organizations are hard multi-tenant boundaries. Every organization maintains independent:

    • Custom Domains: Domain hostnames and TLS certificates belong strictly to the owning organization.
    • Short Links & Slugs: Slugs are isolated per domain within the workspace.
    • Click Telemetry: Analytics datasets, geographic tracking, and real-time logs are completely partitioned.
    • RBAC & Memberships: Teammate roles apply exclusively to the specific organization.
    • Billing & Quotas: Each workspace maintains its own Stripe customer profile, plan tier, and quota limits.
  2. Create a New Organization

    Provision a workspace via the dashboard or submit an API request:

    curl -X POST "https://shaf.app/api/v1/organizations" \
      -H "Authorization: Bearer $SHAF_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Acme Europe Agency",
        "slug": "acme-europe"
      }'

    Expected response (201 Created):

    {
      "id": "org_01j8k9x2m4",
      "name": "Acme Europe Agency",
      "slug": "acme-europe",
      "plan": "starter",
      "createdAt": "2026-11-21T17:00:00Z"
    }
    1. Click your current organization name at the top of the sidebar.
    2. In the organization switcher dropdown, click + Create Organization.
    3. Enter your Organization Name (e.g., Acme Europe Agency).
    4. Confirm the auto-suggested URL Slug (e.g., acme-europe).
    5. Click Create Workspace.
  3. Switch Workspace Context

    • Dashboard UI: Open the sidebar organization switcher and click the target workspace. The dashboard updates immediately without logging out.
    • Programmatic API: Include the target workspace header in requests:
      X-Shaf-Organization-Id: org_01j8k9x2m4
  4. Inspect Security Audit Logs

    Monitor operational modifications and user actions under Settings → Audit Logs or query the audit logs endpoint:

    curl -X GET "https://shaf.app/api/v1/organizations/org_01j8k9x2m4/audit-logs?limit=10" \
      -H "Authorization: Bearer $SHAF_API_TOKEN"

Verification

List all organizations associated with your authenticated account:

curl -X GET "https://shaf.app/api/v1/organizations" \
  -H "Authorization: Bearer $SHAF_API_TOKEN"

Expected response (200 OK):

{
  "total": 2,
  "organizations": [
    {
      "id": "org_01j8k9x2m4",
      "name": "Acme Europe Agency",
      "slug": "acme-europe",
      "role": "owner"
    },
    {
      "id": "org_primary_corp",
      "name": "Acme Corporation",
      "slug": "acme-corp",
      "role": "admin"
    }
  ]
}

Common Gotchas

Issue / Error Root Cause Solution
Organization slug already taken The requested global slug is already registered by another workspace. Choose a unique slug (e.g. acme-brand-marketing).
Custom domain unavailable in new org Custom domains cannot be attached to two organizations simultaneously. Delete the domain from the previous workspace before registering in the new organization.
Missing API data after switching org API key was created in Organization A and has no access to Organization B. Generate a dedicated API token within the active organization workspace.
Cannot delete organization The organization has active custom domains or is the last workspace of an account. Remove all custom domains first, or create a replacement workspace prior to deletion.

Type to search…

↑↓ navigate↵ selectEsc close