listOrganizations()
Returns organizations as a paginated response. Supports pagination, text search, and sort forwarding.
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 listOrganizations() { const client = await wachtClient(); return client.organizations.listOrganizations({ limit: 20, offset: 0, search: 'acme', sort_key: 'created_at', sort_order: 'desc', });}Signature
function listOrganizations( options?: ListOrganizationsOptions,): Promise<PaginatedResponse<Organization>>ListOrganizationsOptions
›limit?: number | undefined;
limit?: number | undefined;Maximum organizations to return for this page.
›offset?: number | undefined;
offset?: number | undefined;Number of organizations to skip before returning results.
›sort_key?: string | undefined;
sort_key?: string | undefined;Sort key forwarded to backend organization list query.
›sort_order?: 'asc' | 'desc' | undefined;
sort_order?: 'asc' | 'desc' | undefined;Sort order for the selected `sort_key`.
›search?: string | undefined;
search?: string | undefined;Search term forwarded to backend organization list query.
Return value
›data?: Organization[] | undefined;
data?: Organization[] | undefined;Organizations in the current page.
›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.
›total?: number | undefined;
total?: number | undefined;Total number of organizations matching the current query.
›limit?: number | undefined;
limit?: number | undefined;Effective page size reflected by backend response.
›offset?: number | undefined;
offset?: number | undefined;Effective offset reflected by backend response.
Behavior
- Lists organizations visible in the deployment context.
- Supports standard list pagination and sorting options.
Operational usage
- Use this as an index call before id-scoped operations.
- Persist the returned organization id for member, role, and workspace operations.
Examples
List first page with defaults
import { wachtClient } from '@wacht/nextjs/server';export async function listOrganizationPage() { const client = await wachtClient(); return client.organizations.listOrganizations();}Search and sort organizations
import { wachtClient } from '@wacht/nextjs/server';export async function searchOrganizations(search: string) { const client = await wachtClient(); return client.organizations.listOrganizations({ search, sort_key: 'created_at', sort_order: 'desc', limit: 25, });}