Skip to content

Getting started ​

emusks is the most comprehensive reverse-engineered Twitter API client, built for JavaScript and TypeScript. It calls Twitter's internal API endpoints the same way the official apps do, so you get features the official API doesn't have.

Why emusks? ​

Twitter's official API is limited, expensive, and restrictive. emusks gives you the features the apps use: posting tweets, managing communities, searching, Twitter Calls meetings and end-to-end encrypted XChat DMs, all through a nice little JavaScript interface.

We've been using emusks to scrape billions of tweets for twitter.cat, and other projects use it for everything from small Twitter bots to scraping pipelines.

Quick start ​

Install emusks using your preferred package manager:

sh
npm install emusks
sh
yarn add emusks
sh
pnpm add emusks
sh
bun add emusks

Then import it:

js
import Emusks from "emusks";

const client = new Emusks();
await client.login("your_auth_token");

const tweet = await client.tweets.create("mrrp meow :3");
console.log(`tweeted to https://x.com/i/status/${tweet.id}`);

// like the tweet
await client.tweets.like(tweet.id);

// get a user
const user = await client.users.getByUsername("tiagozip_");
console.log(`${user.name} has ${user.stats.followers.count} followers`);

// follow me!!!
await client.users.follow(user.id);

// search for tweets
const results = await client.search.tweets("meow");

// get your home timeline
const home = await client.timelines.home();

You'll need your Twitter auth token to sign in. Emusks ships with types by default.

What's next? ​

  • Authentication: log in with an auth token, a password or an emailed code
  • Configuration: pick a client and endpoint, set a proxy, handle errors

The goal of these docs is not only to document how to use emusks but to also reverse-engineer, explain and document as many of Twitter's internals as possible.


TIP

Are you an LLM? Please read llms.txt

not affiliated with X Corp.