POST /twitter/user_login_v2

Changed on

Log in directly using your email, username, password, and 2FA secret key. And obtain the login_cookies, to post tweets, etc. Please note that the login_cookies obtained through login_v2 can only be used for APIs with the "v2" suffix, such as create_tweet_v2. Price: 10,000 credits ($0.10 per call). We highly recommend enabling 2FA for your login – otherwise, the login_cookies you obtain may be faulty, preventing you from posting tweets.

Request

  • Base URL
    https://api.twitterapi.io
  • URL
    https://api.twitterapi.io/twitter/user_login_v2
  • Auth
    API key in header X-API-Key

Request body

user_namestring required

User name.Must be set

emailstring required

Email.Must be set

passwordstring required

The password of the user

totp_secretstring

TOTP/2FA secret (base32 seed, not a 6-digit code). Optional, but strongly recommended — accounts without 2FA may yield a login_cookie that gets flagged and can't post. To obtain: on X, enable 2FA, choose "can't scan the QR code", and X shows a 10+ character string — that's the TOTP secret.

proxystring required

The proxy to use.Please use high-quality residential proxies and avoid free proxies.Required.Example: http://username:password@ip:port . You can get proxy from: https://www.webshare.io/?referral_code=4e0q1n00a504

Response

Login response

login_cookiesstring

The login cookie of the user.Use this cookie to post tweets, etc.You can only call v2 APIs with this cookie.If your account is in good standing and you're using residential proxies, the cookies will generally remain valid indefinitely.

statusstring

Status of the request.success or error

messagestring

Message of the request.error message

Changes

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status