---
title: "Connect an X account → login_cookie"
method: POST
path: "/twitter/user_login_v2"
tags: ["write"]
---

# Connect an X account → login_cookie

`POST /twitter/user_login_v2`

## Request

- Base URL: `https://api.relayxapi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.relayxapi.com/twitter/user_login_v2`
- Auth: none declared

Return a sealed `login_cookie` the caller passes to write endpoints. Nothing is stored server-side.
BYO: pass auth_token+ct0. Credentialed: pass username+password (+totp) — needs a device in the loop.

## Headers

- `x-api-key` string, nullable

## Request body

- LoginV2: Connect an X account. Either bring-your-own web session (auth_token + ct0), or username/password for a server-side Android login (needs a device in the loop; see docs §1).
  - `auth_token` string, nullable: web session cookie (BYO path)
  - `ct0` string, nullable: web CSRF cookie (BYO path)
  - `twid` string, nullable
  - `guest_id` string, nullable
  - `username` string, nullable
  - `password` string, nullable
  - `totp` string, nullable: TOTP code/secret if the account has 2FA

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/relayxapi/apis/relayx-x-data-api.md) · [All operations](https://skmtc.dev/relayxapi/apis/relayx-x-data-api/llms.txt) · [OpenAPI document](https://skmtc.dev/relayxapi/apis/relayx-x-data-api/revisions/6c9acb520594?raw)
