ScrapeTwitter
Users

User Login

Get fresh auth tokens for a Twitter account

POST /twitter/user_login

Request Body

FieldTypeRequiredDescription
usernamestringYesTwitter username (without @)
passwordstringYesAccount password
emailstringNoEmail address for verification if Twitter requests it
totp_secretstringNoTOTP secret for 2FA-enabled accounts (base32 string)

Notes

  • Uses residential proxies with CycleTLS to bypass Cloudflare bot detection.
  • For 2FA accounts (e.g., from twitterapi.io), provide the totp_secret to auto-generate the 6-digit code.
  • Profile data is fetched automatically after successful login.

Response (200)

{
  "username": "roffeojjti",
  "auth_token": "29a58c695bf7f8c659d47b88d2d8c290b5ef5778",
  "ct0": "5c53b4f6072eb9139e22adb8be1c9bcd",
  "twid": "u=1740174562631856128",
  "profile": {
    "type": "user",
    "id": "1740174562631856128",
    "userName": "roffeojjti",
    "name": "roffeojjti",
    "url": "https://x.com/roffeojjti",
    "isVerified": false,
    "isBlueVerified": false,
    "profilePicture": "https://pbs.twimg.com/profile_images/...",
    "description": "",
    "location": "",
    "followers": 10,
    "following": 25,
    "createdAt": "Mon Dec 27 12:00:00 +0000 2023"
  }
}

Error Responses

400 - Missing fields

{
  "error": "Missing required fields: username, password"
}

500 - Login failed

{
  "error": "Login failed: invalid credentials or account locked"
}

Example

# Basic login (no 2FA)
curl -X POST "https://api.scrapetwitter.com/twitter/user_login" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "myaccount",
    "password": "mypassword",
    "email": "myemail@example.com"
  }'

# Login with 2FA (TOTP)
curl -X POST "https://api.scrapetwitter.com/twitter/user_login" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "roffeojjti",
    "password": "dzh26gh88kk3",
    "email": "cherylbarbour@okrapayam.com",
    "totp_secret": "SXGS5MN2IHUMV34H"
  }'

On this page