POST /decide
The/decide endpoint is the primary way SDKs and clients evaluate feature flags. It returns which flags are enabled for a given user or group, along with their values and optional payloads.
This endpoint is designed for SDK use. For server-side evaluation, consider using the Local Evaluation endpoint at
/api/feature_flag/local_evaluation instead.Request Body
string
required
Your project API key (public token)
string
required
Unique identifier for the user/person
object
Person properties to use for flag evaluation
object
Group identifiers for group-based flags. Keys are group type names, values are group keys.
object
Properties for each group type
string
Anonymous ID before user identification (for experience continuity)
boolean
default:"false"
Disable GeoIP lookup for this request
Response
object
Object mapping flag keys to their evaluated values. Boolean flags return
true/false, multivariate flags return the variant key.object
Object mapping flag keys to their JSON payloads (if configured)
boolean
Whether any errors occurred during flag evaluation
Examples
Basic Flag Evaluation
With Person Properties
With Group Properties
With Anonymous ID for Experience Continuity
Response Examples
Boolean Flags
Multivariate Flags with Payloads
With Errors
Best Practices:
- The
/decideendpoint performs person and group lookups, which can be slower than local evaluation - For high-traffic server-side applications, use the Local Evaluation endpoint instead
- Cache flag results on the client side when possible
- SDKs automatically handle caching and polling for you
- Include relevant properties to ensure accurate flag evaluation
- Use anonymous IDs for experience continuity when users aren’t yet identified
SDKs
Most PostHog SDKs use the/decide endpoint under the hood. Here’s how to use feature flags in various SDKs: