This endpoint has been updated to include Post edit metadata. Learn more about these metadata on the “Edit Posts” fundamentals page.Documentation Index
Fetch the complete documentation index at: https://x-preview-mintlify-weekly-changelog-1778710653.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Enterprise This is an enterprise API available within our managed access levels only. To use this API, you must first set up an account with our enterprise sales team. Learn more You can view all of the X API filtered stream offerings HERE. The PowerTrack API provides customers with the ability to filter the full X firehose, and only receive the data that they or their customers are interested in. This is accomplished by applying the PowerTrack filtering language - see Rules and filtering - to match Posts based on a wide variety of attributes, including user attributes, geo-location, language, and many others. Using PowerTrack rules to filter Post ensures that customers receive all of the data, and only the data they need for your app.Core components
The PowerTrack API consists of two endpoints:Rules endpoint
A separate endpoint managed independently by your application, the rules endpoint supports GET, POST, POST _method=delete and rule validation methods with basic authentication for managing your ruleset. It can support thousands of rules that allow you to filter the realtime stream of data for the topics and conversations that you care about. The rules endpoint can be accessed, managed, and will persist regardless of your connection status to the stream - you can also update (add/remove) rules while connected to the stream and the changes will take effect almost immediately.Stream endpoint
Connecting to the streaming endpoint consists of a simple GET request using basic authentication. Once a connection is established, data is delivered in JSON format (see sample payload below) through a persistent HTTP Streaming connection. You will only receive data matching your rules while connected to the stream.Rule tags
A single PowerTrack stream can support thousands of rules, so being able to discern which rule(s) matched a given Post becomes important. This is easily solved by using rule tags. Upon rule creation, you can assign a tag value which will be returned in the matching_rules object (see here) of the response payload. Rule tags can represent an end customer use case, a topic or conversation, or another helpful identifier that you can use to route incoming Posts accordingly. If, in addition to realtime data, your product also requires instant access to recent data, we recommend using our Search API.Available operators
The PowerTrack API currently supports the following operators:- keyword
- emoji
- “exact phrase match”
- “keyword1 keyword2”~N
- contains:
- from:
- to:
- url:
- url_title:
- url_description:
- url_contains:
- has:links
- sample:
-
- point_radius:[lon lat radius]
- bounding_box:[west_long south_lat east_long north_lat]
- @
- $
- bio:
- bio_name:
- retweets_of:
- lang:
- bio_location:
- statuses_count:
- followers_count:
- friends_count:
- listed_count:
- is:verified
- source:
- place:
- place_country:
- has:geo
- has:mentions
- has:hashtags
- has:images
- has:videos
- has:media
- has:symbols
- is:retweet
- is:reply
- is:quote
- retweets_of_status_id:
- in_reply_to_status_id:
- has:profile_geo
- profile_point_radius:[long lat radius]
- profile_bounding_box:[west_long south_lat east_long north_lat]
- profile_country:
- profile_region:
- profile_locality:
- profile_subregion:
Sample payload
Below is a sample payload from the PowerTrack API in Native Enriched format:- See simple scripts in several languages to help get started
- See an example Java client libraries: Hosebird Client adapted for enterprise streams, Gnip4J
- See an example Python client library
Guides
Integrating with PowerTrack
To integrate PowerTrack into your product, you will need to build an application that can do the following:- Establish a streaming connection to the PowerTrack stream API.
- Asynchronously send POST requests to the PowerTrack rules API to add and delete rules from the stream.
- Handle low data volumes – Maintain the streaming connection, and ensure buffers are flushed regularly.
- Handle high data volumes – de-couple stream ingestion from additional processing using asynchronous processes.
- Reconnect to the stream automatically when disconnected for any reason.