NewWacht Bench is live — AI-assisted development for Wacht

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;
Maximum organizations to return for this page.
offset?: number | undefined;
Number of organizations to skip before returning results.
sort_key?: string | undefined;
Sort key forwarded to backend organization list query.
sort_order?: 'asc' | 'desc' | undefined;
Sort order for the selected `sort_key`.
search?: string | undefined;
Search term forwarded to backend organization list query.

Return value

data?: Organization[] | undefined;
Organizations in the current page.
id?: string | undefined;
Stable organization identifier.
created_at?: string | undefined;
Creation timestamp.
updated_at?: string | undefined;
Last update timestamp.
name?: string | undefined;
Organization display name.
description?: string | undefined;
Organization description text.
image_url?: string | undefined;
Organization image URL.
member_count?: number | undefined;
Current member count.
public_metadata?: Record<string, unknown> | undefined;
Public organization metadata.
plan?: string | undefined;
Example public plan field.
owner?: string | undefined;
Example public owner field.
private_metadata?: Record<string, unknown> | undefined;
Private organization metadata.
internal_notes?: string | undefined;
Example internal note field.
billing_id?: string | undefined;
Example internal billing identifier.
total?: number | undefined;
Total number of organizations matching the current query.
limit?: number | undefined;
Effective page size reflected by backend response.
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,  });}

On this page