Skip to main content
This guide walks you through connecting to the filtered stream to receive near real-time Posts matching your filter rules.
PrerequisitesBefore you begin, you’ll need:
  • A developer account
  • Your App’s Bearer Token (found in the Developer Console under “Keys and tokens”)

Create a filter rule

Rules define which Posts to receive. Use operators to match on keywords, hashtags, users, and more.Example rule: Match Posts containing “cat” with images:

Build a rule

Learn rule syntax and operators

Add the rule to your stream

Add your rule using the rules endpoint. Include a tag to identify which rule matched each Post:
cURL
Response:

Verify your rules

List all active rules to confirm your rule was added:
cURL

Connect to the stream

Open a persistent connection to receive matching Posts:
cURL

Process incoming Posts

Matching Posts stream as JSON objects:
The matching_rules array shows which rules matched the Post, using the tags you defined.

Delete rules (optional)

Remove rules by their ID:
cURL

Managing your connection

The stream sends blank lines (\r\n) every 20 seconds. If you don’t receive data or a keep-alive for 20 seconds, reconnect.
Press Ctrl+C to close the connection, or close your terminal window.
Only one connection per App is allowed. Opening a new connection will close any existing one.

Next steps

Build a rule

Learn rule syntax

Operator reference

All available operators

Handling disconnections

Reconnect gracefully

API Reference

Full endpoint documentation