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.

Overview

The endpoints we release in Labs will be previews and are likely to change before they are released broadly, so we encourage you to take that into consideration as you build. Before getting started, we encourage you to read more about Twitter Developer Labs.

The filtered stream endpoints allow developers to filter the real-time stream of public Tweets. Developers can filter the real-time stream by applying a set of rules (specified using a combination of operators), and they can select the response format on connection.

This preview contains a streaming endpoint that delivers Tweets in real-time. It also contains a set of rules endpoints to create, delete and dry-run rule changes. During Labs, you can create up to 10 rules (each one up to 512 characters long) can be set on your stream at the same time. Unlike the existing statuses/filter endpoint, these rules are retained and are not specified at connection time.

Streaming endpoint

The streaming endpoint is a simple GET connection authenticated using a bearer token. Once a connection is established, Tweets are delivered in JSON format (see sample payload below) through a persistent HTTP Streaming connection. You will only receive content matching your rules while connected to the stream.

Rules and operators endpoint

Rules can be set by specifying a combination of keywords (a specific word or emoji, or full text match) and operators. Operators can be joined and negated to specify complex expressions.

You can specify a tag for each rule you define. This tag is a label that can be used to quickly identify a rule. For example, you can assign the tag cat-meme to the rule "grumpy cat" has:images to identify the rule you set. When a Tweet is delivered through the streaming endpoint, it will also return a set of matching rules including their tags.

 


 

Additional resources