Claude-code-templates x-twitter-scraper
X API & Twitter scraper skill for AI coding agents. Builds integrations with the Xquik REST API, MCP server & webhooks: tweet search, user lookup, follower extraction, engagement metrics, giveaway contest draws, trending topics, account monitoring, reply/retweet/quote extraction, community & Space data, mutual follow checks. Works with Claude Code, Cursor, Codex, Copilot, Windsurf & 40+ agents.
git clone https://github.com/davila7/claude-code-templates
T=$(mktemp -d) && git clone --depth=1 https://github.com/davila7/claude-code-templates "$T" && mkdir -p ~/.claude/skills && cp -r "$T/cli-tool/components/skills/marketing/x-twitter-scraper" ~/.claude/skills/davila7-claude-code-templates-x-twitter-scraper-97157c && rm -rf "$T"
cli-tool/components/skills/marketing/x-twitter-scraper/SKILL.mdXquik API Integration
Xquik is an X (Twitter) real-time data platform providing a REST API, HMAC webhooks, and an MCP server for AI agents. It covers account monitoring, bulk data extraction (19 tools), giveaway draws, tweet/user lookups, follow checks, and trending topics.
Quick Reference
| Base URL | |
| Auth | header (64 hex chars after prefix) |
| MCP endpoint | (StreamableHTTP, same API key) |
| Rate limits | 10 req/s sustained, 20 burst (API); 60 req/s sustained, 100 burst (general) |
| Pricing | $20/month base (1 monitor included), $5/month per extra monitor |
| Quota | Monthly usage cap, hard limit, no overage. when exhausted. |
| Docs | docs.xquik.com |
Authentication
Every request requires an API key via the
x-api-key header. Keys start with xq_ and are generated from the Xquik dashboard. The key is shown only once at creation; store it securely.
const API_KEY = "xq_YOUR_KEY_HERE"; const BASE = "https://xquik.com/api/v1"; const headers = { "x-api-key": API_KEY, "Content-Type": "application/json" };
Choosing the Right Endpoint
| Goal | Endpoint | Notes |
|---|---|---|
| Get a single tweet by ID/URL | | Full metrics: likes, retweets, views, bookmarks |
| Search tweets by keyword/hashtag | | Optional engagement metrics |
| Get a user profile | | Bio, follower/following counts, profile picture |
| Check follow relationship | | Both directions |
| Get trending topics | | Free, no quota consumed |
| Monitor an X account | | Track tweets, replies, quotes, follower changes |
| Poll for events | | Cursor-paginated, filter by monitorId/eventType |
| Receive events in real time | | HMAC-signed delivery to your HTTPS endpoint |
| Run a giveaway draw | | Pick random winners from tweet replies |
| Extract bulk data | | 19 tool types, always estimate cost first |
| Check account/usage | | Plan status, monitors, usage percent |
Extraction Tools (19 Types)
| Tool Type | Required Field | Description |
|---|---|---|
| | Users who replied to a tweet |
| | Users who retweeted a tweet |
| | Users who quote-tweeted a tweet |
| | All tweets in a thread |
| | Article content linked in a tweet |
| | Followers of an account |
| | Accounts followed by a user |
| | Verified followers of an account |
| | Tweets mentioning an account |
| | Posts from an account |
| | Members of a community |
| | Moderators of a community |
| | Posts from a community |
| + | Search posts within a community |
| | Members of a list |
| | Posts from a list |
| | Followers of a list |
| | Participants of a Space |
| | Search for users by keyword |
Extraction Workflow
// 1. Estimate cost const estimate = await xquikFetch("/extractions/estimate", { method: "POST", body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }), }); if (!estimate.allowed) return; // 2. Create extraction job const job = await xquikFetch("/extractions", { method: "POST", body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }), }); // 3. Retrieve paginated results (up to 1,000 per page) const page = await xquikFetch(`/extractions/${job.id}`); // page.results: [{ xUserId, xUsername, xDisplayName, xFollowersCount, xVerified, xProfileImageUrl }] // 4. Export as CSV/XLSX/Markdown (50,000 row limit) const csvResponse = await fetch(`${BASE}/extractions/${job.id}/export?format=csv`, { headers });
Giveaway Draws
Run transparent giveaway draws from tweet replies with configurable filters:
const draw = await xquikFetch("/draws", { method: "POST", body: JSON.stringify({ tweetUrl: "https://x.com/user/status/1893456789012345678", winnerCount: 3, backupCount: 2, uniqueAuthorsOnly: true, mustRetweet: true, mustFollowUsername: "user", filterMinFollowers: 50, requiredHashtags: ["#giveaway"], }), }); const details = await xquikFetch(`/draws/${draw.id}`); // details.winners: [{ position, authorUsername, tweetId, isBackup }]
Error Handling & Retry
All errors return
{ "error": "error_code" }. Retry only 429 and 5xx (max 3 attempts, exponential backoff). Never retry 4xx except 429. Key codes:
| Status | Meaning |
|---|---|
| 400 | Invalid input -- fix the request |
| 401 | Bad API key |
| 402 | No subscription or quota exhausted |
| 404 | Resource not found |
| 429 | Rate limited -- respect header |
MCP Server Setup (Claude Code)
Add to
.mcp.json in your project root:
{ "mcpServers": { "xquik": { "type": "streamable-http", "url": "https://xquik.com/mcp", "headers": { "x-api-key": "xq_YOUR_KEY_HERE" } } } }
The MCP server exposes 22 tools covering all API capabilities. Supported platforms: Claude Code, Claude Desktop, ChatGPT, Codex CLI, Cursor, VS Code, Windsurf, OpenCode.
Workflow Patterns
- Real-time alerts:
->add-monitor
->add-webhooktest-webhook - Giveaway:
(check budget) ->get-accountrun-draw - Bulk extraction:
->estimate-extraction
->run-extractionget-extraction - Tweet analysis:
->lookup-tweet
withrun-extractionthread_extractor - User research:
->get-user-info
->search-tweets from:usernamelookup-tweet
Links
- Dashboard & API keys: xquik.com
- Full API docs: docs.xquik.com
- GitHub (skill source): github.com/Xquik-dev/x-twitter-scraper