Reset Password (two-step)
Two-step Twitter/X account recovery — you trigger the reset, the owner supplies the emailed code, you get fresh tokens. Works for any mailbox. $0.005 per step.
/twitter/reset-password/send-codeA two-step recovery flow for when you don't have (or can't read) the mailbox: you trigger the reset, the account owner reads the emailed code from their own inbox and hands it back, and we complete the reset and return fresh tokens. Because the owner reads the code, this works for any email provider, including Hotmail/Outlook, Gmail and Yahoo.
It sets a new password we control and returns fresh auth_token / ct0 / twid. Each step costs $0.005 per call.
This drives X's current password-reset flow (the old account/* form flow has been retired by X). Step 1 also returns the masked recovery email X shows (e.g. ja***@***.com), so you can confirm the code went to the right inbox.
Step 1 — Send the code
/twitter/reset-password/send-codeTriggers X's reset email for the account and returns a session_id.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
username | string | Yes | Twitter username or email on the account |
proxy | string | No | Proxy URL for the reset trigger |
Response (200)
{
"status": "success",
"session_id": "5760cef9872e200dd0ebe3d3",
"expires_in": 600,
"method": "email",
"masked_email": "Email ja****************@*******.com"
}The reset session is held server-side for ~10 minutes.
X limits reset attempts per account. A few send-code calls in a short window return RECOVERY_RATE_LIMITED (429), and repeated attempts extend the cooldown — which can run 30-60 minutes. Retry later rather than immediately.
Step 2 — Confirm with the code
/twitter/reset-password/confirmCompletes the reset with the code the owner received, and returns fresh tokens plus the new password.
Save the returned new_password. It's the account's password now.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | From step 1 |
code | string | Yes | The code the owner read from their email (6 digits) |
totp_secret | string | Conditional | Base32 TOTP secret, required if the account has authenticator-app 2FA |
Response (200)
{
"username": "myaccount",
"new_password": "Gx7hcuyxk5xr",
"auth_token": "59bace0de501...",
"ct0": "9959...",
"twid": "u=155977652",
"profile": { "...": "..." }
}A 422 with new_password means the reset succeeded. X asked for a 2FA method we can't satisfy (a passkey), so no session tokens were issued — but the password was changed. Finish by calling User Login with new_password.
Error Responses
Errors include a code field:
| HTTP | code | Meaning |
|---|---|---|
| 404 | ACCOUNT_NOT_FOUND | Account not found (suspended, deleted, or renamed) |
| 410 | SESSION_EXPIRED | Unknown/expired session_id (or the parked browser session timed out) — start again at step 1 |
| 409 | SESSION_BUSY | A confirm is already in progress for this session — retry shortly |
| 400 | CODE_REJECTED | Wrong code; the session stays valid — retry with the correct code |
| 400 | NO_CODE | Missing code |
| 422 | VERIFY_REQUIRED | X serves an "Confirm your account" identity check instead of the method list |
| 422 | (no code) — response carries new_password | Reset succeeded, but X required a passkey we can't satisfy, so no tokens. Use new_password with User Login. |
| 429 | RECOVERY_RATE_LIMITED | X's per-account reset limit — wait (can be 30-60 min) |
| 503 | MODERN_RECOVERY_UNAVAILABLE | The reset worker is busy/unreachable — retry shortly |
When to use which
- User Login V2 — one call, when you have the mailbox OAuth credentials and it's a supported provider (Hotmail/Outlook).
- This two-step flow — when you don't have mailbox access, the provider isn't auto-readable (Gmail/Yahoo), or the account owner is in the loop to read the code.
Example
# 1) send the code
curl -X POST "https://api.getxapi.com/twitter/reset-password/send-code" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{ "username": "myaccount" }'
# 2) confirm with the code the owner received
curl -X POST "https://api.getxapi.com/twitter/reset-password/confirm" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{ "session_id": "<from step 1>", "code": "276019", "totp_secret": "SXGS5MN2IHUMV34H" }'User Login V2 (Recovery)New
Recover a Twitter/X account with a dead token and changed password via the mailbox. Returns fresh tokens + a new password. $0.005 per call.
List Members
Get all members of a public Twitter/X list via API. $0.001 per call, ~20 users per call. GetXAPI list members endpoint documentation.