Skip to main content

Organizations & Multi-Tenancy

Organizations are the top-level tenant unit in Flux. Every user belongs to one or more organizations, and resources like feature flags, billing plans, and audit logs are all scoped to an org.

Creating an Organization

Organizations can be created by users from your app UI, or provisioned programmatically via the SDK.

use flux_sdk::Flux;

let flux = Flux::init("your-api-key");

let org = flux.orgs().create(flux_sdk::CreateOrgRequest {
    name: "Acme Corp".into(),
    slug: "acme".into(),
    owner_user_id: user.id.clone(),
})?;

println!("Created org: {} ({})", org.name, org.id);

Inviting Members

Send an invite by email — Flux handles the delivery and creates the membership once the invitation is accepted.

flux.orgs().invite_member(flux_sdk::InviteMemberRequest {
    org_id: org.id.clone(),
    email: "colleague@acme.com".into(),
    role: "member".into(),
})?;

Python

import flux

flux.init("your-api-key")

flux.orgs.invite_member(
    org_id=org.id,
    email="colleague@acme.com",
    role="member",
)

Roles and Permissions

Flux ships with three built-in roles: owner, admin, and member. You can define custom roles with fine-grained permission sets from the Organizations settings.

To check a user’s role within an org:

let membership = flux.orgs().get_membership(&org.id, &user.id)?;

if membership.role == "admin" || membership.role == "owner" {
    // Allow admin action
}

Tenant-Scoped Operations

Pass org_id when evaluating feature flags, checking entitlements, or recording usage — Flux will apply the correct tenant context automatically.

// Feature flag scoped to an org
let enabled = flux.flags().is_enabled_for_org("new-dashboard", &org.id)?;

// Entitlement check scoped to an org
let entitled = flux.billing().is_entitled(&org.id, "api-access")?;

All audit log entries, usage events, and flag evaluations are tagged with the org ID and queryable per tenant from the dashboard.

Next Steps