Rettiwt-API: what the Twitter (X) npm library does in 2026, and how to move its calls to a REST API

By TwitterAPI.io Team•15 min read
Diagram: Rettiwt-API calls (user.details, user.timeline, tweet.search, tweet.details) on the left, running as a guest or with an API_KEY made from your cookies, mapped by arrows to REST endpoints /twitter/user/info, /twitter/user/last_tweets, /twitter/tweet/advanced_search and /twitter/tweets on the right. Footer: 91 REST requests, 100% succeeded, 1,299 posts and 20 profiles from 20 organization accounts, measured in 2026.
Rettiwt-API's four core reads and their REST equivalents. Diagram; footer numbers come from the study below.
TL;DR
  • What it is: rettiwt-api is a TypeScript library plus a rettiwt CLI that talks to X's web endpoints. Version 7.2.0 is the latest on npm; the GitHub repo is active and not archived.
  • Two auth modes: guest (no login: tweet details, user details by username, user timeline, space details) and user (API_KEY = your X cookies, base64-encoded) for everything else, writes included.
  • The trade-off: no API bill, but calls break when X changes its web client (issue #908, fixed in 7.1.4) or for reasons tied to one account (issue #919: every tweet.search returned 404), and the account behind the key can be limited or suspended (open issue #884).
  • Measured mapping: user.details, user.timeline, tweet.search and tweet.details map to /twitter/user/info, /twitter/user/last_tweets, /twitter/tweet/advanced_search and /twitter/tweets. 91 requests, 100% succeeded, 0 retries.
  • Field parity: 16 of 16 core Rettiwt Tweet fields and 12 of 14 User fields were filled on every record; the two gaps (location, pinned posts) are blank because those accounts never set them.
  • Cost: the whole study cost about $0.20 at $0.15 per 1,000 tweets and $0.18 per 1,000 profiles, versus $6.72 at the official X API's $0.005 per post read and $0.010 per user read.

This page is about one specific library, Rettiwt-API (the name is Twitter spelled backward), for Node.js and TypeScript developers. It is not the same thing as our twscrape page, which covers a Python scraper that rotates a pool of logged-in accounts, and it is not the twitter-api-v2 npm package, which is a client for the official X API and needs X developer credentials. Rettiwt-API sits in between: a JavaScript package that reads X the way the x.com web app does, either as a logged-out guest or as your own logged-in account.

Below you will find what the library does today (checked on its GitHub repository, npm registry entry and README this session), how its guest and API_KEY modes differ, what has broken recently and why, and a measured migration path: the four Rettiwt calls developers reach for first, run against a REST API on 20 public organization accounts, with field-by-field parity against Rettiwt's own Tweet and User models, latency and cost.

Core Rettiwt tweet fields filled on every one of 1,299 posts via REST

16 of 16

01 — Section

What Rettiwt-API is, verified on its repo and npm entry

Rettiwt-API is maintained on GitHub under github.com/Rishikant181/Rettiwt-API. Its README opens with "A CLI tool and an API for fetching data from Twitter for free!" and its npm description reads "An API for fetching data from TwitterAPI, without any rate limits!". The second claim deserves context, which we give in the risks section: X still applies its own limits to the account or guest session making the requests, and the README itself documents reading x-rate-limit-limit and x-rate-limit-remaining response headers.

Here is the state of the project as we read it from the registry and the GitHub API this session.

FactValueWhere it comes from
Latest npm version7.2.0 (alpha tag 6.3.0-alpha.1)registry.npmjs.org/rettiwt-api
Releases on npm100 versions, first published February 2023npm registry time field
Node.js engines^22.21.0 or ^24.0.0package.json of 7.2.0
LicenseISC in package.json, MIT in the GitHub LICENSE filenpm registry, GitHub API
GitHub activityabout 906 stars, 112 forks, not archived, default branch devapi.github.com/repos/Rishikant181/Rettiwt-API
Weekly downloads1,481 (one recent week)api.npmjs.org/downloads

What we ran ourselves. We installed rettiwt-api 7.2.0 into a throwaway folder under /tmp and ran rettiwt help. It printed the global options (--key, --proxy, --timeout, --retries, --delay) and the command groups call, dm, job, list, space, tweet and user. We did not log in, did not create an API_KEY and did not send any request to X with it. Everything below about how calls behave against X comes from the README, the source code and the issue tracker, quoted as such.

Scope of the library. The README's feature list is broad: tweet details, search and a pseudo-realtime stream; user details, timelines, replies, media, followers, following and likes; lists; spaces; bookmarks and bookmark folders; DMs; X Jobs; X Calls; and writes such as post, schedule, like, retweet, bookmark, follow and profile updates. Many of these only work in user mode.

02 — Section

Guest mode vs user mode: what the API_KEY really is

Guest mode is the default when you call new Rettiwt() with no arguments. Per the README it "grants access to" four things only: tweet details, space details, user details (by username) and the user timeline. No account is involved, so nothing is at stake if a call fails, but search, followers, replies and every write are out of reach.

User mode starts from new Rettiwt({ apiKey: API_KEY }). The README is direct about what that key is: "The API_KEY is actually a base64 encoding of the account's cookies" and it "provides the same level of authorization as any standard Twitter account, nothing more, nothing less." You obtain it with a Firefox helper extension, by copying cookies out of browser developer tools, or through a third-party userscript the README links.

Key lifetime. The README says a key generated from a private-window login "should last 5 years from the date of login, as long as the credentials to the account aren't changed", and that a key taken from a normal browser session dies as soon as that session logs out. In other words the key is a live session token for your account. Anyone who obtains it can act as you, so it belongs in a secret store, never in a repository or a client-side bundle.

What this means in practice. In user mode every read and write is attributed by X to that account. X's terms of service govern what that account may automate, and X can rate-limit, lock or suspend it. The library does not change that; it only makes the calls convenient.

typescript
import { Rettiwt } from 'rettiwt-api';

// guest: no login, limited to tweet details, user details by username, user timeline, space details
const guest = new Rettiwt();
const user = await guest.user.details('vercel');

// user auth: API_KEY is a base64 encoding of your X account's cookies (README)
const rettiwt = new Rettiwt({ apiKey: process.env.API_KEY });
const hits = await rettiwt.tweet.search({ fromUsers: ['nodejs', 'bunjavascript'] });
console.log(user?.followersCount, hits.list.length, hits.next);
03 — Section

What breaks, and why it keeps breaking

Because Rettiwt-API mirrors calls made by X's own web app, it depends on details X can change at any time: internal GraphQL operation IDs, the shape of response JSON, and headers the web client computes per request. When one of those moves, the library throws until the maintainer ships a fix. The issue tracker shows the pattern clearly.

IssueOpenedWhat users sawOutcome
#919November 2026every tweet.search call returned 404 for one user's logged-in keys; a rotated query ID was suspected, then ruled out by the reporterclosed as not planned; the maintainer could not reproduce it and suggested it may be account-specific
#908September 2026"Unable to resolve the X ondemand chunk URL from the homepage runtime."fixed, release 7.1.4 shipped three days later
#884June 2026account suspended within 3 hours to 3 days of posting through the librarystill open
#878May 2026"Failed to initialize ClientTransaction"closed

Retries are opt-in. The README documents a maxRetries option for "when a random error 404 is encountered", with a default of 0, and a delay option between requests that also defaults to 0. The CLI help suggests "a value of 5 combined with a delay of 1000" for retries. If you run Rettiwt in production, set both deliberately and alert on repeated 404s, because a 404 here usually means an X-side change rather than a missing tweet.

Account risk is not a bug the library can fix. Issue #884 is about writes, but the same logic applies to heavy reads in user mode: the session belongs to a real account, and X decides how much automated traffic that account may send. Keep a normal human pace, expect re-logins, and never point a key for an account you cannot afford to lose at a high-volume job.

Version churn. There have been 100 published versions since February 2023 and three releases between late September and November 2026 alone (7.1.4, 7.1.5, 7.2.0). Pin an exact version, read the changelog before upgrading, and keep an integration test that hits one call per method you rely on.

04 — Section

Mapping Rettiwt's four core calls to REST endpoints, and migrating step by step

If what you need from Rettiwt is reads (profiles, timelines, search, tweets by ID), each call has a direct REST counterpart that needs an API key in a header and no X account. These are the four we measured, with the server round trip we saw for each.

Rettiwt callREST endpointRequestsMedian / p90 round trip
rettiwt.user.details(name)/twitter/user/info?userName=221.38 s / 2.38 s
rettiwt.user.timeline(id)/twitter/user/last_tweets?userName=633.43 s / 4.84 s
rettiwt.tweet.search({ fromUsers })/twitter/tweet/advanced_search?query=from:a OR from:b52.5 s / 3.11 s
rettiwt.tweet.details(ids)/twitter/tweets?tweet_ids=111.52 s (one request, 19 of 19 IDs returned)

Paging works the same way in spirit. Rettiwt returns a CursoredData object with list and next; the REST endpoints return has_next_page and next_cursor, and you pass the cursor back as cursor. Timelines and searches come back 20 posts per page; in our run 59 of 60 timeline pages were full pages of 20.

Search syntax. Rettiwt builds a query from a TweetFilter object (fromUsers, includeWords, hashtags, startDate and so on). The REST search takes the same X search operators as a string: from:, to:, quoted phrases, since_time: and until_time: with Unix timestamps, lang:, filter:media. Translating a filter object into one query string is usually a ten-line function.

Writes. Rettiwt's post, like, follow and DM methods also have REST counterparts, and they also act as a real account. One /twitter/user_login_v2 login ($0.10, with a proxy you supply) returns login_cookies; each post, delete, like, retweet, follow, unfollow, mute or DM through endpoints such as /twitter/create_tweet_v2 or /twitter/follow_user_v2 then costs 60 credits ($0.0006) per successful call, and calls that return status: error are not charged. The call acts as that account, so X can rate-limit, lock or suspend it; keep a normal human pace, and expect the session to need a re-login from time to time.

1. Inventory the calls. Search your code for rettiwt. and list each method you use. Reads (user.details, user.timeline, user.followers, tweet.search, tweet.details, tweet.replies) map to REST reads; writes need the login flow described above; account-only features (bookmarks of the logged-in user, DMs, notifications) stay account-bound whichever tool you use.

2. Put an adapter in front. Write one module that exposes the Rettiwt-shaped methods your app already calls and returns objects with the Rettiwt field names. Inside it, call the REST endpoints and rename fields once (text to fullText, author to tweetBy). Your business code does not change.

3. Replace TweetFilter with query strings. Convert fromUsers to from:a OR from:b, includeWords to plain terms, hashtags to #tag, and dates to since_time: / until_time: Unix timestamps. Pass queryType=Latest for time-ordered results.

4. Swap cursors. Replace data.next with next_cursor and stop on has_next_page === false.

5. Delete the secret you no longer need. Once reads no longer use the API_KEY, revoke it by logging that session out of X, and keep only the REST key in your secret store.

typescript
const BASE = 'https://api.twitterapi.io';
const headers = { 'X-API-Key': process.env.TWITTERAPI_IO_KEY! };

async function get(url: string, params: Record<string, string>) {
  const res = await fetch(`${url}?${new URLSearchParams(params)}`, { headers });
  const body = await res.json();
  if (!res.ok || body.status === 'error') throw new Error(body.msg ?? body.detail ?? res.statusText);
  return body;
}

// rettiwt.user.details('vercel')
const info = await get(`${BASE}/twitter/user/info`, { userName: 'vercel' });
console.log(info.data.followers, info.data.statusesCount);

// rettiwt.tweet.search({ fromUsers: [...] }) with cursor paging
let cursor = '';
for (let page = 0; page < 3; page++) {
  const body = await get(`${BASE}/twitter/tweet/advanced_search`, {
    query: 'from:nodejs OR from:bunjavascript', queryType: 'Latest', cursor,
  });
  for (const t of body.tweets) console.log(t.createdAt, t.author.userName, t.likeCount);
  if (!body.has_next_page) break;
  cursor = body.next_cursor;
}
05 — Section

Field parity: does the REST response fill Rettiwt's Tweet and User models?

A migration is only painless if the fields your code reads still exist. We took the field list straight from Rettiwt's source (src/models/data/Tweet.ts and User.ts), mapped each one to its REST counterpart, and counted how often it was present and non-null.

Tweets. All 16 core fields were filled on 100% of 1,299 posts: id, fullText (REST text), createdAt, lang, conversationId, url, the four tweetBy fields we checked (REST author.id, author.userName, author.name, author.followers) and all six counters (likes, retweets, replies, quotes, views, bookmarks). The remaining fields only exist when the post has the thing, so their rate describes the posts, not the API.

Rettiwt fieldREST fieldShare of posts carrying it
entities.hashtagsentities.hashtags4.2%
entities.mentionedUsersentities.user_mentions36.6%
entities.urlsentities.urls50.9%
mediaextendedEntities.media40.0%
quotedquoted_tweet4.0%
retweetedTweetretweeted_tweet17.7%
replyToinReplyToId3.7%

Users. 12 of 14 mapped User fields were present on all 20 profiles. location was set on 50% and pinnedTweets (REST pinnedTweetIds) on 55%, which matches accounts that simply have no location or pinned post. Two Rettiwt fields, isFollowed and isFollowing, describe the relationship to the logged-in viewer and have no meaning without an account, so they have no counterpart in a logged-out read.

Naming differences to rename once. fullText becomes text, tweetBy becomes author, fullName becomes name, followersCount becomes followers, followingsCount becomes following, a user's likeCount becomes favouritesCount, replyTo becomes inReplyToId, quoted becomes quoted_tweet, retweetedTweet becomes retweeted_tweet, and media lives under extendedEntities.media. Dates arrive as strings like Thu Oct 16 12:34:56 +0000 2026.

Two bar charts. Left: share of 1,299 posts carrying Rettiwt's conditional Tweet fields via the REST response: entities.urls 50.9%, media 40.0%, entities.mentionedUsers 36.6%, retweetedTweet 17.7%, entities.hashtags 4.2%, quoted 4.0%, replyTo 3.7%. Right: 12 of 14 User fields present on all 20 profiles; location 50% and pinnedTweets 55%.
All 16 core Tweet fields were filled on every post; the bars show fields that depend on the post or profile itself. Study collected in 2026.
06 — Section

Latency, ordering and freshness in the study

Round trip. Across all 91 requests the median server round trip was 3.0 s and the p90 4.62 s, measured from our side with the time spent waiting on our own shared rate-limit lock excluded. Profile lookups were the quickest (median 1.38 s), timeline pages the slowest of the frequent calls (median 3.43 s). The single by-ID request for 19 tweets took 11.52 s; one request is not a distribution, so treat it as an anecdote.

Ordering. 57 of 59 full timeline pages came back strictly newest-first. The two exceptions are the reason to sort by createdAt yourself before you compute anything time-based, which the Python example below does.

Freshness. At collection time the median account's newest post was 12.9 hours old, and 11 of 20 accounts had posted in the previous 24 hours. Posting rates ranged from 0.03 to 2.22 posts a day (median 0.83), so a polling job that checks quiet accounts every minute mostly pays for empty answers; poll quiet accounts less often.

Merged searches are lopsided. Our from: search over five accounts returned 100 posts, and 87 of them came from one account (@bunjavascript), 11 from @nodejs and 2 from @typescript. A fromUsers search sorted by time is dominated by the busiest account. If you need balanced coverage, page each account's timeline separately; that is a property of time-ordered search, not of either tool.

Left: median and p90 server round trip per REST call: user/info 1.38 s and 2.38 s (22 requests), advanced_search 2.5 s and 3.11 s (5 requests), user/last_tweets 3.43 s and 4.84 s (63 requests), tweets by ID 11.52 s (1 request). Right: total study cost for 1,300 posts and 22 profiles: $0.20 on twitterapi.io versus $6.72 at official X API pay-per-usage rates.
Round trip per call and the cost of the whole study at both rate cards. Study collected in 2026.
07 — Section

What it costs: Rettiwt (free, your account) vs REST vs the official X API

Rettiwt-API has no price tag. Its costs are elsewhere: an X account per key, the engineering time to follow breaking changes, and the chance that the account is limited or suspended. A REST API moves those costs into a per-record bill. The official X API does the same at a higher rate card.

Itemtwitterapi.ioOfficial X API (pay-per-usage)
1,000 tweets read$0.15$5.00 ($0.005 per post read)
1,000 profiles read$0.18$10.00 ($0.010 per user read)
This study (1,300 posts + 22 profiles)$0.20$6.72
Billing modelpay only for the data returnedpay-per-usage capped at 3 million post reads a month, Enterprise above

Per 1,000 tweets that is $5 against $0.15, roughly 33x, and on this study's mix about 33.7x. The X figures come from docs.x.com/x-api/getting-started/pricing, read this session; X also offers $20 in credits after a first eligible card purchase and matches a first auto-recharge up to $50.

The minimum charge and polling. On twitterapi.io a tweet request costs 15 credits per tweet returned with a minimum of 15 credits per request ($1 = 100,000 credits), so a search that finds nothing costs $0.00015 and a full 20-tweet page costs $0.003. A job that checks one query every 60 seconds for a month makes 43,200 checks, which is $6.48 if every check comes back empty; every 5 minutes it is $1.30.

Rate limits. Accounts get 0.2 requests per second before the first payment and 20 per second once paid, 50 on the Scale plan and 500 on Business, with higher limits available on request. New accounts that pass the automatic bot check get free starter credits (no card, one per person or network, expiring after 31 days); the amount is on the pricing page. Purchased credits never expire.

08 — Section

When Rettiwt-API is still the right tool

Personal automation on your own account. If you want your own bookmarks, your own notifications stream or your own DM inbox in a script, user mode is built for exactly that, and the README's feature list covers those reads directly. The account at risk is yours and the volume is small.

Quick guest lookups. For an occasional profile, timeline or tweet lookup in a side project, guest mode needs no key at all. Expect to handle the occasional failure when X changes something.

Features with no REST counterpart you need. X Calls, X Jobs, scheduled posts and the logged-in user's analytics are in Rettiwt's feature list. If one of those is the point of your project, a general REST read API will not replace it.

When to move. Move the reads when the job runs unattended, when you need search or followers without tying them to an account, when several people or services share the data, or when a 404 at 3 a.m. would page someone. Keep Rettiwt for the account-bound features if you still need them; the two can coexist in one codebase.

09 — Section

How we collected this

Question. If a Rettiwt-API job is moved to a REST API, what does each mapped call return today: success rate, items per page, round trip, field parity with Rettiwt's own models, ordering, freshness and cost?

Accounts and query. 20 public organization accounts from the JavaScript and developer-tools world (for example @nodejs, @typescript, @vercel, @github, @Docker, @supabase, @Cloudflare, @OpenAI). Two planned handles turned out to belong to unrelated accounts and were replaced with @deno_land and @vite_js. The search was from:nodejs OR from:typescript OR from:denoland OR from:bunjavascript OR from:vitejs with queryType=Latest.

Sample. 20 profiles via /twitter/user/info, 3 timeline pages per account via /twitter/user/last_tweets (1,180 posts), 5 search pages (100 posts) and one /twitter/tweets call for 19 IDs: 91 requests and 1,299 posts in total, collected in 2026. The window per account runs from its oldest to its newest sampled post.

Method. A rate-limited read-only client shared with other jobs; round trip is measured per request with the wait for the shared lock excluded. Rettiwt field names come from its source files Tweet.ts and User.ts. Rettiwt-API itself was not run against X.

What the sample cannot show. It says nothing about Rettiwt's own success rate or speed against X, which depends on your account, your network and X's changes that week. Organization accounts post differently from individuals, and latency from another region will differ.

Privacy. Aggregates only, organization accounts only, no analysis of reposted or quoted authors. Raw responses stayed on a temporary disk; the committed sample has no IDs, URLs, text or handles.

python
import time
import requests

API_KEY = "YOUR_TWITTERAPI_IO_KEY"
BASE = "https://api.twitterapi.io"
HEADERS = {"X-API-Key": API_KEY}


def get(url, params):
    r = requests.get(url, headers=HEADERS, params=params, timeout=30)
    r.raise_for_status()
    body = r.json()
    if body.get("status") == "error":
        raise RuntimeError(body.get("msg"))
    return body


# 1) rettiwt.user.details("vercel")  ->  /twitter/user/info
user = get(f"{BASE}/twitter/user/info", {"userName": "vercel"})["data"]
print(user["userName"], user["followers"], user["statusesCount"], user["createdAt"])

# 2) rettiwt.user.timeline(id)  ->  /twitter/user/last_tweets (20 per page, newest first)
timeline, cursor = [], ""
for _ in range(3):
    body = get(f"{BASE}/twitter/user/last_tweets", {"userName": "vercel", "cursor": cursor})
    page = body.get("data", {}).get("tweets", [])
    timeline.extend(page)
    if not body.get("has_next_page"):
        break
    cursor = body.get("next_cursor", "")
    time.sleep(1)  # fixed pacing
timeline.sort(key=lambda t: time.mktime(time.strptime(t["createdAt"], "%a %b %d %H:%M:%S +0000 %Y")), reverse=True)
print(len(timeline), "timeline posts")

# 3) rettiwt.tweet.search({ fromUsers: ["nodejs", "bunjavascript"] })  ->  /twitter/tweet/advanced_search
found, cursor = [], ""
for _ in range(2):
    body = get(f"{BASE}/twitter/tweet/advanced_search",
               {"query": "from:nodejs OR from:bunjavascript", "queryType": "Latest", "cursor": cursor})
    found.extend(body.get("tweets", []))
    if not body.get("has_next_page"):
        break
    cursor = body.get("next_cursor", "")
    time.sleep(1)
print(len(found), "search hits")

# 4) rettiwt.tweet.details([...ids])  ->  /twitter/tweets
ids = ",".join(t["id"] for t in timeline[:5])
for t in get(f"{BASE}/twitter/tweets", {"tweet_ids": ids}).get("tweets", []):
    # Rettiwt field  ->  REST field
    # fullText -> text, tweetBy.userName -> author.userName, replyTo -> inReplyToId
    print(t["id"], t["author"]["userName"], t["likeCount"], t["viewCount"], t["text"][:60])

Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.

10 — Questions

Questions readers ask

What is Rettiwt-API?

An open-source TypeScript library and CLI, published on npm as rettiwt-api, that reads and writes X data by calling the endpoints the x.com web app uses instead of the official X API. Version 7.2.0 is the latest on npm, and it requires Node.js 22 or 24.

Do I need an X account to use Rettiwt-API?

Not for guest mode, which per the README covers tweet details, space details, user details by username and user timelines. Everything else, including search, followers and all writes, needs user mode with an API_KEY built from a logged-in account's cookies.

What is the Rettiwt API_KEY and is it safe to share?

The README describes it as a base64 encoding of your X account's cookies, with the same authorization as the account itself, lasting up to 5 years if created from a private-window login. Treat it like a password: never commit it, never ship it to a browser, and revoke it by logging that session out if it leaks.

Why does Rettiwt-API return 404 errors?

Often because X changed something in its web client, which breaks the matching method until a new release ships (issue #908 was fixed that way in 7.1.4). Sometimes it is tied to the account: in issue #919, November 2026, every tweet.search call returned 404 for one user, and the maintainer could not reproduce it. The library also has a maxRetries option for intermittent 404s, off by default.

Can my X account get suspended using Rettiwt-API?

Yes, that is possible in user mode, because every call is made as your account and X's terms govern it. Open issue #884 reports suspensions within days of posting through the library. Use an account you can afford to lose and keep a normal human pace.

What is a good Rettiwt-API alternative for reading tweets without an account?

A REST API that takes an API key instead of cookies. On twitterapi.io the four core Rettiwt reads map to /twitter/user/info, /twitter/user/last_tweets, /twitter/tweet/advanced_search and /twitter/tweets; in our 91-request test all succeeded and every core Rettiwt tweet field was filled, at $0.15 per 1,000 tweets.

Is Rettiwt-API the same as the twitter-api-v2 npm package?

No. twitter-api-v2 is a client for the official X API and needs X developer credentials and pay-per-usage billing. Rettiwt-API does not use the official API at all; it uses the web app's endpoints with a guest session or your cookies.

Does Rettiwt-API have rate limits?

Its npm description says "without any rate limits", but X still limits the guest or account session making the calls, and the README itself shows how to read x-rate-limit-limit and x-rate-limit-remaining headers. Its delay option between requests defaults to 0.

11 — Further reading

Continue

Sources & further reading
More from this series

Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.

Build it

Stop reading. Start building.

Starter credits cover real testing on real data. Google sign-in, no card, no application queue.

Get an API key

Already building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.