getOrganization()
Returns the detailed organization payload, including organization roles, workspaces, and segments.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function getOrganization(organizationId: string) { const client = await wachtClient(); return client.organizations.getOrganization(organizationId);}Signature
function getOrganization( organizationId: string,): Promise<OrganizationDetails>Parameters
›organizationId?: string | undefined;
organizationId?: string | undefined;Stable organization id to load.
Return value
›id?: string | undefined;
id?: string | undefined;Stable organization identifier.
›created_at?: string | undefined;
created_at?: string | undefined;Creation timestamp.
›updated_at?: string | undefined;
updated_at?: string | undefined;Last update timestamp.
›name?: string | undefined;
name?: string | undefined;Organization display name.
›description?: string | undefined;
description?: string | undefined;Organization description text.
›image_url?: string | undefined;
image_url?: string | undefined;Organization image URL.
›member_count?: number | undefined;
member_count?: number | undefined;Current member count.
›public_metadata?: Record<string, unknown> | undefined;
public_metadata?: Record<string, unknown> | undefined;Public organization metadata.
›plan?: string | undefined;
plan?: string | undefined;Example public plan field.
›owner?: string | undefined;
owner?: string | undefined;Example public owner field.
›private_metadata?: Record<string, unknown> | undefined;
private_metadata?: Record<string, unknown> | undefined;Private organization metadata.
›internal_notes?: string | undefined;
internal_notes?: string | undefined;Example internal note field.
›billing_id?: string | undefined;
billing_id?: string | undefined;Example internal billing identifier.
›roles?: OrganizationRole[] | undefined;
roles?: OrganizationRole[] | undefined;Deployment-level and organization-level roles available to this organization.
›workspaces?: Workspace[] | undefined;
workspaces?: Workspace[] | undefined;Workspaces currently under this organization.
›segments?: Segment[] | undefined;
segments?: Segment[] | undefined;Segments currently attached to this organization.
Behavior
- Returns full organization details by id.
- Includes related role, workspace, and segment information in one payload.
Examples
Load full organization details
import { wachtClient } from '@wacht/nextjs/server';export async function loadOrganization(organizationId: string) { const client = await wachtClient(); return client.organizations.getOrganization(organizationId);}Read only roles and workspace ids
import { wachtClient } from '@wacht/nextjs/server';export async function summarizeOrganization(organizationId: string) { const client = await wachtClient(); const organization = await client.organizations.getOrganization(organizationId); return { roleNames: organization.roles.map((role) => role.name), workspaceIds: organization.workspaces.map((workspace) => workspace.id), };}