Select a rollout or billing version
Gradual rollouts
Kinde · Module
Gets an integer feature flag for the current Kinde session. A numeric default can be supplied for an unset flag.
Call the method with a flag code and a numeric fallback. It reads the integer feature flag associated with the current access token; supplying a default prevents a missing flag from producing an error.
getIntegerFlag(code, defaultValue)| Name | Type | Description |
|---|---|---|
code | string | The feature-flag code to check. |
defaultValue | number | The numeric value returned when the flag is not set. |
number | Error
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export async function GET() {
const { getIntegerFlag } = getKindeServerSession();
const billingVersion = await getIntegerFlag("billingVersion", 0);
return Response.json({ billingVersion });
}Reads the integer feature flag and uses 0 when the flag is not configured.
Gradual rollouts
Quota configuration
Safe defaults
getIntegerFlag reads an integer feature flag for the current session and returns a number. The method accepts the flag code and a default number used when the flag is not set.
Follow-up: What should the application do if the flag is absent? Pass an explicit fallback so the feature has deterministic behavior.
The first argument identifies the flag, while defaultValue supplies the value to use when that flag is unavailable. In the Next.js server SDK, the method is obtained from getKindeServerSession and awaited.
Follow-up: How would you expose the result from a route? Read the flag in the handler, then include the resulting number in the response.
The documented result is a number or an Error. A numeric default is therefore useful when a feature flag may not exist.
Follow-up: How can a caller distinguish a configured value from a fallback? The method alone does not provide that distinction; track configuration separately or use a lower-level flag API if needed.
getBooleanFlaggetFlaggetStringFlaggetKindeServerSession