Connect an X account

DMs and engagement actions run from your own X account. Connect it once — we store the session encrypted and keep it alive — then reference it by account_id.

Connecting an account requires an active subscription plan with an available account slot. Subscribe in the dashboard first, or the connect call returns 403 seat_limit.

Connect (username & password)

POST/v1/accounts/connect50 credits

We log in on your behalf via the upstream layer and store the resulting session. Credentials are used once and encrypted at rest.

curl -X POST https://api.xautodm.com/v1/accounts/connect \
  -H "Authorization: Bearer $XAUTODM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method":"login","username":"yourhandle","password":"your-password","email":"[email protected]","totp_secret":"JBSWY3DPEHPK3PXP"}'
FieldTypeRequiredDescription
methodstringRequiredEither login or cookies.
usernamestringRequiredYour X handle.
passwordstringRequiredYour X password. Used once, encrypted at rest, never logged.
emailstringOptionalInclude it in case X asks for email verification during login.
totp_secretstringOptionalThe base32 2FA secret (not the 6-digit code), required only if your account has an authenticator app enabled.

Response:

Response
{
  "data": { "account": { "account_id": "acc_1a2b3c", "handle": "yourhandle", "status": "active" } },
  "meta": { "credits_charged": 50, "credits_remaining": 4950, "request_id": "req_..." }
}

Connect (paste cookies)

POST/v1/accounts/connect50 credits

If you already have a session, pass your X cookies (a Cookie-Editor JSON export). This performs no login and is never rate-limited, but can't auto-relogin when it expires.

curl -X POST https://api.xautodm.com/v1/accounts/connect \
  -H "Authorization: Bearer $XAUTODM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method":"cookies","cookiesRaw":"[{\"name\":\"auth_token\",\"value\":\"...\"},{\"name\":\"ct0\",\"value\":\"...\"}]"}'

Managed sessions & auto re-login

X sessions expire. When a call hits an expired session, we automatically re-login using your stored credentials (login method only) and retry — you don't have to do anything. If a session can't be recovered, the account is flagged and calls return 409 account_needs_reconnect.

Reconnect a dead session

POST/v1/accounts/{id}/reconnect50 credits
curl -X POST https://api.xautodm.com/v1/accounts/acc_1a2b3c/reconnect \
  -H "Authorization: Bearer $XAUTODM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method":"login","username":"yourhandle","password":"your-password"}'

Manage accounts

GET/v1/accountsfree

List your connected accounts.

curl https://api.xautodm.com/v1/accounts \
  -H "Authorization: Bearer $XAUTODM_API_KEY"
DELETE/v1/accounts/{id}free

Disconnect an account and purge its stored credentials.

curl -X DELETE https://api.xautodm.com/v1/accounts/acc_1a2b3c \
  -H "Authorization: Bearer $XAUTODM_API_KEY"
Send DMs & read repliesEngagement actions