Deriv API
Documentation

Forget

SubscriptionNo Auth

Immediately cancel the real-time stream of messages with a specific ID.

Quick comparison

AspectLegacy APINew APIAction
EndpointforgetforgetNone
Auth RequiredNoNoNone
Stream ID PatternStrictAny stringNone
Response FieldOptionalRequiredUpdate response handling

Breaking changes

1. Stream ID pattern validation relaxed

Legacy enforced a strict pattern ^[\w-]{32,128}$ for stream IDs. New accepts any string value, providing more flexibility.

2. Response field always present

In Legacy, the forget field in the response was optional. In New, this field is always present and required.

Request structure

Legacy APIrequest example
{
  "forget": "d1ee7d0d-3ca9-fbb4-720b-5312d487185b"
}
New APIrequest example
{
  "forget": "d1ee7d0d-3ca9-fbb4-720b-5312d487185b"
}

Response structure

Legacy APIresponse example
{
  "forget": 1,  // Optional field
  "msg_type": "forget"
}
New APIresponse example
{
  "forget": 1,  // ⚠️ Now required
  "msg_type": "forget"
}

Code examples

async function cancelStream(streamId) {
  const request = {
    forget: streamId
  };
  
  ws.send(JSON.stringify(request));

  ws.onmessage = (msg) => {
    const response = JSON.parse(msg.data);
    if (response.msg_type === 'forget') {
      if (response.forget === 1) {
        console.log('Stream successfully cancelled');
      }
    }
  };
}
Click to open live chat support. Get instant help from our support team.