Skip to content
cheapxapi
All endpoints

Log in to an X account

POST/twitter/user_login_v2

Logs in to an X account and returns login_cookies, which every other account action needs. Log in once and reuse login_cookies (and the same proxy) until it stops working; logging in repeatedly can get the account locked. Takes 10-25 seconds. Providing totp_secret (two-factor key) is strongly recommended, otherwise the credential may not be allowed to post. At most 10 logins per 10 minutes per API account and 3 per 10 minutes per X user name.

Price: $0.10 per request.

Request body

Send as application/json.

  • user_namestringrequired

    X screen name of the account, without the @.

  • emailstringrequired

    Email address of the X account.

  • passwordstringrequired

    Password of the X account. Used for this login only; we do not store it.

  • totp_secretstring

    Two-factor authentication secret (the key behind the authenticator app code). Strongly recommended.

  • proxystringrequired

    Proxy for this X account, in the form scheme://user:pass@host:port where scheme is http, https, socks5 or socks4. Use the same proxy for every request of the account. Must be a public address; a residential proxy is recommended.

Example request

curl -X POST "https://api.cheapxapi.com/twitter/user_login_v2" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "user_name": "<user_name>",
    "email": "<email>",
    "password": "<password>",
    "proxy": "<proxy>"
  }'

Response

Charged. "status": "success" means the action was done; "status": "error" means X rejected it and message says why.

FieldType
login_cookiesstring
statusstring
messagestring

Status codes

200
Charged. "status": "success" means the action was done; "status": "error" means X rejected it and message says why.
400
Missing or invalid fields (not charged). The message names the field; your values are never echoed back.
401
Missing or invalid API key (not charged).
402
Insufficient balance (not charged).
405
Wrong HTTP method (not charged).
413
Request body too large (not charged).
429
Rate limit exceeded, including the per-X-account and login limits (not charged). Retry after the time in the Retry-After header.
503
Temporary service problem (not charged). If it says the request timed out, the action may already have been applied on X: check before retrying.