> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xquik.com/llms.txt
> Use this file to discover all available pages before exploring further.

# X API workflows for tweets, followers & webhooks

> Choose workflows for tweet lookup, search, follower export, profile monitors, signed webhooks, MCP agents, file exports, or DMs. Includes exact API steps.

> For the complete documentation index, see [llms.txt](https://docs.xquik.com/llms.txt).

Choose a workflow for dashboards, webhooks, agents, exports, or content. Open its API examples. Run the [API checklist](https://docs.xquik.com/guides/x-api-integration-checklist.md) before launch.

> [card] Monitor & poll
>
> Batch processing, dashboards, and low-frequency checks. Interval-based, low setup effort.

> [card] Signed monitor webhooks
>
> Alerts, queues, support triage, and warehouse sync. Medium setup effort.

> [card] AI agent (MCP)
>
> Tweet search, user lookups, follower checks, and research summaries. Low setup effort.

> [card] Publish tweet or reply
>
> Post tweets, post tweet replies, and hand off public media URLs. Low setup effort.

> [card] Tweet composition
>
> Draft generation and reply monitoring. Low setup effort.

## Choose a workflow

> [card] Track competitor or brand posts
>
> Use monitor polling or webhooks. Both return tweets, replies, quotes, and retweets.

> [card] Send monitor alerts
>
> Use signed webhooks. They deliver event payloads to queues or support tools.

> [card] Build an AI research assistant
>
> Use the MCP path. It returns tweet search results, user profiles, and monitor events.

> [card] Export followers or audiences
>
> Use extraction workflows. They return CSV, JSON, XLSX, or paginated JSON.

> [card] Sync followers to CRM
>
> Use the follower export CRM workflow. It returns CSV, XLSX, JSON, and a CRM field map.

> [card] Post a tweet or reply
>
> Use the create tweet workflow. It returns published `tweetId`, `success`, `charged`, and `chargedCredits`.

> [card] Score and refine a draft tweet
>
> Use tweet composition. It returns algorithm guidance, refined text, and score.

> [card] Audit giveaway activity
>
> Use draws. They return eligible participants, winners, and archived tweet metrics.

## Use-case endpoint finder

Start here when a user asks which Xquik endpoint to call. Pick the matching
job, then open the API page for params, responses, and examples.

* **One tweet by ID.** `GET /x/tweets/{id}`. Hand off a tweet row with media and metrics.
* **Many known tweet IDs.** `GET /x/tweets`. Hand off the batch response before single-tweet loops.
* **Keyword or advanced search.** `GET /x/tweets/search`. Hand off cursor pages, or `tweet_search_extractor` exports.
* **Profile timeline.** `GET /x/users/{id}/tweets`. Hand off `cursor`, `includeReplies`, and `includeParentTweet`.
* **Article body.** `GET /x/articles/{tweetId}`. Hand off body blocks, cover image, author, and not-found handling.
* **Replies, quotes, or threads.** `GET /x/tweets/{id}/replies`. Hand off conversation rows from replies, quotes, or threads.
* **Follower or following page.** `GET /x/users/{id}/followers` or `GET /x/users/{id}/following`. Hand off `users`, `has_next_page`, and `next_cursor`.
* **Follower or following export.** `POST /extractions/estimate`. Hand off the `follower_explorer` or `following_explorer` estimate, job, CSV, JSON, or XLSX.
* **Campaign verification.** `GET /x/followers/check`, retweeters, replies, quotes, or draws. Hand off proof exports.
* **Post tweet or reply.** `POST /x/tweets`. Hand off `tweetId`, write status, credits, and public media URLs.
* **Direct messages.** `GET /x/dm/{userId}/history`. Hand off history, cursor state, outbound `messageId`, and success.
* **1-second monitoring.** `POST /monitors` or `POST /monitors/keywords`. Hand off signed payloads and delivery IDs.
* **AI agent handoff.** `xquik.request(...)`. Hand off normalized Xquik API results for MCP clients.
* **Saved file exports.** `GET /extractions/{id}/export`. Hand off CSV, JSON, XLSX, Markdown, PDF, or TXT.

## Integration handoff matrix

Use this matrix before choosing code, webhooks, MCP, or exports.

> [accordion] Competitor or brand monitoring
>
> Setup needs an API key, an account username or keyword query, and event types.
> First, call `POST /monitors` for accounts or `POST /monitors/keywords` for search queries, then `GET /events`.
> It returns tweet, reply, quote, and retweet events.
> Hand off a polling cursor or signed webhook payload.
> Active monitors bill 30 credits per hour while enabled.

> [accordion] Monitor alert routing
>
> Setup needs a webhook URL and subscribed event types.
> First, call `POST /webhooks`, then `POST /webhooks/{id}/test`.
> It returns the delivery status and signed event body.
> Hand off to a queue, Slack, CRM, or warehouse endpoint.
> Active monitor billing includes webhook management and deliveries.

> [accordion] AI research agent
>
> Setup needs an MCP API key or OAuth.
> First, call `xquik.request('/api/v1/x/tweets/search')`.
> It returns tweets, profiles, and monitor events.
> Hand off the MCP tool result with normalized pagination.
> Tweet search, profile lookup, and follower exports use endpoint credits.

> [accordion] Audience export handoff
>
> Setup needs a target username, `follower_explorer` or `following_explorer`, and optional `resultsLimit`.
> First, call `POST /extractions/estimate`, then `POST /extractions`.
> It returns job status, rows, and export links.
> Hand off CSV, JSON, XLSX, or paginated JSON.
> Estimate the cost before creating the job.

> [accordion] Tweet replies export
>
> Setup needs a tweet ID and optional `resultsLimit`.
> First, call `POST /extractions/estimate` with `reply_extractor`.
> It returns reply author fields, reply tweet fields, engagement counts, and metadata.
> Hand off CSV, JSON, XLSX, JSONL, or moderation queue rows.
> Each reply returned or extracted costs 1 credit.

> [accordion] Post tweets or replies
>
> Setup needs a connected X account plus text, media URLs, or parent tweet ID.
> First, call `POST /x/tweets`.
> It returns `tweetId`, `success`, `charged`, and `chargedCredits`.
> Hand off the published tweet ID and charged credits.
> Use them for queue, CRM, CMS, or agent state.
> A text-only post costs 30 credits. Attached media adds 2 credits per started MB.

> [accordion] Tweet draft workflow
>
> Setup needs a topic, goal, tone, and optional style username.
> First, call `POST /compose` with `step`.
> It returns algorithm guidance, refined draft, and score checklist.
> Hand off draft text or an X compose URL.
> Compose, refine, and score cost no credits.

## High-value workflows first

Prioritize rows for analysts and IDs for systems of record. Also prioritize events for queues and published action IDs for audit trails.

> [card] 1. Scrape tweets to CSV, JSON, or XLSX
>
> Exports matching tweets as rows for research, leads, support, and AI retrieval.
> First, call `POST /extractions/estimate` with `tweet_search_extractor`.
> Hand off an export file, paginated JSON, or a direct `GET /x/tweets/search` page.
> Each tweet returned or extracted costs 1 credit.

> [card] 2. Scrape tweet replies to CSV, JSON, or XLSX
>
> Exports a post's replies as rows for moderation, support, giveaways, research, or AI review.
> First, call `POST /extractions/estimate` with `reply_extractor` and `targetTweetId`.
> Hand off an export file, paginated JSON, JSONL rows, or a direct `GET /x/tweets/{id}/replies` page.
> Each reply returned or extracted costs 1 credit.

> [card] 3. Export followers or following to CRM
>
> Builds audience and interest tables with stable X user IDs for import and upsert.
> First, call `POST /extractions/estimate` with `follower_explorer` or `following_explorer`.
> Hand off CSV, JSON, XLSX, or a CRM field map keyed by `x_user_id`.
> Each user returned costs 1 credit.

> [card] 4. Monitor tweets to signed webhooks
>
> Delivers new posts, replies, quotes, and retweets to queues without polling.
> First, call `POST /monitors` for accounts or `POST /monitors/keywords` for search queries, then `POST /webhooks`.
> Hand off a signed payload with `deliveryId`, `streamEventId`, `eventType`, and tweet data.
> Each active monitor-hour costs 30 credits. The rate includes webhook delivery.

> [card] 5. Post media tweets or replies
>
> Publishes media tweets or replies from public image URLs or 1 public MP4 URL.
> The MP4 can be up to 100 MB.
> First, call `POST /x/tweets` with `media`.
> Hand off `tweetId`, `success`, `chargedCredits`, original `media` URLs, and optional `reply_to_tweet_id`.
> A text-only post costs 30 credits. Attached media adds 2 credits per started MB.

> [card] 6. Send direct messages with returned IDs
>
> Lets support, sales, and agents store the outbound message ID.
> First, call `GET /x/users/{id}` if needed. Use `GET /x/dm/{userId}/history?account=...`, then `POST /x/dm/{userId}`.
> Hand off `account`, `messages`, `has_next_page`, `next_cursor`, `messageId`, and `success`.
> Each user lookup or history message costs 1 credit. Each DM send costs 10 credits.

### 1. Scrape tweets to CSV, JSON, or XLSX

Use this to scrape tweets, search tweets, or export hashtag results. You can also use it to hand matching posts to analysts. Estimate first, create the job, poll it, then export the format your system expects. For reply-specific exports, use the next workflow.

```bash theme={null}
curl -X POST https://xquik.com/api/v1/extractions/estimate \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "toolType": "tweet_search_extractor",
    "searchQuery": "from:username webhook OR SDK",
    "language": "en",
    "resultsLimit": 500
  }' | jq
```

The extraction returns a job ID. `GET /extractions/{id}` returns `job`, `results`, `hasMore`, and `nextCursor`. `GET /extractions/{id}/export?format=csv` downloads the rows. For live pagination without a stored job, call `GET /x/tweets/search` with `q`. Leave `limit` unset for a simple cursor loop. Or set `limit` for a bounded pull. Then keep the same `q`, filters, and `limit` while sending `next_cursor` as `cursor`. It returns `tweets`, `has_next_page`, and `next_cursor`.

### 2. Scrape tweet replies to CSV, JSON, or XLSX

Use this when a system needs every reply under a post as rows. It fits moderation, support, giveaway, research, or AI review systems. Estimate with `reply_extractor` and `targetTweetId`, create the job, and poll it. Then export `format=csv`, `format=json`, or `format=xlsx`.

```bash theme={null}
curl -X POST https://xquik.com/api/v1/extractions/estimate \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "toolType": "reply_extractor",
    "targetTweetId": "1893704267862470862",
    "resultsLimit": 500
  }' | jq
```

`GET /extractions/{id}` returns reply rows, `hasMore`, and `nextCursor`. Pass `nextCursor` as `cursor` for more stored results. For live pagination without a stored job, call `GET /x/tweets/{id}/replies`. Then pass `next_cursor` back as `cursor`. Store `tweets`, `has_next_page`, and `next_cursor`.

### 3. Export followers or following to CRM

Use this for follower export, following export, audience ownership, CRM import, or warehouse sync. Keep `resultsLimit` on estimate and create calls for a predictable credit cap.

```bash theme={null}
curl -X POST https://xquik.com/api/v1/extractions \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "toolType": "follower_explorer",
    "targetUsername": "username",
    "resultsLimit": 10000
  }' | jq
```

When the job needs accounts the user follows, use `following_explorer`. It takes the same `targetUsername` shape. After `status` becomes `completed`, export `format=csv`, `format=xlsx`, or `format=json`. Map stable `User ID` values to `x_user_id`. Do not key imports by display name.

### 4. Monitor tweets to signed webhooks

Use this for account alerts, keyword alerts, support routing, warehouse ingest, or queue fanout. It fits workflows that need them within seconds. Create an account monitor or keyword monitor, then register the webhook URL. Test delivery, then process signed events asynchronously.

```bash theme={null}
curl -X POST https://xquik.com/api/v1/monitors \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "username",
    "eventTypes": ["tweet.new", "tweet.reply", "tweet.quote"]
  }' | jq
```

For query alerts, call `POST /monitors/keywords` with `query` and `eventTypes` instead of `username`. Account and keyword monitors both check every 1 second while active. Both can deliver events to the same signed webhooks.

Each POST has 1 event. Multiple matches produce multiple POSTs.

Payloads include durable IDs. Store `deliveryId` for delivery-level idempotency. When you must process each monitor event once across retries or endpoints, store `streamEventId`. Store the one-time `secret` returned by `POST /webhooks`. Verify `X-Xquik-Signature` against the raw body before accepting the event. Return `2xx` before slow CRM, Slack, warehouse, or queue work starts.

#### Receiver storage handoff

For Zapier, Make, and Pipedream receivers, map production payload IDs before enqueueing slow work.

```json theme={null}
{
  "record_type": "workflow_webhook_receiver_parity",
  "delivery_id": "502",
  "stream_event_id": "9002",
  "event_type": "tweet.new",
  "occurred_at": "2026-02-24T14:22:00.000Z",
  "duplicate_delivery_status": "2xx",
  "duplicate_event_status": "2xx",
  "event_join": "GET /api/v1/events/9002",
  "shared_storage_excludes": [
    "endpoint_signing_values",
    "raw_request_body",
    "raw_signature",
    "full_headers"
  ]
}
```

Return `2xx` for duplicate `deliveryId` or `streamEventId` after signature verification. Store raw request bytes only long enough to verify `X-Xquik-Signature`. Do not put endpoint signing values or raw body in shared workflow rows. Do not put raw signature or full headers there either.

### 5. Post media tweets or replies

Use this when an agent or app needs to post a tweet or reply. It applies to public image URLs or exactly 1 public MP4 video URL. The video can be up to 100 MB. Pass those URLs directly in the `media` array on `POST /x/tweets`. Do not call `POST /x/media` first for tweet posts when the media is already public. `POST /x/tweets` rejects `media_ids` with `400 unsupported_field`.

```bash theme={null}
curl -X POST https://xquik.com/api/v1/x/tweets \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "brand_account",
    "text": "Product screenshot from today",
    "reply_to_tweet_id": "1893456789012345678",
    "media": ["https://example.com/product-screenshot.png"]
  }' | jq
```

The response is a durable action record. Store `id`, `status`, `billing`, `result`, `request.hash`, and `statusUrl`. Poll while `terminal` is false. Retry only when `safeToRetry` is true, using a new `Idempotency-Key`. Store media URLs with the action record. Text-only tweet or reply writes cost 30 credits. Attached media adds 2 credits per started MB across all files. Use `POST /x/media` only when you need a one-item `media_ids` array for [`POST /x/dm/{userId}`](https://docs.xquik.com/api-reference/x-write/send-dm).

### 6. Send direct messages with returned IDs

Use this when a workflow needs direct messages with audit trails. It fits support, sales, or agent workflows. Look up the recipient user ID. Pass the same connected sender as `account` for history reads and DM writes. Then store returned message IDs.

```bash theme={null}
curl -G https://xquik.com/api/v1/x/dm/987654321/history \
  --data-urlencode "account=brand_account" \
  -H "x-api-key: xq_YOUR_KEY_HERE" | jq
```

History reads require `account`. That connected account must participate in the conversation. Missing `account` returns `400 account_required`. A non-participant account returns `403 dm_not_permitted`.

```bash theme={null}
curl -X POST https://xquik.com/api/v1/x/dm/987654321 \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "brand_account",
    "text": "Thanks for reaching out. Here is the next step."
  }' | jq
```

`GET /x/dm/{userId}/history` returns `messages`, `has_next_page`, and `next_cursor`. Pass `next_cursor` back as `cursor` for older messages. `POST /x/dm/{userId}` returns `messageId` and `success`. Store both on the support ticket, CRM note, or agent state.

## Focused workflow pages

Choose a path, then open its examples, SDK guidance, and error recovery.

> [card] [Tweet search exports](https://docs.xquik.com/guides/tweet-scraper-csv-export.md)
>
> Build CSV, JSON, or XLSX exports from `tweet_search_extractor`, or use direct `GET /x/tweets/search` pagination.

> [card] [Tweet replies exports](https://docs.xquik.com/guides/tweet-replies-export.md)
>
> Turn a post conversation into `reply_extractor` jobs or direct replies pagination. You can also turn it into JSONL rows or moderation queues.

> [card] [Follower CRM export](https://docs.xquik.com/guides/follower-export-crm.md)
>
> Estimate `follower_explorer`, export CSV, JSON, or XLSX files, and map stable `x_user_id` fields.

> [card] [Campaign verification](https://docs.xquik.com/guides/campaign-verification-workflow.md)
>
> Check social actions and draw exports.

> [card] [Monitor webhooks](https://docs.xquik.com/guides/twitter-webhook-testing.md)
>
> Test signed deliveries and verify `X-Xquik-Signature`. Store `deliveryId` and `streamEventId`. Return `2xx` before slow work.

> [card] [Media tweets and DMs](https://docs.xquik.com/guides/media-upload-workflow.md)
>
> Use public URLs in tweet `media`. Upload only when DMs need one `media_ids` item.

> [card] [Direct messages](https://docs.xquik.com/guides/direct-message-workflow.md)
>
> Read DM history with `account`, send DMs, and store returned `messageId` values.

> [card] [MCP agents](https://docs.xquik.com/mcp/overview.md)
>
> Connect agents, call `xquik.request(...)`, and hand normalized pagination back to memory.

> [card] [Tweet composition](https://docs.xquik.com/api-reference/compose/create.md)
>
> Use `POST /compose` for compose, refine, and score loops without usage credits.

## Public draw results

Completed giveaway draws have a public results page at `https://xquik.com/results/{drawId}`. The page needs no authentication. Share the URL so participants can check the winners.

> [card] [Create a monitor](https://docs.xquik.com/api-reference/monitors/create.md)
>
> Start 1-second checks for one account.

> [card] [Register a webhook](https://docs.xquik.com/api-reference/webhooks/create.md)
>
> Receive detected events through signed webhooks.

> [card] [MCP server](https://docs.xquik.com/mcp/overview.md)
>
> Connection details and setup instructions.

> [card] [Signature verification](https://docs.xquik.com/webhooks/verification.md)
>
> Verify webhook payloads with HMAC-SHA256.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.