Skip to main content
The TypeScript SDK covers Xquik REST API workflows in Node.js, Bun, or server-side TypeScript. Use it when you want typed request parameters, response models, retries, and autocomplete. Use this page when a TypeScript service must search tweets. Use it too for tweet exports to JSON Lines, CSV, or XLSX. The service can export followers and profiles, post media tweets, or send DMs. It can also monitor tweets or send records downstream.

Install

Authenticate

Basic example

Search tweets and write durable JSON Lines handoff rows.

TypeScript SDK workflows

Tweet replies workflow to CSV, JSON, or XLSX

Use this workflow when a TypeScript worker needs every reply under one tweet. The replies come as a saved extraction or a JSON Lines handoff. They can also come as a CSV, JSON, or XLSX export. It uses client.extractions.estimateCost, run, retrieve, and exportResults. Reuse the polling, JSON Lines pagination, and export structure from the follower workflow. Only the tool type, target field, and filenames change.
reply_extractor requires targetTweetId. client.extractions.retrieve returns results, hasMore, and nextCursor. The shared pagination loop passes nextCursor back as cursor. 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. client.extractions.exportResults supports csv, json, and xlsx for file handoff. The cost is 1 credit per reply extracted or returned.

Error handling

The SDK throws typed errors for API failures.

400 Bad request

Throws BadRequestError.

401 Unauthenticated

Throws AuthenticationError.

403 Permission denied

Throws PermissionDeniedError.

404 Not found

Throws NotFoundError.

422 Unprocessable entity

Throws UnprocessableEntityError.

429 Rate limited

Throws RateLimitError.

5xx server error

Throws InternalServerError.
The client retries connection errors, 408, 409, 429, and 5xx responses by default. Set maxRetries to tune retry behavior.

Cost, limits & retries

Tweet search costs 1 credit per tweet returned. If credits cannot cover a bounded limit request, the API can return fewer tweets. If credits cover no results, it returns 402 insufficient_credits. Xquik rate-limits read calls. 429 responses include Retry-After. The client retries connection errors, 408, 409, 429, and 5xx responses by default. Handle RateLimitError with backoff. Fix 400, 401, 403, 404, or 422 responses before retrying.

Pagination

Search and list endpoints return page objects. When you need another page, check has_next_page. Then pass the generated cursor fields documented on each endpoint.

Webhooks & references