Use theDocumentation Index
Fetch the complete documentation index at: https://docs.xquik.com/llms.txt
Use this file to discover all available pages before exploring further.
prefect-xquik collection when a Prefect flow needs scheduled X (Twitter) reads: tweet search, tweet lookup, user search, user lookup, user timelines, or regional trends.
The current 0.1.4 release is read-focused. It ships one credentials block, an async Xquik client, and 6 Prefect tasks that return raw Xquik JSON dictionaries for downstream tasks, warehouses, dashboards, or alerts.
Prerequisites
- Xquik API key
- Python 3.10+
- Prefect 3
- Prefect work pool or local runner for scheduled deployments
Scheduled Workflows
Social Listening
Schedule
search_tweets to collect recent or top posts for a saved query, then pass raw JSON to reporting tasks.Profile Enrichment
Use
search_users and get_user to enrich customer, creator, or competitor records with current public profiles.Timeline Refresh
Run
get_user_tweets on a schedule to refresh public timelines with optional replies and parent-tweet context.Trend Alerts
Call
get_trends for worldwide or regional topics before downstream alert, dashboard, or warehouse steps.Install
PyPI publication is pending. Install the pinned GitHub release wheel:Credential Block
Store the API key in a Prefect block, not in flow source files. Setbase_url to the public Xquik REST base URL when creating the block.
Block Type
Xquik CredentialsAPI Key
Paste an Xquik API key from the dashboard.
Base URL
https://xquik.com/api/v1API Contract
Keep
2026-04-29 unless you intentionally pin a different public contract.Collection Shape
Credentials
XquikCredentials stores the API key, base URL, contract header, and timeout.Client
XquikClient uses httpx.AsyncClient, sends x-api-key, and raises XquikError for request or response failures.Tasks
6 async Prefect tasks cover read workflows for tweets, users, user timelines, and trends.
Returns
Tasks return raw Xquik JSON dictionaries. Shape rows in later Prefect tasks.
Retries
Use Prefect task options for retry policy and delay.
Scope
Version
0.1.4 is read-only. Use REST, SDKs, or MCP for writes, monitors, webhooks, and extraction jobs.Tasks
Search Tweets
search_tweets(credentials, query, limit=25, query_type="Latest") calls GET /x/tweets/search.Get Tweet
get_tweet(credentials, tweet_id) calls GET /x/tweets/{id}.Search Users
search_users(credentials, query, cursor=None) calls GET /x/users/search.Get User
get_user(credentials, user_id) calls GET /x/users/{id}. Usernames may include @.Get User Tweets
get_user_tweets(credentials, user_id, include_replies=False) calls GET /x/users/{id}/tweets.Get Trends
get_trends(credentials, woeid=1, count=30) calls GET /x/trends.Copy-Ready Flow
Use this flow when a scheduled job should capture current posts and worldwide trends for a reporting task.Result Handoff
Tweet Pages
search_tweets and get_user_tweets return tweets, has_next_page, and next_cursor. Store the cursor with the job checkpoint.User Pages
search_users returns users, has_next_page, and next_cursor. get_user returns one public profile dictionary.Trend Pages
get_trends returns trends, count, and woeid. Trend rows include name and can include description, query, and rank.Downstream Rows
Normalize raw dictionaries in a follow-up task before writing to Slack, Sheets, a warehouse, or a dashboard.
Retry Pattern
Wrap the task with Prefect options when you want retries around transient API, network, or rate-limit failures.Retry-After for repeated 429 responses, and keep limit at or below 200 for tweet search pages.
Failure Routing
XquikError exposes status_code and response_text when an HTTP response is available. Use them to decide whether the flow should fail fast, pause for account action, or retry later.
Inspect Status
Catch
XquikError and branch on status_code. Store response_text with the failed run for debugging.Fix Inputs
Treat
400 and 404 as non-retryable. Fix the query, ID, username, or cursor before rerunning.Pause Billing Stops
Treat
402 as an account action. Check subscription or credits before the next schedule.Back Off Reads
Treat
429, 500, 502, and 503 as retryable with Prefect retry settings and slower schedules.Pagination Handoff
Xquik returns cursor fields for paginated reads. Store the cursor in your task result or downstream state, then pass it back unchanged on the next run.Production Notes
Credentials
Store API keys in Prefect blocks. Do not put API keys in deployment YAML, repository files, or logs.
Billing
X data reads use credits. Handle
402 no_subscription, 402 no_credits, and 402 insufficient_credits before retrying.Rate Limits
Read endpoints share a 10 per 1s user bucket. Retry only after the
Retry-After window.Raw JSON
Shape records in follow-up tasks before writing to Slack, Sheets, a warehouse, or a dashboard.
Read Scope
Use this collection for reads. Use REST, SDKs, or MCP when a flow needs writes, monitors, webhooks, or extraction jobs.
Version Pin
Pin the release wheel in production images until PyPI publication is available.
Next Steps
- Read Rate Limits for retry and backoff guidance.
- Read Error Handling for
401,402,429, and5xxrecovery. - Use Extraction Workflow when a job needs durable CSV, JSON, XLSX, Markdown, or PDF exports.
- Use MCP Tools when an AI agent should decide which Xquik endpoint to call.