Capxul Docs
API referenceOrganizationsPermissions

Replace a Permission

Replace the Organization Permission set.

client.org(orgId).permissions.replace

Replace the Organization Permission set.

Available in the Core SDK

The typed Core SDK operation is implemented. Live service behavior still depends on the configured environment.

Import and client prerequisite

import { createCapxulClient } from "@capxul/sdk";

const created = await createCapxulClient({
  publishableKey: "cap_pk_…",
});

if (!created.ok) throw created.error;
const client = created.value;

Usage

declare const orgId: OrgId;
declare const input: PermissionReplaceInput;

const result = await client.org(orgId).permissions.replace(input);

if (!result.ok) {
  console.error(result.error.code);
  return;
}

console.log(result.value);

Signature

client.org(orgId).permissions.replace(input: PermissionReplaceInput, options?: PermissionOptions): Promise<CapxulResult<SubmittedPermissionExecution>>;

Source: packages/sdk/src/surface/permissions.ts:58.

Parameters

input

Required.

PermissionReplaceInput;

Prop

Type

options

Optional.

PermissionOptions | undefined;

Returns

Promise<
  CapxulResult<{
    readonly status: "submitted";
    readonly executionId: string;
    readonly commandId: PaymentCommandId;
    readonly userOpHash: string;
    readonly value:
      | {
          readonly orgId: string;
          readonly type: "budget" | "managePeople";
          readonly revision: number;
          readonly permissionId: PermissionId;
          readonly state: "pending" | "active" | "suspended" | "revoked" | "superseded";
          readonly roleKey: RoleKey;
          readonly tokenAddress?: Address | undefined;
          readonly limitRaw?: WeiAmount | undefined;
          readonly allowanceKey?: AllowanceKey | undefined;
        }
      | {
          readonly permissionAssignmentId: PermissionAssignmentId;
          readonly permissionId: PermissionId;
          readonly actor:
            | { readonly kind: "account"; readonly accountId: string }
            | { readonly kind: "organization"; readonly orgId: string };
          readonly state: "pending" | "active" | "suspended" | "revoked" | "superseded";
        }
      | readonly {
          readonly orgId: string;
          readonly type: "budget" | "managePeople";
          readonly revision: number;
          readonly permissionId: PermissionId;
          readonly state: "pending" | "active" | "suspended" | "revoked" | "superseded";
          readonly roleKey: RoleKey;
          readonly tokenAddress?: Address | undefined;
          readonly limitRaw?: WeiAmount | undefined;
          readonly allowanceKey?: AllowanceKey | undefined;
        }[];
  }>
>;

Read the ok discriminant before accessing value or error.

Errors

Expected failures resolve as { ok: false, error: CapxulError }; they are not thrown as the normal domain contract. Branch on result.ok and use the stable error.code. Provider messages and internal causes are not public contracts.

Availability and evidence

Available in the Core SDK. Evidence classification: shipped-proven.

shipped-proven at the typed or hermetic Core SDK contract boundary. The callable surface and result mapping are covered by release-trunk type or hermetic tests. That does not by itself prove a live backend, provider, email, browser, or chain journey. Check the capability-status reference before presenting this operation as live.

On this page