Skip to content

Latest commit

 

History

123 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

X API & Twitter API Java SDK by Xquik

OpenSSF Best Practices

Maven Central Javadocs

Use this X API & Twitter API SDK to work with X from Java. It works as a Twitter scraper & tweet scraper for search, profiles & followers. Scrape Twitter timelines, lists, communities & trends into typed Java models. Manage media, webhooks, monitors & X automation with sync & async clients. It provides a Twitter API alternative through documented Xquik REST routes.

Xquik is the world's fastest and cheapest X Twitter scraper service with the most complete X data. Xquik charges only for delivered, unique, filter-matching results and never pads rows.

Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.

API reference | Authentication | Javadocs

Trust & usage

Twitter API package downloads Twitter scraper users on Apify Twitter scraper runs on Apify Tweet scraper rating on Apify Xquik Twitter API accounts Twitter Skill installs Xquik verified revenue on TrustMRR Twitter API median response time Xquik GitHub stars OpenSSF Best Practices

  • 51,000+ downloads of Xquik's Twitter API packages on npm, PyPI, RubyGems, NuGet, Packagist & Terraform (source)
  • 7,800+ users of Xquik's Twitter scraper Actors on Apify (source)
  • 5,700,000+ runs of Xquik's Twitter scraper Actors on Apify (source)
  • 4.66 of 5 for the X Tweet Scraper from 16 Apify reviews (source)
  • 3,900+ accounts on xquik.com (source)
  • 1,600+ installs of Xquik's Twitter Skills on skills.sh (source)
  • $38,000+ in revenue verified by TrustMRR (source)
  • 501 ms median REST API read time over the last 7 days (source)
  • 370+ GitHub stars across Xquik's repos (source)
  • This repo meets the OpenSSF Best Practices passing criteria (source)

Checked on 2026-10-15. See each number with its date & source on xquik.com/trust or as JSON.

Java client or REST

The typed Maven Central package calls the documented Xquik REST API. It does not call or emulate the official X API. Use this SDK for Java services with builders and typed models. Use synchronous calls or client.async() for CompletableFuture pipelines. Call REST directly when a Maven dependency does not fit.

Common Twitter & X tasks

Task REST route Java service
Run an advanced Twitter search GET /x/tweets/search client.x().tweets()
Retrieve tweets, threads, replies, or quotes GET /x/tweets/{id}, GET /x/tweets/{id}/thread client.x().tweets()
Read tweet insights, translations, subtitles, or embed HTML GET /x/tweets/{id}/insights, GET /x/tweets/{id}/translation, GET /x/tweets/{id}/subtitles, GET /x/tweets/{id}/embed client.x().tweets()
List the top tweets on X GET /x/tweets/top client.x().tweets()
Search X or Twitter users GET /x/users/search client.x().users()
Scrape an X profile timeline GET /x/users/{id}/tweets client.x().users()
Export X followers GET /x/users/{id}/followers client.x().users()
Export X following accounts GET /x/users/{id}/following client.x().users()
Export follower or following IDs without profiles GET /x/users/{id}/follower-ids, GET /x/users/{id}/following-ids client.x().users()
Read a user's lists, highlights, articles, or live status GET /x/users/{id}/lists, GET /x/users/{id}/highlights, GET /x/users/{id}/articles, GET /x/users/{id}/live client.x().users()
Collect verified followers GET /x/users/{id}/verified-followers client.x().users()
Collect mentions, likes, replies, or media GET /x/users/{id}/mentions, GET /x/users/{id}/likes client.x().users()
Extract an X home timeline GET /x/timeline client.x()
Extract list tweets, members, or followers GET /x/lists/{id}/tweets, GET /x/lists/{id}/members client.x().lists()
Search communities and collect their tweets GET /x/communities/search, GET /x/communities/{id}/tweets client.x().communities()
Read bookmarks and bookmark folders GET /x/bookmarks, GET /x/bookmarks/folders client.x().bookmarks()
Read notifications or direct messages GET /x/notifications, GET /x/dm/{userId}/history client.x(), client.x().dm()
Discover X trends GET /x/trends client.x().getTrends()
Read past trends or the places X offers trends for GET /x/trends/history, GET /x/trends/locations client.x().getTrendsHistory(), client.x().getTrendLocations()
Find popular or suggested communities GET /x/communities/popular, GET /x/communities/suggested client.x().communities()
Export large X datasets POST /extractions client.extractions()
Monitor tweet keywords or accounts POST /monitors/keywords, POST /monitors client.monitors()
Receive signed event deliveries POST /webhooks client.webhooks()
Stream monitor events as they happen GET /events/stream client.events()
Analyze the sentiment, viral score, or brand mentions of posts POST /x/analysis/sentiment, POST /x/analysis/brand client.x().analysis()
Post, like, retweet, or follow POST /x/tweets, POST /x/users/{id}/follow client.x().tweets(), client.x().users()
Send media or update a profile POST /x/media, PATCH /x/profile client.x().media(), client.x().profile()
Manage connected X accounts GET /x/accounts, POST /x/accounts client.x().accounts()
Search X job listings GET /x/jobs/search, GET /x/jobs/{id} client.x().jobs()
Read Spaces, replays, and live broadcasts GET /x/spaces/search, GET /x/spaces/{id}/replay, GET /x/broadcasts/{id} client.x().spaces(), client.x().broadcasts()
Read Community Notes contributors and their notes GET /x/community-notes/contributors/{alias}/notes client.x().communityNotes()

