The filtered stream endpoint group enables developers to filter the real-time stream of public Tweets. This endpoint group’s functionality includes multiple endpoints that enable you to create and manage rules, and apply those rules to filter a stream of real-time Tweets that will return matching public Tweets. This endpoint group allows users to listen for specific topics and events in real-time, monitor the conversation around competitions, understand how trends develop in real-time, and much more.
Developers can use the REST rules endpoint to add and remove rules to a persistent stream connection without needing to disconnect. If you are using a Standard Project at the Basic access level, you can add up to 25 concurrent rules to your stream, and each rule can be up to 512 characters long. If you are using an Academic Research Project, at the Basic access level, you can add up to 1,000 concurrent rules to your stream, and each rule can be up to 1,024 characters long. These rules can be created with operators that match on Tweet attributes, such as message keywords, hashtags, and URLs. Operators and rule clauses can be combined with boolean logic and parentheses to help refine the filter’s matching behavior.
Once you've added a set of rules, you can establish a streaming connection which will start to deliver Tweet objects in JSON format through a persistent HTTP Streaming connection. You will only receive content matching your rules while connected to the stream.
To access this endpoint, you must have an approved developer account, and have activated the new developer portal. When authenticating, you must use keys and tokens from a developer App that is located within a Project. Learn more about getting access to the Twitter API v2 endpoints in our "Getting started" page.