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_namestringrequiredX screen name of the account, without the @.
emailstringrequiredEmail address of the X account.
passwordstringrequiredPassword of the X account. Used for this login only; we do not store it.
totp_secretstringTwo-factor authentication secret (the key behind the authenticator app code). Strongly recommended.
proxystringrequiredProxy for this X account, in the form
scheme://user:pass@host:portwhere scheme ishttp,https,socks5orsocks4. 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.
| Field | Type |
|---|---|
login_cookies | string |
status | string |
message | string |
Status codes
- 200
- Charged.
"status": "success"means the action was done;"status": "error"means X rejected it andmessagesays 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-Afterheader. - 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.