Use the Go SDK when you want typed parameters, context-aware requests, generated response models, and Go-native error handling. Use this page when you need a Go service to search tweets, scrape tweets to JSON Lines, CSV, or XLSX, export follower or profile data, post media tweets, upload media, send DMs, monitor tweets, or hand X data to another system through SDK calls.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.
Install
Authenticate
Basic Example
Search tweets and write durable JSON Lines handoff rows:Workflow: Search Tweets to JSON Lines, CSV, or XLSX
This job is for backend workers that need searchable tweet data in a stable handoff format for queues, data lakes, analyst CSV files, or XLSX workbooks. It callsGET /x/tweets/search through client.X.Tweets.Search, requests the newest matching tweets, and writes each returned tweet as one JSON object per line.
XTweetSearchParams request so the Go fields stay aligned with GET /x/tweets/search. The generated params map directly to the REST endpoint:
Q
Go field
Q maps to REST q. Use it for the required X search query with keywords, handles, hashtags, or operators.Limit
Go field
Limit maps to REST limit. Use it for a bounded request from 1 to 200. Omit it for cursor loops.Cursor
Go field
Cursor maps to REST cursor. Pass the opaque cursor from NextCursor to request the next page.SinceTime
Go field
SinceTime maps to REST sinceTime. Use it as the ISO 8601 lower time bound.UntilTime
Go field
UntilTime maps to REST untilTime. Use it as the ISO 8601 upper time bound.QueryType
Go field
QueryType maps to REST queryType. Use Latest for chronological results or Top for engagement-ranked results.Returned Data & Handoff
client.X.Tweets.Search returns PaginatedTweets:
Tweets
JSON field
tweets. Contains tweet records with ID, Text, Author, CreatedAt, LikeCount, ReplyCount, RetweetCount, QuoteCount, BookmarkCount, ViewCount, and IsNoteTweet when available.HasNextPage
Go field
HasNextPage. JSON field has_next_page. Tells your worker whether another page exists.NextCursor
JSON field
next_cursor. Store it with the job checkpoint and pass it back as Cursor.Tweets as JSON Lines to xquik-tweet-search.jsonl for queues and data lakes, transform the projected records into CSV for analysts, or produce XLSX from those rows when account teams need spreadsheets. Pass ID, Text, Author.Username, CreatedAt, and engagement counts into your CRM or enrichment pipeline.
Workflow: Follower Export to CSV, JSON, or XLSX
Use this workflow when a Go worker needs an owned follower list for a CRM import, warehouse load, analyst CSV file, XLSX workbook, or resumable JSON handoff. It callsPOST /extractions/estimate through client.Extractions.EstimateCost, creates the job with client.Extractions.Run, reads saved rows with client.Extractions.Get, and downloads files with client.Extractions.ExportResults.
follower_explorer requires TargetUsername. Persist job.ID, targetUsername, estimate.EstimatedResults, and estimate.Source before polling so a worker restart can resume the same follower export. client.Extractions.Get returns Results, HasMore, and NextCursor; pass NextCursor back as After when you need stored JSON pages before exporting files. Use xquik-followers.jsonl for queue replay or warehouse loads, xquik-followers.json for app ingestion, xquik-followers.csv for CRM import, and xquik-followers.xlsx for analyst handoff. Map exported User ID or row xUserId as the CRM unique key. Cost: 1 credit per follower extracted or returned. Exports are free after the extraction job exists.
Workflow: Tweet Replies to CSV, JSON, or XLSX
Use this workflow when a Go worker, queue consumer, or agent service needs every reply under one tweet as a saved extraction, JSON Lines handoff, or CSV/JSON/XLSX file export. It callsPOST /extractions/estimate through client.Extractions.EstimateCost, creates the job with client.Extractions.Run, reads rows with client.Extractions.Get, and downloads files with client.Extractions.ExportResults.
reply_extractor requires TargetTweetID. client.Extractions.Get returns Results, HasMore, and NextCursor; store those values when you need resumable JSON pagination. Use xquik-replies.jsonl for queue replay or warehouse loads, xquik-replies.json for app ingestion, xquik-replies.csv for CRM import, and xquik-replies.xlsx for analyst handoff. client.Extractions.ExportResults supports CSV, JSON, and XLSX for file handoff. Cost: 1 credit per reply extracted or returned.
Workflow: Post Media Tweets and DM Attachments
Use this workflow when a Go worker, queue consumer, or agent service needs to post a media-backed tweet, reply with media, or send one uploaded media item in a DM. Tweet and reply media posts use public media URLs directly onclient.X.Tweets.New. Send up to 4 image URLs or exactly 1 MP4 video URL up to 100 MB. Do not mix video with other media. Do not upload first when the media URL is already public.
TweetID responses. Use option.WithResponseBodyInto when a write worker must branch on the REST 202 x_write_unconfirmed response, store writeActionId and chargedCredits, and poll Get Write Action Status before sending another write.
ReplyToTweetID:
media.MediaID as the only MediaIDs item:
client.X.Tweets.New returns TweetID for confirmed posts. Raw create responses can also include the pending write fields above when confirmation is still running. client.X.Media.Upload returns media.MediaID for DM attachments, and client.X.Dm.Send returns dm.MessageID for support tickets, CRM records, queue jobs, or agent memory.
Text-only tweet and reply writes cost 10 credits. Tweet media adds 2 credits per started MB across attached files. Uploading media costs 10 credits, and sending the DM costs 10 credits. Do not pass uploaded MediaID values to client.X.Tweets.New; that method uses Media with public media URLs.
Cost, Limits & Retries
Tweet search costs 1 credit per tweet returned. If remaining credits cannot cover the requested page, the API can return fewer tweets thanLimit; if 0 paid results are affordable, it returns 402 insufficient_credits. Read calls are rate-limited, and 429 responses include Retry-After.
Generated Go methods return error for connection failures and non-success responses. Retry connection errors, 408, 409, 429, and 5xx responses with backoff. Do not retry 400, 401, 403, 404, or 422 until the request, authentication, permission, or input issue is fixed.
Error Handling
Generated Go methods returnerror for connection failures and non-success API responses. Check the concrete error type from the SDK when you need status-code specific handling, and use the error handling guide for response semantics.
Common retryable cases are connection errors, 408, 409, 429, and 5xx responses.
Pagination
List and search responses expose generated pagination fields such asHasNextPage. Pass cursor parameters from the previous response when the endpoint supports cursor pagination.