Workflows Reference
Feature Workflows
Dynamically override feature property values based on custom logic. Feature workflows let you pull property values from external sources (e.g. JWT claims, third-party APIs, etc.) instead of relying solely on plan-based provisioning.
Usage
const workflow: FeatureWorkflow = async ({ context }: FeatureWorkflowArgs): Promise<FeatureWorkflowResult> => {
return {
enabled: context.isVerifiedBotRequest ? "off" : "on",
};
};
export default workflow;Invocation
Feature workflows are executed as part of the Access Checks API and the Surface Decisions API request flow. When an access check or surface decision is requested, all feature workflows are run to compute the final feature property values.
Arguments
See FeatureWorkflowArgs.
Prop
Type
Return Type
The workflow returns FeatureWorkflowResult: Record<string, WorkflowOverrideProperty>, where string is a valid feature property slug.
- Return an object with feature property slugs to override.
- Values can be primitives (
number,string,boolean) or meterable property overrides. - For meterable properties:
- Return
'on'to enable without metering. - Return
'off'to disable. - Return a WorkflowMeterablePropertyDefinition object to configure metering (state, counterId, limit, periodType, etc.).
- Return
Property Override Rules
- Only properties defined on the feature can be overridden.
- Overriding property type (e.g. returning a string for a number property) is not allowed.
- Overrides set
isFallback: false, indicating the value is not a default. - Returning an empty object
{}leaves all properties unchanged.
Common Use Cases
- Pull property values from JWT claims (e.g., tier, limits from auth token)
- Control location-based feature availability
- Fetch user-specific settings from external APIs
- Implement dynamic A/B testing or feature flags
- Override meter limits based on runtime conditions
- Enable/disable features based on external identity providers