Skip to main content
POST
Create filter rule

Authorizations

x-api-key
string
header
required

Your ScrapeBadger API key. You can find this in your dashboard at https://scrapebadger.com/dashboard/api-keys.

Body

application/json

Filter rule configuration.

tag
string
required

Human-readable label for the filter rule.

Required string length: 1 - 100
Example:

"AI news tracker"

query
string
required

Twitter Advanced Search query. Supports operators like from:, to:, min_faves:, lang:, etc.

Required string length: 1 - 1024
Example:

"(\"artificial intelligence\" OR \"machine learning\") min_faves:100 lang:en"

interval_seconds
number
required

Polling interval in seconds. Lower intervals detect tweets faster but cost more credits per day.

Required range: 0.1 <= x <= 86400
Example:

60

max_results_per_poll
integer
default:20

Maximum number of tweets to return per poll cycle.

Required range: 1 <= x <= 100
webhook_url
string | null

HTTPS URL to receive webhook deliveries. Must use HTTPS.

Example:

"https://example.com/webhooks/filter-rules"

webhook_secret
string | null

Secret used to sign webhook payloads with HMAC-SHA256.

Response

Filter rule created successfully.

Filter rule configuration and status.

id
string
required

Unique filter rule identifier.

tag
string
required

Human-readable label for the rule.

Example:

"AI news tracker"

query
string
required

Twitter Advanced Search query.

Example:

"(\"artificial intelligence\" OR \"machine learning\") min_faves:100 lang:en"

interval_seconds
number
required

Polling interval in seconds.

Example:

60

max_results_per_poll
integer
required

Maximum number of tweets returned per poll cycle.

Example:

20

status
enum<string>
required

Current status of the rule. Suspended indicates the rule was auto-paused due to insufficient credits.

Available options:
active,
paused,
suspended
created_at
string<date-time>
required

Timestamp when the rule was created.

updated_at
string<date-time>
required

Timestamp when the rule was last updated.

status_reason
string | null

Reason for the current status, if applicable.

webhook_url
string | null

HTTPS URL receiving webhook deliveries.

webhook_secret_set
boolean

Whether a webhook secret is configured. The actual secret is never returned.

credits_per_rule_per_day
number

Credit cost per day for this rule at the current interval.

pricing_tier
string

Current pricing tier label based on interval.

Example:

"1-minute"