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.



Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 2.0 Bearer token

Rate limit450 requests per 15-minute window

Learn more about rate limits.



Query parameters

NameTypeDescription
dry_run
 Optional 
booleanSet to true to test a the syntax of your payload without submitting it.


JSON body parameters

NameTypeDescription
delete
 Required 
objectSpecifies the operation you want to perform on the rules.
delete.ids
 Required 
arrayArray of rule IDs, each one representing a rule already active in your stream. IDs must be submitted as strings.


Examples

  • 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 'Authorization: Bearer $BEARER_TOKEN' -d '{
    "delete": {
      "ids": [
        "1165037377523306498"
      ]
    }
  }'
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \\
  -H 'Authorization: Bearer $BEARER_TOKEN' -d '{
    "delete": {
      "ids": [
        "1165037377523306498",
        "1165037377523306499"
      ]
    }
  }'
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \\
  -H 'Authorization: Bearer $BEARER_TOKEN' -d '{
    "delete": {
      "values": [
        "caturday"
      ]
    }
  }'
curl -X POST 'https://api.twitter.com/labs/1/tweets/stream/filter/rules' \\
  -H 'Authorization: Bearer $BEARER_TOKEN' -d '{
    "delete": {
      "values": [
        "caturday",
        "cats has:media"
      ]
    }
  }'

Response

  • 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.sentdate (ISO 8601)The 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.