Twitter Unofficial API

Available Languages: 🇺🇸 🇹🇷

Twitter Unofficial API is a library that can be easily integrated into websites and applications.

The Twitter API allows users to log in quickly and securely with their Twitter account. In just a few simple steps, users can access their accounts.

The Twitter Login API gives the user the opportunity to log in to Twitter. If extra information is requested, the user can also provide it.

For example, they ask users to pass extra security steps called “checkpoints”. The Unofficial Twitter API takes these situations into account and allows users to complete the login process without any problems.

Finally, once a user has successfully logged in, the library retrieves “cookie” data from the logged-in user’s account. This information can be used for the user to take action.

Introduction to Twitter Library

A versatile runtime environment, Node.js gives developers the ability to build scalable and efficient web applications.

By leveraging JavaScript, developers can harness the power of asynchronous programming, making it an ideal choice for managing network requests and API integrations.

Our Twitter API aims to encapsulate the intricacies of interacting with Twitter by providing a simplified interface for developers to seamlessly perform various actions.

Getting Started

To kickstart the development process, ensure you have Node.js installed on your system. You can download it from the official Node.js website or use a package manager like npm (Node Package Manager) to install it.


$ npm i twitter-unofficial-api
$ bun i twitter-unofficial-api
$ pnpm i twitter-unofficial-api

How to import

const { Twitter } = require('twitter-unofficial-api');
const { HttpsProxyAgent } = require('https-proxy-agent');
const sleep = (t) => new Promise((s) => setTimeout(s, t));

Login with Twitter

async function login() {

    const twitterFlow = new Twitter();

    twitterFlow.tProxy = new HttpsProxyAgent('http://proxy_username:proxy_password@proxy_ip:proxy_port');

    await sleep(10000);

    await twitterFlow.login_flow();

    let loginSuccess = false;

    const username = 'your twitter username';
    const password = 'your twitter password';
    const mail = 'your twitter mail';

    while (loginSuccess == false) {
        console.log(await twitterFlow.get_subtask_ids());

        if (await twitterFlow.get_subtask_ids().includes('LoginJsInstrumentationSubtask')) {
            await twitterFlow.LoginJsInstrumentationSubtask();
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterUserIdentifierSSO')) {
            await twitterFlow.LoginEnterUserIdentifierSSO(username);
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterUserIdentifier')) {
            await twitterFlow.LoginEnterUserIdentifier(username);
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterPassword')) {
            await twitterFlow.LoginEnterPassword(password).catch(async (error) => {
                if (error.response?.data?.errors?.[0]?.message == 'Wrong password!') {
                    console.log('Wrong password');
                    loginSuccess = true;
        else if (await twitterFlow.get_subtask_ids().includes('AccountDuplicationCheck')) {
            await twitterFlow.AccountDuplicationCheck().then((response) => {
                if (response?.content?.subtasks[0].enter_text?.hint_text == 'Verification Code') {
                    console.log('Verification code required!');
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterAlternateIdentifierSubtask')) {
                await twitterFlow.LoginEnterAlternateIdentifierSubtask(mail).catch(err => {
                    console.log('Alternate login email is incorrect: ' + username, ':', password);
                    loginSuccess = true;


        else if (await twitterFlow.get_subtask_ids().includes('LoginAcid')) {

            await twitterFlow.LoginAcid('YOUR CHECKPOINT CODE HERE').catch(err => {
                console.log('ACCOUNT CHECKPOINT MAIL CONFIRMATION: ' +[0].message + ' -> ' + username, ':', password);
                loginSuccess = true;

        else if (await twitterFlow.get_subtask_ids().includes('SuccessExit')) {
            await twitterFlow.successExit().then((result) => {
                loginSuccess = true;
                console.log('CT0: ' + twitterFlow.ct0);
                console.log('COOKIE:' + twitterFlow.cookie);
            }).catch((err) => {
                loginSuccess = true;
} login()


Twitter, Twitter API, Twitter Unofficial API, Unofficial Twitter API, Twitter Login API, X API, X Unofficial API, Unofficial X API, X Login API, NodeJS Developer, Back-end Developer, Node.JS Developer, Backend Developer

Github Patreon BuyMeaCoffee
Copyright: [email protected]  Other Issues: [email protected]

Social Media

Linkedin Twitter Bluesky Instagram Youtube Telegram Github Npmjs


Can Yesilyurt cy4udev