Register Session API
Register your X session cookies so write actions (like, retweet, bookmark, follow, create or delete a tweet) and private-data reads (home timeline, bookmarks, likes, DMs, followers-you-know) run as your account. Supply auth_token and ct0 once; the session is stored against your API key and applied automatically. This call is free. Cost: Free per call.
Authorization
bearerAuth Pass your API key as a bearer token on every request: Authorization: Bearer <API_KEY>.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/customer/session" \ -H "Content-Type: application/json" \ -d '{ "auth_token": "string", "ct0": "string" }'{ "ok": true, "message": "Session registered. Private-data endpoints will read as your account.", "username": "myhandle"}{ "error": "bad_request", "message": "Missing or malformed parameter. Fix the request before retrying."}{ "error": "unauthorized", "message": "The API key is missing, malformed, or revoked. Check the Authorization header."}{ "error": "insufficient_credits", "message": "Your balance is exhausted. Top up your credits to continue."}{ "error": "forbidden", "message": "The acting account is not authorized for this write action, or has no logged-in session."}{ "error": "not_found", "message": "The resource does not exist, for example a deleted tweet or a private account."}{ "error": "rate_limited", "message": "Too many requests. Back off and retry with exponential backoff."}{ "error": "server_error", "message": "Something failed on our side. Retry with backoff; if it persists, contact support."}Pricing
| Unit | Price |
|---|---|
| Per call | Free |
Overview
Account Session: Bring your own X session cookies (recommended), or mint a session from a username and password, so write actions and private-data reads act as your account. Free.
User Login POST
Log in to an X account with a username and password (plus a TOTP secret when two-factor authentication is enabled) and get back a fresh session: the auth_token, ct0, and twid cookies. This is a convenience alternative to Register Session for when you cannot copy cookies out of a browser. Bringing your own auth_token and ct0 via POST /customer/session stays the primary, recommended path. This call is free. Cost: Free per call.