Please note:

We graduated the Labs version of filtered stream into Twitter API v2: Early Access and retired it in October 2020.

Learn more about the new filtered stream, and review our migration resources to update to The New Twitter API.


POST /labs/1/tweets/stream/filter/rules (delete)

Deletes filter rules. This endpoint can delete multiple rules at a time by specifying an array of IDs. If one or more rules cannot be deleted (for example, because it does not exist), the operation will not fail. In other words, only existing rules will be deleted.



Endpoint URL

https://api.twitter.com/labs/1/tweets/stream/filter/rules

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 2.0 Bearer token

Rate limit 450 requests per 15-minute window

Learn more about rate limits.



Query parameters

Name Type Description
dry_run
 Optional 
boolean Set to true to test a the syntax of your payload without submitting it.



JSON body parameters

Name Type Description
delete
 Required 
object Specifies the operation you want to perform on the rules.
delete.ids
 Required 
array Array of rule IDs, each one representing a rule already active in your stream. IDs must be submitted as strings.



Example requests

  • Delete one rule by ID
  • Delete multiple rules by ID
  • Delete one rule by value
  • Delete multiple rules by value
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer $BEARER_TOKEN" -d \
  '{
    "delete": {
      "ids": [
        "1165037377523306498"
      ]
    }
  }'
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer $BEARER_TOKEN" -d \
  '{
    "delete": {
      "ids": [
        "1165037377523306498",
        "1165037377523306499"
      ]
    }
  }'
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer $BEARER_TOKEN" -d \
  '{
    "delete": {
      "values": [
        "caturday"
      ]
    }
  }'
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer $BEARER_TOKEN" -d \
  '{
    "delete": {
      "values": [
        "caturday",
        "cats has:media"
      ]
    }
  }'

Example responses

  • Success
  • Error
{
  "meta": {
    "sent": "2019-08-29T01:48:54.633Z",
    "summary": {
      "deleted": 1,
      "not_deleted": 0
    }
  }
}
{
  "meta": {
    "sent": "2019-08-29T02:23:08.416Z",
    "summary": {
      "deleted": 0,
      "not_deleted": 1
    }
  },
  "errors": [
    {
      "errors": [
        {
          "parameters": {},
          "message": "Rule does not exist"
        }
      ],
      "type": "https://api.twitter.com/labs/1/problems/invalid-request",
      "title": "Invalid Request",
      "detail": "One or more parameters to your request was invalid."
    }
  ]
}

Response fields

NameTypeDescription
meta.sentnumberThe time when the request body was returned.
meta.summary.deletedintegerThe number of rules that have been deleted as a result of this request.
meta.summary.not_deletedintegerThe number of rules that could not be deleted as part of this request. If this value is greater than 0, the errors object will be present and it will detail the reason for each rule.
errorsobjectContains details about errors that affected any of the requested Tweets. See Status codes and error messages for more details.

Was this document helpful?

Thank you

Thank you for the feedback. We’re really glad we could help!

Thank you for the feedback. How could we improve this document?

Thank you for the feedback. Your comments will help us improve our documents in the future.