Nurama Developers
Namespaces

subscription

Methods and types of the `subscription` namespace (`client.subscription` / `bot.subscription`).

Interfaces

CreateWorkspaceOrderParams

Properties

PropertyTypeDescription
amountInMinor?numberCustomer-chosen purchase amount in the subscription's currency MINOR unit (pence for GBP, cents for USD, yen for JPY, etc.). Required for variable-amount products (currently only the AI add-on, productType: 'enableAi'). Server enforces a per-currency minimum.
productIdstring-
quantitynumber-

GetSubscriptionOrdersParams

Properties

PropertyType
limit?number
page?number
sortBy?string

GetSubscriptionsParams

Extends

Properties

PropertyTypeInherited from
limit?number-
page?number-
sort?Record<string, -1 | 1>SortParams.sort
status?SubscriptionStatus-

ResourceLimits

Properties

PropertyType
totalCreditsnumber
totalSeatsnumber
totalStorageInBytesnumber

RoleSeatUsage

Properties

PropertyTypeDescription
limitnumber | nullPlan cap for this seat type, or null when the plan is unlimited for it.
usednumberDistinct users occupying this seat type across the workspace + projects.

RoleUsage

Properties

PropertyType
creatorsRoleSeatUsage
reviewersRoleSeatUsage

SeatUsage

Properties

PropertyType
availableSeatsnumber
totalSeatsnumber
usedSeatsnumber

SortParams

Extended by

Properties

PropertyType
sort?Record<string, -1 | 1>

StorageUsage

Properties

PropertyType
availableStorageInBytesnumber
totalStorageInBytesnumber
usedStorageInBytesnumber

Type Aliases

PlanChangeWarning

type PlanChangeWarning = 
  | {
  capability: string;
  type: "capabilityRemoved";
}
  | {
  currency: string;
  currentSeats: number;
  period: "month" | "year";
  total: number | null;
  type: "seatMigration";
  unitPrice: number | null;
};

Soft warnings returned by a plan swap / dry-run. STRUCTURED (not localized strings) so your app can render localized copy from these values.


SubscriptionStatus

type SubscriptionStatus = 
  | "active"
  | "pending"
  | "canceled"
  | "expired"
  | "pastDue"
  | "paused"
  | "paymentFailed"
  | "unpaid";

Functions

default()

function default(client): {
  cancelWorkspaceSubscription: Promise<any>;
  createWorkspaceOrder: Promise<any>;
  getResourceLimits: Promise<ResourceLimits>;
  getRoleUsage: Promise<RoleUsage>;
  getSeatUsage: Promise<SeatUsage>;
  getStorageUsage: Promise<StorageUsage>;
  getUserSubscriptions: Promise<Subscription[]>;
  getWorkspaceOrders: Promise<any[]>;
  getWorkspaceSubscription: Promise<Subscription>;
  getWorkspaceUsageSummary: Promise<{
     billableSeatCount: number;
     storageUsedInBytes: number;
  }>;
  resumeWorkspaceSubscription: Promise<any>;
  swapWorkspacePlan: Promise<{
     subscription: Subscription | null;
     warnings: PlanChangeWarning[];
  }>;
};

Defines subscription-related methods for the NuramaClient.

Parameters

ParameterTypeDescription
clientdefaultThe NuramaClient instance.

Returns

An object containing the subscription-related methods.

NameTypeDescription
cancelWorkspaceSubscription()(workspaceId) => Promise<any>Cancels the subscription for a specific workspace. Requires authentication and permission.
createWorkspaceOrder()(workspaceId, orderData) => Promise<any>Creates a subscription order for a specific workspace. Requires authentication and permission.
getResourceLimits()(resourceId) => Promise<ResourceLimits>Retrieves the resource limits (e.g., storage, seats) for a specific resource (typically workspace). Requires authentication.
getRoleUsage()(resourceId) => Promise<RoleUsage>Retrieves per-role (creator / reviewer) seat usage and caps for a workspace. limit is null when the plan is unlimited for that seat type. Requires authentication.
getSeatUsage()(resourceId) => Promise<SeatUsage>Retrieves the seat usage for a specific resource (typically workspace). Requires authentication.
getStorageUsage()(resourceId) => Promise<StorageUsage>Retrieves the storage usage for a specific resource (typically workspace). Requires authentication.
getUserSubscriptions()(params?) => Promise<Subscription[]>Retrieves all subscriptions owned by the currently authenticated user. Requires authentication.
getWorkspaceOrders()(workspaceId, params?) => Promise<any[]>Retrieves subscription orders for a specific workspace. Requires authentication and permission.
getWorkspaceSubscription()(workspaceId) => Promise<Subscription>Retrieves the active subscription for a specific workspace. Requires authentication and permission.
getWorkspaceUsageSummary()(workspaceId) => Promise<{ billableSeatCount: number; storageUsedInBytes: number; }>Retrieves the workspace usage summary (billable seats and storage used). Requires authentication and subscription management permission.
resumeWorkspaceSubscription()(workspaceId) => Promise<any>Reverse a scheduled (period-end) cancellation, keeping the workspace's subscription on its normal renewal cycle. Only valid while the subscription is still active with a pending cancellation; a fully lapsed subscription can't be resumed (the owner must re-subscribe). Requires authentication and permission.
swapWorkspacePlan()(workspaceId, params) => Promise<{ subscription: Subscription | null; warnings: PlanChangeWarning[]; }>Swap the workspace's active basePlan line for a different basePlan product. Same code path both upgrades and downgrades; the API's pre-flight capacity check is what distinguishes a permitted change from a refused one. Pass dryRun: true to get the pre-flight verdict without mutating. On over-allocation the API returns 400 planCapacityInsufficient with errorData.violations: [{ resource, current, newLimit }], surfaced via the SDK's normal error path. On success, returns the updated subscription plus a warnings[] array of feature-gate capabilities the destination plan does NOT include (suitable for showing as a confirmation notice).

On this page