Overview
Theupdate action allows you to modify the filters of an existing subscription without creating a new one. This is more efficient than unsubscribing and re-subscribing, as it maintains the same subscription ID.
Update Message Format
action: Must be"update"subscription_id: The ID of the subscription you want to updateplatform: Must be"polymarket"version: Currently1type: Must be"orders"filters: New filter configuration (same format as subscribe)
Example
Update a subscription to change its filters:Use Cases
- Change which users you’re tracking without losing your subscription
- Switch from tracking users to tracking condition IDs
- Update market slugs or condition IDs as markets change
- Adjust filters based on runtime conditions
Filter Types
You can update a subscription to use any of the supported filter types:Update to User Filters
Update to Condition ID Filters
Update to Market Slug Filters
Complete Example
Here’s a complete example showing the full flow of subscribing, receiving events, and then updating the subscription:Step 1: Initial Subscription
Step 2: Receiving Events (Before Update)
You’ll receive order events for the subscribed user:Step 3: Update Subscription
Now update the subscription to track a different user:sub_k7f5hgr7wy
Step 4: Receiving Events (After Update)
After the update, you’ll now receive events for the new user:- The
subscription_idis stillsub_k7f5hgr7wy(same as before) - The
userfield in the event data now matches the updated filter - You’ll no longer receive events for the previous user (
0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b)
Example: Changing Filter Types
You can also change the filter type entirely. For example, switch from user filters to condition ID filters:Benefits
- Efficiency: No need to unsubscribe and re-subscribe
- Consistency: Maintains the same subscription ID
- Seamless: No interruption in receiving events (after the update takes effect)
- Flexibility: Change filter types or criteria on the fly