MonetizationOS Docs
Workflows Reference

Dynamic Provisioning Workflows

Dynamically assign Plans to users at decision time based on request context and business logic. Dynamic Provisioning workflows enable automatic plan assignment based on user identity, request context, JWT claims, geolocation, and other runtime data.

Usage

Dynamic Provisioning Workflow
const :  = async ({  }: ) => {
    if (..premium) {
        return ["premium"];
    }

    if (. === "authenticated") {
        return ["registered"];
    }

    return ["anonymous"];
};

export default ;

Invocation

Dynamic Provisioning workflows are executed during the Access Check API and Surface Decisions API request flows. These workflows run asynchronously during the provisioning phase, before feature property evaluation.

Arguments

See ProvisioningWorkflowArgs.

Prop

Type

Read-only Utils

Dynamic Provisioning workflows receive a read-only version of utils that excludes mutation operations like triggers.fire, identity.incrementCounter, and identity.writeCustomData. This ensures workflows remain deterministic and side-effect free during the provisioning phase.

Return Type

The workflow returns an array of plan slugs (string[]) representing the plans to assign to the user or session.

  • Return an empty array [] if no plans should be dynamically assigned
  • Return plan slugs that match configured plans in your organization
// Valid return types
return ["premium", "beta-tester"];
return [];
return identity.jwtClaims.role === "admin" ? ["admin"] : ["user"];

Plan Slugs

Plan slugs must match the slugs of plans configured in your MonetizationOS organization. The workflow has access to all plan slugs available for your organization at development time through TypeScript autocomplete.

To view available plans:

  1. Navigate to the Plans page in the MonetizationOS console
  2. Plan slugs are displayed for each plan

Common Use Cases

  • Assign plans based on JWT claims in authentication tokens (e.g. subscription tier, roles, entitlements)
  • Restrict or grant access based on user location for legal compliance
  • Assign different plans to verified bots vs. regular users
  • Offer different plans during specific time windows (e.g., peak hours, promotional periods)
  • Assign plans based on referrer or UTM parameters
  • Provide different experiences for mobile vs. desktop users
  • Use identity.testGroup100 for consistent user bucketing across plan variants

Workflow Execution

Dynamic Provisioning workflows merge with static plan assignments configured in the MonetizationOS console:

  • Automatically assigned plans and product assigned plans from the console are combined with plans returned by the workflow
  • Users can have multiple plans assigned simultaneously, feature property conflict resolution resolves any overlapping assignments
  • Dynamic provisioning results are evaluated on every request

See Also