NewWacht Bench is live — AI-assisted development for Wacht

updateOrganization()

Patches organization fields with multipart form fields. You can update metadata, upload a new image, or remove the current image.

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 updateOrganization(organizationId: string) {  const client = await wachtClient();  return client.organizations.updateOrganization(organizationId, {    description: 'Updated description',    remove_image: true,  });}

Signature

function updateOrganization(  organizationId: string,  request: UpdateOrganizationRequest,): Promise<Organization>

Parameters

organizationId?: string | undefined;
Stable organization id.
request.name?: string | undefined;
Optional new name.
request.description?: string | undefined;
Optional new description.
request.public_metadata?: Record<string, unknown> | undefined;
Optional public metadata patch.
plan?: string | undefined;
Example public plan field.
owner?: string | undefined;
Example public owner field.
request.private_metadata?: Record<string, unknown> | undefined;
Optional private metadata patch.
internal_notes?: string | undefined;
Example internal note field.
billing_id?: string | undefined;
Example internal billing identifier.
request.remove_image?: boolean | undefined;
Remove existing organization image when true.
request.organization_image?: File | Blob | undefined;
Optional new organization image upload.

Return value

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.

Behavior

  • Applies a partial update and returns the server-side updated resource.
  • Treat omitted optional fields as unchanged unless explicitly documented otherwise.

Examples

Patch metadata

import { wachtClient } from '@wacht/nextjs/server';export async function patchOrganizationMetadata(organizationId: string) {  const client = await wachtClient();  return client.organizations.updateOrganization(organizationId, {    public_metadata: { owner: 'ops' },  });}

Replace image

import { wachtClient } from '@wacht/nextjs/server';export async function replaceOrganizationImage(organizationId: string, image: Blob) {  const client = await wachtClient();  return client.organizations.updateOrganization(organizationId, {    organization_image: image,    remove_image: false,  });}

On this page