Migrate from legacy flag events
How to migrate from the legacy flag.* webhook events to the feature_flags.* events.
On February 1, 2027, the four legacy feature flag events stop being sent:
flag.createdflag.updatedflag.deletedflag.rule_updated
They are replaced by the feature_flags.* events, which carry the same information in a namespaced, more granular form. Every flag change currently sends both the legacy events and their replacements, so you can migrate at your own pace before the retirement date. If you need more time, contact us.
After February 1, 2027:
- Webhooks subscribed to the legacy events stop receiving them. Endpoints that are not already subscribed to a legacy event can no longer subscribe to it.
- Events API requests that filter on the legacy event names keep returning
200, but no new events match. A sync that pollsGET /eventswith a legacy name goes quiet without an error, so update theeventsfilter rather than waiting for a failure.
Log streams receive every event, so no code or stream configuration change is needed. If you have monitors, dashboards, or saved searches that match the flag.* event names, update them to the feature_flags.* names. After February 1, 2027 the legacy names stop matching new events.
| Legacy event | Replacement |
|---|---|
flag.created |
feature_flags.flag.created |
flag.updated |
feature_flags.flag.updated |
flag.deleted |
feature_flags.flag.deleted |
flag.rule_updated |
feature_flags.flag.updated for a flag turned on or off or a default value change, and the feature_flags.flag_rule.* and feature_flags.flag_target.* events for rule and target changes |
The three renamed events fire on the same triggers as their legacy counterparts and carry the Feature Flag object as the payload data. flag.rule_updated has no single replacement: it is broken into granular events that describe exactly what changed. See the Events reference for every payload.
Most of this migration is mechanical, so a coding agent can do the code side. Webhook subscriptions stay a manual step in the WorkOS Dashboard, following the order in the next section.
Most applications only need the migration prompt. The exception: if your server keeps a local copy of flag state fed by flag.rule_updated and runs Node.js or Python, run the runtime client prompt further down this page first – it replaces the event-driven sync and removes the handlers that fed the copy, so the migration prompt only has the renames left to do.
If your server keeps a local copy of flag state fed by flag.rule_updated and runs Node.js or Python, you can replace the event-driven sync with the runtime client instead of migrating the handlers. This is the prompt to run first, as described at the start of this section; follow it with the migration prompt to finish the renames.
Migrate in this order so no event is missed and a rollback stays safe:
- Add the new events to your endpoint, keeping the legacy events subscribed. Your endpoint must return a
2xxresponse for event types it does not handle yet. - Deploy code that handles the new events.
- Remove the legacy events from your endpoint last. Once a legacy event is removed from an endpoint, it cannot be added back.
While both sets are subscribed, each change delivers a legacy event and its replacement. Do not try to correlate the two payloads: rule and target changes do not update the flag’s updated_at, so the payloads share no key. Instead, have your handler act on one event family at a time – keep acting on the legacy events while you build the new handling, then switch to acting on the new events and ignore the legacy ones until you remove them from the subscription. Delivery order is not guaranteed across the two families, so a change that lands exactly at the switch can be ignored by both handlers: after switching, refresh any local flag state from the API once rather than waiting for the next event. The events page in the WorkOS Dashboard shows both events for each change until the retirement date.
The legacy event sends the flag object plus the full list of configured targets on every targeting change:
The replacement events describe the individual rule or target that changed, including the value a rule serves and the rule_id a target belongs to:
Field by field, here is where each piece of the legacy payload went:
What flag.rule_updated tells you |
Where it is now |
|---|---|
On or off (data.enabled) and the default value (data.default_value) |
feature_flags.flag.updated, with previous values in context.previous_attributes.data |
Targeted organizations and users (context.configured_targets) |
feature_flags.flag_target.created and .deleted, one per target, each with the rule_id of its rule |
None, some or all (context.access_type) |
No equivalent: derive it from default_value plus the value each rule serves |
| Organization names and user emails | Not included; look them up by target_id |
| – | New: feature_flags.flag_rule.created, .updated and .deleted, with each rule’s target type, position in evaluation order, and the value it serves |
How to migrate depends on what your handler does with the event.
If your code treats flag.rule_updated as “something changed, refresh”, subscribe to feature_flags.flag.updated, the feature_flags.flag_rule.* events, and the feature_flags.flag_target.* events, and refresh on any of them. You do not need to read the payloads.
If you refresh a local cache of flag state, consider the runtime client instead: it keeps an up-to-date local snapshot without webhooks.
The legacy payload’s configured_targets list cannot express rules that serve false, which the flag editor supports. Rebuild state from the granular events, or re-fetch the flag’s state after a change instead of deriving it from payloads.
A rule with "value": false excludes its targets. If your code assumes every target means the flag is enabled, those flags evaluate incorrectly as soon as an exclusion rule is added. Handle value explicitly, or use the runtime client, which evaluates rules for you.
@workos-inc/node 12.0, @workos-inc/authkit-nextjs 4.6.0, and workos (Python) 10.8.0 skip rules that serve false. Upgrade before adding exclusion rules to your flags.
These SDK versions parse the new events into typed models in webhook handlers:
| SDK | Minimum version |
|---|---|
| Node | 12.3.0 |
| Python | 10.7.0 |
| Go | 10.7.0 |
| .NET | 6.7.0 |
| Kotlin | 7.6.0 |
| Ruby | 10.8.0 |
The Rust (3.6.0), PHP (9.6.0), and iOS (0.9.0) SDKs deliver the new events without typed models. The Elixir and Android SDKs do not model the new events; match on the raw event name. On any SDK version, the new events are delivered to your endpoint as JSON regardless of typed support.