Skip to main content
Use typed .NET Standard 2.0+ calls in services, workers, console tools, or ASP.NET. Search X (Twitter) tweets, export followers, monitor, post media, or send DMs. Or feed queues, CRMs, and reports.

Install

The NuGet package excludes GET /support/attachments/{id}. Use REST for that binary download.

Authenticate

new XTwitterScraperClient() reads X_TWITTER_SCRAPER_API_KEY, X_TWITTER_SCRAPER_BEARER_TOKEN, and X_TWITTER_SCRAPER_BASE_URL.

Basic example

Search tweets and write durable JSON Lines handoff rows.

C# SDK workflows

Tweet replies workflow to CSV, JSON, or XLSX

Use this workflow when a .NET worker needs every reply on a public tweet. It writes them to a durable file for moderation review or customer support triage. The file can also feed an analyst export or a warehouse loader. client.Extractions.EstimateCost and client.Extractions.Run map to the extraction workflow. For tweet replies, use ExtractionEstimateCostParamsToolType.ReplyExtractor and ExtractionRunParamsToolType.ReplyExtractor. reply_extractor requires TargetTweetID. client.Extractions.Retrieve returns Results, HasMore, and NextCursor for pagination. client.Extractions.ExportResults returns an HttpResponse. Read CSV and JSON as strings, and copy XLSX from the response stream. Reuse the follower export loop above. Change only the required target, tool type, and output names.
Keep the same estimate.Allowed credit branch from the follower export workflow before calling Run. Store job.ID on the queue job, ticket, or warehouse batch before polling. With it, another worker can resume with client.Extractions.Retrieve. Keep page.NextCursor as the checkpoint when you stream replies to JSON Lines. Pass it back as Cursor on the next ExtractionRetrieveParams call. Repeat the export with new ExtractionExportResultsParams { Format = Format.Json } and File.WriteAllTextAsync("xquik-replies.json", await jsonResponse.ReadAsString()). For XLSX, use new ExtractionExportResultsParams { Format = Format.Xlsx }, File.Create("xquik-replies.xlsx"), and stream-copy the response body. Use xquik-replies.jsonl for queue replay or warehouse loads and xquik-replies.json for app ingestion. Use xquik-replies.csv for CRM import and xquik-replies.xlsx for analyst handoff. The cost is 1 credit per reply extracted or returned.

Error handling

The C# SDK throws generated exception types for non-success responses and connection failures.

400 Bad request

Throws XTwitterScraperBadRequestException.

401 Unauthorized

Throws XTwitterScraperUnauthorizedException.

403 Forbidden

Throws XTwitterScraperForbiddenException.

404 Not found

Throws XTwitterScraperNotFoundException.

422 Validation error

Throws XTwitterScraperUnprocessableEntityException.

429 Rate limited

Throws XTwitterScraperRateLimitException.

5xx server error

Throws XTwitterScraper5xxException.
Use the error handling guide for response body fields and retry recommendations.

Pagination

Paginated responses expose generated fields such as HasNextPage. Pass cursor parameters from the previous response when an endpoint supports cursor pagination.

Webhooks & references