Deriv API
Migration guide/Forget all

Forget all

Subscription

Unsubscribe from all streams of a given type. Simplified with fewer options.

Quick comparison

AspectLegacyNewAction required
Endpoint
✅ Same
forget_allforget_allNone
Auth Required
✅ Same
NoNoNone
Stream Types
⚠️ Changed
Enum (14 types)Any stringNone (validation relaxed)
Response Field
⚠️ Changed
OptionalRequiredUpdate response handling

Breaking changes

1. Stream type enum validation removed

What Changed: Legacy restricted stream types to a specific enum of 14 values:balance,candles,cashier_payments,p2p_advert,p2p_advertiser,p2p_order,proposal,proposal_open_contract,ticks,transaction,trading_platform_asset_listing,website_status,p2p_settings,crypto_estimations. New accepts any string value, providing more flexibility. Existing stream type names still work.

2. Response field now required

What Changed: In Legacy, the forget_all array in the response was optional. In New, this field is always present and required, ensuring consistent response handling.

3. Response array items now typed

What Changed: Legacy defined forget_all as an array without specifying item types. New explicitly types array items as strings, providing better type safety.

Request structure

Legacy Request Example

1{
2  "forget_all": "ticks"
3  // Must be one of: balance, candles,
4  // cashier_payments, p2p_advert, p2p_advertiser,
5  // p2p_order, proposal, proposal_open_contract,
6  // ticks, transaction, trading_platform_asset_listing,
7  // website_status, p2p_settings, crypto_estimations
8}
9
10// Or multiple types:
11{
12  "forget_all": ["ticks", "proposal"]
13}

New Request Example

1{
2  "forget_all": "ticks"
3  // Any string value accepted
4}
5
6// Or multiple types:
7{
8  "forget_all": ["ticks", "proposal"]
9  // Any string values accepted
10}

Response structure

Legacy Response Example

1{
2  "forget_all": ["sub-id-1", "sub-id-2"],
3  // ⚠️ forget_all is optional - may be absent
4  "echo_req": {
5    "forget_all": "ticks"
6  },
7  "msg_type": "forget_all"
8}

New Response Example

1{
2  "forget_all": ["sub-id-1", "sub-id-2"],
3  // ✓ forget_all is always present (required)
4  // ✓ Items are typed as strings
5  "echo_req": {
6    "forget_all": "ticks"
7  },
8  "msg_type": "forget_all"
9}

Code examples

Legacy Implementation

1// Valid stream types (enum restricted):
2// balance, candles, cashier_payments, p2p_advert,
3// p2p_advertiser, p2p_order, proposal,
4// proposal_open_contract, ticks, transaction,
5// trading_platform_asset_listing, website_status,
6// p2p_settings, crypto_estimations
7
8async function forgetAllTicks() {
9  const request = {
10    forget_all: "ticks"  // Must be valid enum value
11  };
12
13  ws.send(JSON.stringify(request));
14
15  ws.onmessage = (event) => {
16    const response = JSON.parse(event.data);
17    if (response.msg_type === 'forget_all') {
18      // ⚠️ forget_all may be undefined
19      if (response.forget_all) {
20        console.log('Unsubscribed from:', 
21          response.forget_all.length, 'subscriptions');
22      } else {
23        console.log('No subscriptions cancelled');
24      }
25    }
26  };
27}

New Implementation

1// Any string value accepted as stream type
2
3async function forgetAllTicks() {
4  const request = {
5    forget_all: "ticks"  // Any string accepted
6  };
7
8  ws.send(JSON.stringify(request));
9
10  ws.onmessage = (event) => {
11    const response = JSON.parse(event.data);
12    if (response.msg_type === 'forget_all') {
13      // ✓ forget_all is always present
14      console.log('Unsubscribed from:', 
15        response.forget_all.length, 'subscriptions');
16    }
17  };
18}