Add/Delete rules
Add or delete rules from a user's active rule set. Users can provide unique, optionally tagged rules to add. Users can delete their entire rule set or a subset specified by rule ids or values.
Query parameters
-
Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes.
POST
/2/tweets/search/stream/rules
curl \
-X POST https://api.twitter.com/2/tweets/search/stream/rules \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"add":[{"value":"coffee -is:retweet","tag":"Non-retweeted coffee tweets"}]}'
Request examples
Addrulesrequest (generated)
{
"add": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee tweets"
}
]
}
{
"delete": {
"ids": [
"120897978112909812"
],
"values": [
"coffee -is:retweet"
]
}
}
Request examples
Addrulesrequest
{
"add": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee tweets"
}
]
}
{
"delete": {
"ids": [
"120897978112909812"
],
"values": [
"coffee -is:retweet"
]
}
}
Response examples (default)
{
"code": 42,
"message": "string"
}
Response examples (default)
{
"code": 42,
"message": "string"
}
Response examples (200)
{
"data": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee tweets",
"id": "120897978112909812"
}
],
"meta": {
"sent": "string",
"summary": {
"created": 1,
"not_created": 1,
"valid": 1,
"invalid": 1
}
},
"errors": [
{
"type": "string",
"title": "string",
"detail": "string",
"status": 42
}
]
}
Response examples (200)
{
"data": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee tweets",
"id": "120897978112909812"
}
],
"meta": {
"summary": {
"created": 1,
"not_created": 1,
"valid": 1,
"invalid": 1
},
"sent": "string"
},
"errors": [
{
"type": "string",
"title": "string",
"detail": "string",
"status": 42
}
]
}