Docs
Account actions

Account actions

Endpoints that read or change your own X account: post (also polls and scheduled tweets), reply, like, retweet, follow, mute, block, bookmarks, lists, communities, drafts, media upload, profile and direct messages.

Your account, your proxy, your risk.

Account actions run with the session cookie of your own X account and go out through your own proxy. Use only accounts you control and follow X's rules. Automated posting, following or liking can get the account limited or suspended; that is between you and X. Treat the cookie like a password: it gives full access to the account. Trial keys cannot call these endpoints.

How to copy the cookie and which proxy to use: Your X session (cookie).

How they work

  • All are POST requests with a JSON body. Your TwittrAPI key goes in the X-API-KEY header as usual.
  • cookie is the cookie header of your logged-in X session. It must contain auth_token and ct0. Copy it from your browser's developer tools while logged in to x.com; step by step: Your X session (cookie).
  • proxy is required on every call, in the form http://user:pass@host:port. The request to X goes out through it, so X sees your proxy's IP, not ours. Use one proxy per account and keep it stable.
  • There is no login endpoint. Log in on x.com yourself and pass the cookie.
  • Most endpoints answer with {"status_code": ..., "response": "..."}, where response is X's body as a string. The HTTP status is X's status when X answered with an error, so a failed action is a failed request.
  • Add ?format=simple (or the header X-Response-Format: simple) to get the result as compact JSON in the simple format instead: the new tweet, the user, the media ID or {"data": {"success": true}}. Each endpoint page says what it returns; some (for example the drafts, list creation and your likes) have none and return the usual wrapper.
  • Each call costs the same as a read call; see pricing. These calls are never retried by the gateway, because a retry could post or like twice. Each call is billed once; 400, 408 and 5xx are refunded like everywhere else, and so is 407 (your proxy failed, with a code such as PROXY_AUTH_FAILED); 422 and X's own 4xx are charged. Details: Errors.

Endpoints

Lists

Create, change and delete lists of your own account and manage their members. To read a list, use the list endpoints of the API reference.

Communities

Create or delete a community, and join or leave one with your account.

Drafts

Unsent drafts of your account, as in the drafts folder on x.com.

Articles

X Articles (long-form posts) of your account: list, read, write, publish and delete them. X Articles need X Premium.

Direct messages

Read and send direct messages of your own X account, with the same cookie and proxy as the other account actions. Direct messages on X are end-to-end encrypted (X Chat).

To read or send messages, the API also needs your X Chat passcode. It unlocks your account's chat keys; messages are then decrypted and encrypted on our server while your request runs. The API does not store messages or the passcode. Listing conversations, reading a conversation's settings and your DM settings work without a passcode.

Each call is one billed call like the other account actions. The answers are JSON built by the API (not the {status_code, response} wrapper); format=simple returns the same data in the simple format.