Skip to main content
POST https://xquik.com/api/v1/x/accounts
Free. This endpoint does not consume credits.
This takes a dashboard session, or a key with the Connect X accounts permission. Turn it on at dashboard.xquik.com/api-keys. Full access doesn’t include it. A key without it gets 403 x_account_connect_permission_required. OAuth tokens and MCP tools get 403 session_required. With a key, your backend receives the user’s X password and 2FA secret. Read your duties first.
Xquik encrypts credentials at rest. It uses them only to maintain the connection. Xquik never stores plaintext passwords.
A durable Xquik connection requires Authenticator App 2FA and totp_secret. Missing the key? Restart Authentication App 2FA in X to reveal a new secret. Copy it, add it to your authenticator app, and finish X’s 6-digit confirmation. Then send the saved long key as totp_secret. Xquik does not support custom, dedicated, or user-supplied proxies. Xquik connects from its own infrastructure. A connection can finish immediately or continue as a tracked attempt. It can also ask for an email code. If it continues, follow the returned Location. Do not send the credentials again while the attempt is pending.

Headers

Body

2FA secret key setup

Xquik needs the authenticator app secret key, not a live 6-digit code. That key belongs to Authentication App 2FA. The key is the long base32 string X shows while you set up 2FA. An example is JBSWY3DPEHPK3PXP.

Use the secret key

Paste the long base32 key into totp_secret. Xquik uses it to generate fresh 2FA codes during login challenges.

Do not use backup codes

Do not paste the 6-digit authenticator code. Do not paste the 12-character backup code, a passkey, or a security key prompt.
If you already saved the secret key, send it as totp_secret. If you did not save it, create a fresh authenticator app secret on X.

You saved the key

Paste that saved base32 secret into totp_secret. Do not paste the current 6-digit authenticator code.

2FA is on, key is missing

X shows the text secret only during Authentication App setup. Turn Authentication App off, then on again. Copy the new key, then finish setup on X.

2FA is not enabled

Start Authentication App setup on X and reveal the text secret. Copy it and add it to your authenticator app. Confirm the 6-digit code on X, then connect.
  1. Open X Settings and Privacy > Security and Account Access > Security.
  2. Open Two-Step Verification > Authentication App.
  3. Turn Authentication App off.
  4. Turn Authentication App on again.
  5. X shows a QR code. Then choose Can’t scan the QR code? to reveal the text secret.
  6. Copy the long secret key. Then store it in a password manager before leaving the setup screen.
  7. Add that key to your authenticator app if you are setting it up fresh.
  8. Finish enabling 2FA on X by entering the current 6-digit code. The code comes from your authenticator app.
  9. Send the saved long key in totp_secret when you call Xquik.
Do not stop after copying the secret key. Complete the X-side 2FA confirmation before starting the Xquik connection. Otherwise the key will not work.
Xquik can’t complete passkey or security key prompts. If X asks this account for a passkey, delete the passkey on X. In that case, keep Authenticator App 2FA.

Response

201 Created

202 Connecting

The response includes these headers.
  • Location: /api/v1/x/account-connection-attempts/{id}
  • Retry-After: 3
  • Cache-Control: no-store
Wait for Retry-After, then call Get X Account Connection Status. Keep checking while status is pending. Do not create another attempt.

202 Email code required

Submit the code to Submit X Account Email Code.

400 Invalid input

Missing username, email, password, or totp_secret, or invalid field format.

401 Unauthenticated

{ "error": "unauthenticated", "message": "Missing or invalid API key" } Missing or invalid API key.

409 Duplicate

Xquik already has this X account connected. The answer never says on which Xquik account.

429 Rate limit exceeded

{ "error": "rate_limit_exceeded", "message": "Connection safety limit reached. Try again later.", "retryAfter": 900 } You sent too many failed logins in 15 minutes. The limit counts this caller or this X account. Wait the Retry-After seconds, then try once. Each account a caller connects raises its limit. See the rate limits guide for details.

429 Login cooldown

{ "error": "login_cooldown", "message": "Login is temporarily paused", "reason": "automated", "retryAfterMs": 3600000 } A prior login attempt triggered a cooldown (for example, X flagged the session). Wait for retryAfterMs before retrying. The response includes a Retry-After header in seconds.

422 Login failed

{ "error": "login_failed", "message": "Login failed. Check credentials and try again.", "retryAfterMs": 300000 } X rejected the submitted username, email, password, or TOTP secret. Retry with the current password and the saved Authenticator App secret key. Use the key, not a 6-digit code. When retryAfterMs is present, wait for that duration. The response also includes Retry-After in seconds. { "error": "passkey_required", "message": "X asked this account to sign in with a passkey. Delete the passkey in X's security settings, keep Authentication app 2FA, then try again.", "retryAfterMs": 3600000 } X showed this account a passkey sign-in, which Xquik can’t complete. Open X Settings and Privacy > Security and Account Access > Security > Passkey. Delete the passkey but keep Authenticator App 2FA on, then connect again after retryAfterMs. The response also includes Retry-After in seconds. { "error": "login_failed", "reason": "login_unconfirmed", "message": "X didn't confirm the sign-in after your password. Wait 5 minutes, then try again. Retrying sooner can make X lock the account.", "retryAfterMs": 300000 } X showed no known page after the password. Xquik sends the password only once per attempt. Wait for Retry-After, then try again. Retrying sooner can make X lock the account.

502 X user lookup failed

{ "error": "x_user_lookup_failed", "message": "X user not found. Check the username." } Xquik could not resolve the X (Twitter) username. Verify the handle is correct and that the account exists.

503 Service unavailable

{ "error": "service_unavailable", "message": "Service temporarily unavailable. Try again." } The X connection service is temporarily unavailable. Retry after a short delay.
Related.

Response examples

  • 400 { "error": "invalid_input", "message": "Invalid input. Check the request body." }
  • 401 { "error": "unauthenticated", "message": "Authentication required. Provide a valid API key or bearer token." }
  • 403 { "error": "api_key_paused", "message": "This API key is paused. Resume it at dashboard.xquik.com/api-keys to use it again." }
  • 409 { "error": "account_already_connected", "message": "This X account is already connected." }
  • 422 { "error": "login_failed", "message": "Login failed. Check credentials and try again." }
  • 429 { "error": "rate_limit_exceeded", "message": "Too many requests. Retry later." }
  • 502 { "error": "x_user_lookup_failed", "message": "X username lookup failed. Try again later." }
  • 503 { "error": "service_unavailable", "message": "Service temporarily unavailable. Try again later." }