Interested in exploring Labs?
The endpoints we release in Labs are previews of tools that may be released more broadly in the future, but will likely undergo changes before then. We encourage you to take that into consideration as you explore. Before getting started, please read more about Twitter Developer Labs.
 

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 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.



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 "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"
      ]
    }
  }'

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.