Install

Add the Gradle dependency.

implementation("com.xquik.api:x-twitter-scraper-java:0.10.4")

Or add the Maven dependency.

<dependency>
  <groupId>com.xquik.api</groupId>
  <artifactId>x-twitter-scraper-java</artifactId>
  <version>0.10.4</version>
</dependency>

Verify Maven signatures

Every Maven Central file has a detached OpenPGP signature. Set VERSION, then verify the artifact.

version=VERSION
artifact="x-twitter-scraper-java-$version.jar"
base="https://repo.maven.apache.org/maven2/com/xquik/api/x-twitter-scraper-java/$version"
curl --fail --location --remote-name "$base/$artifact"
curl --fail --location --remote-name "$base/$artifact.asc"
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0xD2037E4157E62A59
gpg --verify "$artifact.asc" "$artifact"

Confirm the fingerprint 6965 E561 C0AC EE32 060A B961 D203 7E41 57E6 2A59.

Authenticate

Create an API key in the Xquik dashboard. Then set it in your shell.

export X_TWITTER_SCRAPER_API_KEY="your-api-key"

OAuth users can set X_TWITTER_SCRAPER_BEARER_TOKEN instead.

Create 1 client and reuse it.

import com.x_twitter_scraper.api.client.XTwitterScraperClient;
import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClient;

XTwitterScraperClient client = XTwitterScraperOkHttpClient.fromEnv();

Pass credentials directly when needed.

XTwitterScraperClient client = XTwitterScraperOkHttpClient.builder()
    .apiKey("your-api-key")
    .build();

The client reads these settings.

Setting System property Environment variable Default
API key xtwitterscraper.apiKey X_TWITTER_SCRAPER_API_KEY None
OAuth token xtwitterscraper.bearerToken X_TWITTER_SCRAPER_BEARER_TOKEN None
Base URL xtwitterscraper.baseUrl X_TWITTER_SCRAPER_BASE_URL https://xquik.com/api/v1

System properties override environment variables.

Search tweets

import com.x_twitter_scraper.api.models.x.tweets.TweetSearchParams;
import com.x_twitter_scraper.api.models.x.tweets.TweetSearchResponse;

TweetSearchParams params = TweetSearchParams.builder()
    .q("from:elonmusk")
    .limit(10L)
    .build();

TweetSearchResponse result = client.x().tweets().search(params);

Close the client when your application stops.

client.close();

Use async calls

Call async() to receive CompletableFuture results.

import java.util.concurrent.CompletableFuture;

CompletableFuture<TweetSearchResponse> result =
    client.async().x().tweets().search(params);

Stream events

client.events().stream() sends your monitor events as they happen. Close each stream when you finish.

import com.x_twitter_scraper.api.core.http.StreamResponse;
import com.x_twitter_scraper.api.models.events.Event;

try (StreamResponse<Event> events = client.events().stream()) {
    events.stream().forEach(event -> System.out.println(event.type()));
}

The async client calls your handler on a background thread.

client.async().events().stream()
    .subscribe(event -> System.out.println(event.type()))
    .onCompleteFuture()
    .join();

A stream lasts up to 30 minutes. Reconnect with the last event ID you got.

import com.x_twitter_scraper.api.models.events.EventStreamParams;

EventStreamParams params = EventStreamParams.builder()
    .lastEventID(lastEvent.id())
    .build();

StreamResponse<Event> events = client.events().stream(params);

The stream first sends every event you missed. The client's request timeout does not end a stream. A stream fails after 1 minute without data. The server sends a keep-alive every 15 seconds.

Configure retries

The client retries eligible failures 2 times by default.

XTwitterScraperClient client = XTwitterScraperOkHttpClient.builder()
    .fromEnv()
    .maxRetries(4)
    .build();

Successful HTTP responses can contain structured API errors. Handle the documented error codes.

Read raw responses

Use withRawResponse() when you need headers or status codes.

import com.x_twitter_scraper.api.core.http.HttpResponseFor;
import com.x_twitter_scraper.api.models.account.AccountRetrieveResponse;

HttpResponseFor<AccountRetrieveResponse> response =
    client.account().withRawResponse().retrieve();

int status = response.statusCode();
AccountRetrieveResponse account = response.parse();

Binary endpoints return HttpResponse. Close each response after reading it.

Support

More Xquik tools

License

Apache License 2.0

Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.

Releases

Packages

Contributors

Languages