Bulk Unlike + Unretweet on X API — Complete Guide
- twitterapi.io cannot list the tweets you liked. Get the IDs from your X data archive (
data/like.js) or the officialGET /2/users/{id}/liked_tweets - Unlike on twitterapi.io:
POST /twitter/unlike_tweet_v2withlogin_cookies,tweet_idandproxy, at $0.0006 (60 credits) per call login_cookiescome fromPOST /twitter/user_login_v2($0.10 per call on the pricing page); you supply your X credentials and your own residential proxy- List your retweets with
GET /twitter/user/tweet_timeline(it takes your numericuserId) and keep tweets that have aretweeted_tweetobject; reads cost $0.00015 per tweet returned - Undo retweets on twitterapi.io with
POST /twitter/unretweet_tweet_v2(samelogin_cookies,tweet_id,proxybody, $0.0006 per call), or with the officialDELETE /2/users/{id}/retweets/{source_tweet_id}at $0.010 per request - 1,000 unretweets on twitterapi.io cost 1,000 × $0.0006 + $0.10 login = $0.70, versus $10.00 on the official API; twitterapi.io is cheaper from the 11th action in a session
- Pause 1.5 seconds between calls, dry-run first, and write one log line per attempt
The majority of cleanup tutorials for X stop at deleting tweets. Likes and retweets need their own pass, and the two are not symmetrical: each needs a list of tweet IDs first, and the place you can get that list is different for each. This guide covers both with runnable Python, and it is specific about which steps twitterapi.io can do and which it cannot.
The short version: twitterapi.io can unlike a tweet (/twitter/unlike_tweet_v2), undo a retweet (/twitter/unretweet_tweet_v2), and show you which of your timeline entries are retweets (/twitter/user/tweet_timeline). The one thing it cannot do is list the tweets you liked; for that you use your X data archive or the official X API. The steps below log in once and then loop the unlike and unretweet calls with a dry run, a log file, and a fixed 1.5 second pause between calls. The pause keeps the run at a pace a person could plausibly work at on their own account; it is not a way around any limit.
twitterapi.io unlike or unretweet: $0.0006 per call (60 credits) plus $0.10 per login, so 1,000 unretweets cost $0.70; timeline read to find retweets: $0.00015 per tweet returned; official X API unlike or unretweet: $0.010 per request, billed as Interaction: Delete (docs.x.com/x-api/getting-started/pricing), so 1,000 cost $10.00
What each API can and cannot do
Four jobs make up a like and retweet cleanup. Here is where each one is possible, checked against the twitterapi.io docs (docs.twitterapi.io/api-reference/post-action-v2 and docs.twitterapi.io/api-reference/openapi.json) and the official X API reference (docs.x.com/x-api/posts/likes/introduction and docs.x.com/x-api/posts/retweets/introduction).
Neither API has a single call that removes all likes or all retweets. Every unlike and every unretweet is its own request.
The twitterapi.io write endpoints work differently from the official ones. They do not use OAuth. You log in once with POST /twitter/user_login_v2 (body fields user_name, email, password, proxy, and an optional totp_secret), which returns login_cookies. You then send that value as login_cookies on each write call, together with a proxy. The proxy field is required and is your own residential proxy URL in the form http://username:password@ip:port. Be clear with yourself about what this means: you are giving your X password to a third-party API. Only do this for an account you own, and change the password afterwards if that makes you more comfortable.
The official X API uses your own developer app and user-context auth instead. X bills an unlike or an undone retweet as Interaction: Delete, $0.010 per request (docs.x.com/x-api/getting-started/pricing), so 1,000 removals cost 1,000 × $0.010 = $10.00. On twitterapi.io the same 1,000 unlikes or unretweets cost 1,000 × $0.0006 + $0.10 for one login = $0.70. The login is paid once per session, so twitterapi.io comes out cheaper from the 11th action onward ($0.10 ÷ ($0.010 − $0.0006) ≈ 10.6). Check both pricing pages before you run anything at volume.
Step 1: get the IDs of the tweets you liked
twitterapi.io does not have a liked-tweets endpoint, so this step never touches it. There are two honest sources.
Your X data archive. In X, go to Settings > Your account > Download an archive of your data (help.x.com/en/managing-your-account/how-to-download-your-x-archive). X prepares a zip file; inside it, data/like.js holds one entry per like with the tweet ID. This costs nothing and needs no developer account. The archive is a snapshot, so likes you add after requesting it are not in the file. Open the file once and check the first entry before you trust a parser with it.
The official X API. GET /2/users/{id}/liked_tweets returns your likes in pages. You need an X developer app and user-context credentials, and the endpoint has its own rate limit and plan pricing (docs.x.com/x-api/posts/likes/introduction).
The code below reads the archive file and saves the IDs to liked_ids.json. The second function is the official-API alternative using tweepy.
import json
from pathlib import Path
def liked_ids_from_archive(like_js_path: str) -> list[str]:
"""Read liked-tweet IDs from the like.js file in your X data archive.
The file is a JavaScript assignment followed by a JSON array, so we
drop everything before the first "[" and parse the rest.
"""
raw = Path(like_js_path).read_text(encoding="utf-8")
entries = json.loads(raw[raw.index("["):])
ids = []
for entry in entries:
tweet_id = entry.get("like", {}).get("tweetId")
if tweet_id:
ids.append(str(tweet_id))
return ids
# Option B: the official X API (needs your own X developer app).
# pip install tweepy
def liked_ids_from_x_api(client, user_id: str) -> list[str]:
"""Page GET /2/users/{id}/liked_tweets with tweepy."""
import tweepy
ids = []
pages = tweepy.Paginator(
client.get_liked_tweets, user_id, max_results=100, user_auth=True
)
for page in pages:
for tweet in page.data or []:
ids.append(str(tweet.id))
return ids
liked_ids = liked_ids_from_archive("twitter-archive/data/like.js")
print(f"found {len(liked_ids)} liked tweets in the archive")
Path("liked_ids.json").write_text(json.dumps(liked_ids))
Step 2: unlike with /twitter/unlike_tweet_v2, paced and logged
With the ID list saved, log in once and loop over the IDs. POST /twitter/unlike_tweet_v2 takes a JSON body with three required fields: login_cookies, tweet_id and proxy. The response has a status field (success or error) and a message field. Check status on every call; an error can come back in the JSON body as well as through the HTTP status code.
The pricing page lists $0.0006 (60 credits) per call for this endpoint and $0.10 per call for user_login_v2. So 1,000 unlikes cost about $0.60 and 10,000 cost about $6.00, plus one login. Only successful calls are billed: a call where X rejects the action (status: error) is not charged, and neither is an HTTP 400. Confirm the current figure on twitterapi.io/pricing before a large run.
Three habits keep the run safe. Run with dry_run=True first and read the log it writes. Pause 1.5 seconds between calls so the activity stays at a pace one person could produce by hand. Stop when several calls fail in a row instead of retrying in a tight loop, then read the message values in the log to find out why. The script does all three.
If you would rather not share your X password, the same ID list works with the official DELETE /2/users/{id}/likes/{tweet_id}; in tweepy that is client.unlike(tweet_id).
import os, json, time, requests
from datetime import datetime, timezone
BASE = "https://api.twitterapi.io"
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
PROXY = os.environ["X_PROXY"] # your own residential proxy, http://user:pass@ip:port
UNLIKE_PRICE_USD = 0.0006 # per call, from the endpoint description
def login() -> str:
"""Log in once and return the login cookie for the write endpoints."""
body = {
"user_name": os.environ["X_USERNAME"],
"email": os.environ["X_EMAIL"],
"password": os.environ["X_PASSWORD"],
"proxy": PROXY,
}
if os.environ.get("X_TOTP_SECRET"):
body["totp_secret"] = os.environ["X_TOTP_SECRET"]
r = requests.post(f"{BASE}/twitter/user_login_v2",
headers=HEADERS, json=body, timeout=120)
r.raise_for_status()
data = r.json()
if data.get("status") != "success":
raise RuntimeError(f"login failed: {data.get('message')}")
return data["login_cookies"]
def bulk_unlike(tweet_ids: list[str], login_cookies: str,
dry_run: bool = True, max_consecutive_errors: int = 5) -> dict:
"""Unlike tweets one call at a time, with a pause and a log line per tweet."""
stamp = datetime.now(timezone.utc).strftime("%Y%m%d_%H%M%S")
log_path = f"unlike_log_{stamp}.jsonl"
ok = failed = streak = 0
with open(log_path, "a", encoding="utf-8") as log:
for tweet_id in tweet_ids:
entry = {"tweet_id": tweet_id, "action": "unlike",
"at": datetime.now(timezone.utc).isoformat()}
if dry_run:
entry["result"] = "dry_run"
log.write(json.dumps(entry) + "\n")
continue
try:
r = requests.post(
f"{BASE}/twitter/unlike_tweet_v2",
headers=HEADERS,
json={"login_cookies": login_cookies,
"tweet_id": tweet_id,
"proxy": PROXY},
timeout=60,
)
data = r.json()
if r.ok and data.get("status") == "success":
entry["result"] = "unliked"
ok += 1
streak = 0
else:
entry["result"] = f"error: http {r.status_code} {data.get('message')}"
failed += 1
streak += 1
except (requests.RequestException, ValueError) as exc:
entry["result"] = f"error: {exc}"
failed += 1
streak += 1
log.write(json.dumps(entry) + "\n")
log.flush()
if streak >= max_consecutive_errors:
print("too many errors in a row, stopping; read the log first")
break
time.sleep(1.5) # fixed 1.5 s between calls
return {"unliked": ok, "failed": failed, "log": log_path}
liked_ids = json.load(open("liked_ids.json"))
print(f"{len(liked_ids)} unlikes would cost about "
f"${len(liked_ids) * UNLIKE_PRICE_USD:.2f}")
print(bulk_unlike(liked_ids, login_cookies="", dry_run=True)) # writes the log only
# When the dry-run log looks right:
# cookies = login()
# print(bulk_unlike(liked_ids, cookies, dry_run=False))
Step 3: list your retweets, then undo them with /twitter/unretweet_tweet_v2
Retweets show up in your own timeline, so twitterapi.io can enumerate them. Use GET /twitter/user/tweet_timeline for this rather than the Last Tweets endpoint: Last Tweets is built on X search and can come back empty for accounts X hides from search, while tweet_timeline reads the profile timeline directly, with the same 20 tweets per page, the same cursor paging and the same price. It takes your numeric userId (not your handle), plus optional cursor, includeReplies and includeParentTweet, and returns the tweets under data.tweets with has_next_page and next_cursor at the top level. To turn your handle into that ID, call GET /twitter/user/info?userName=<handle> once and read data.id (18 credits, $0.00018). The first page uses an empty cursor. In the tweet schema, a retweet has a retweeted_tweet object holding the original tweet; on a normal tweet that field is null. The original tweet's id is the ID you pass to the undo call (the official API calls it source_tweet_id).
Reads are billed per tweet returned: 15 credits, which is $0.00015 at 100,000 credits per dollar, or $0.15 per 1,000 tweets (twitterapi.io/pricing). You pay for every tweet the timeline returns, not only the retweets, so a 5,000-tweet timeline costs about $0.75 to scan. The spec does not say how far back this endpoint pages, so do not assume it reaches the very first tweet of an old account. If the list looks short, the data/tweets.js file in your X archive is the complete record.
To undo them, reuse the login from Step 2 and call POST /twitter/unretweet_tweet_v2 once per retweet. The JSON body has the same three required fields as the unlike call: login_cookies, tweet_id (the original tweet's ID) and proxy. It costs $0.0006 (60 credits) per call, the same as every v2 write, and the response has the same status and message fields. If the account never retweeted that tweet, X treats the call as a no-op and the endpoint returns success, so a re-run over the same list does not fail on items that are already done. Billing follows the same rule as unlike: a call where X rejects the action (status is error in the body) is not charged, and neither is an HTTP 400. Endpoint reference: docs.twitterapi.io/api-reference/endpoint/unretweet_tweet_v2.
If you would rather not share your X password, the official DELETE /2/users/{id}/retweets/{source_tweet_id} (docs.x.com/x-api/posts/retweets/introduction) does the same job with your own developer app; in tweepy that is client.unretweet(source_tweet_id). For a small number of retweets, undoing them by hand in the X app is also reasonable.
import os, json, time, requests
from datetime import datetime, timezone
BASE = "https://api.twitterapi.io"
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
PROXY = os.environ["X_PROXY"] # your own residential proxy, http://user:pass@ip:port
READ_PRICE_USD = 0.00015 # per tweet returned, twitterapi.io/pricing
UNRETWEET_PRICE_USD = 0.0006 # per call, same as every v2 write
USER_INFO_PRICE_USD = 0.00018 # one user/info lookup, 18 credits
def user_id_for(handle: str) -> str:
"""GET /twitter/user/info once to turn your handle into the numeric userId."""
r = requests.get(
f"{BASE}/twitter/user/info",
headers=HEADERS,
params={"userName": handle},
timeout=30,
)
r.raise_for_status()
return str(r.json()["data"]["id"])
def list_retweets(user_id: str) -> tuple[list[dict], int]:
"""Page your timeline and keep the entries that are retweets.
Returns (retweets, tweets_read). Each retweet keeps the ID of the
timeline entry and the ID of the original tweet.
"""
retweets, tweets_read, cursor = [], 0, ""
while True:
r = requests.get(
f"{BASE}/twitter/user/tweet_timeline",
headers=HEADERS,
params={"userId": user_id, "cursor": cursor},
timeout=30,
)
r.raise_for_status()
resp = r.json()
# Tweets arrive under data.tweets; the cursor fields are at the top level.
tweets = (resp.get("data") or {}).get("tweets") or []
tweets_read += len(tweets)
for t in tweets:
original = t.get("retweeted_tweet")
if original:
retweets.append({"timeline_id": t["id"],
"source_tweet_id": original["id"]})
cursor = resp.get("next_cursor")
if not resp.get("has_next_page") or not cursor:
break
time.sleep(0.75)
return retweets, tweets_read
def bulk_unretweet(retweets: list[dict], login_cookies: str,
dry_run: bool = True, max_consecutive_errors: int = 5) -> dict:
"""POST /twitter/unretweet_tweet_v2, one call per retweet, paced and logged."""
stamp = datetime.now(timezone.utc).strftime("%Y%m%d_%H%M%S")
log_path = f"unretweet_log_{stamp}.jsonl"
ok = failed = streak = 0
with open(log_path, "a", encoding="utf-8") as log:
for item in retweets:
entry = {**item, "action": "unretweet",
"at": datetime.now(timezone.utc).isoformat()}
if dry_run:
entry["result"] = "dry_run"
log.write(json.dumps(entry) + "\n")
continue
try:
r = requests.post(
f"{BASE}/twitter/unretweet_tweet_v2",
headers=HEADERS,
json={"login_cookies": login_cookies,
"tweet_id": item["source_tweet_id"],
"proxy": PROXY},
timeout=60,
)
data = r.json()
if r.ok and data.get("status") == "success":
entry["result"] = "unretweeted"
ok += 1
streak = 0
else:
entry["result"] = f"error: http {r.status_code} {data.get('message')}"
failed += 1
streak += 1
except (requests.RequestException, ValueError) as exc:
entry["result"] = f"error: {exc}"
failed += 1
streak += 1
log.write(json.dumps(entry) + "\n")
log.flush()
if streak >= max_consecutive_errors:
print("too many errors in a row, stopping; read the log first")
break
time.sleep(1.5) # fixed 1.5 s between calls
return {"unretweeted": ok, "failed": failed, "log": log_path}
retweets, tweets_read = list_retweets(user_id_for("your_handle"))
read_cost = USER_INFO_PRICE_USD + tweets_read * READ_PRICE_USD
print(f"read {tweets_read} tweets (about ${read_cost:.4f} with the ID lookup), "
f"{len(retweets)} are retweets, about "
f"${len(retweets) * UNRETWEET_PRICE_USD:.2f} to undo")
with open("retweets.json", "w", encoding="utf-8") as f:
json.dump(retweets, f)
print(bulk_unretweet(retweets, login_cookies="", dry_run=True)) # writes the log only
# When the dry-run log looks right, reuse login() from Step 2:
# cookies = login()
# print(bulk_unretweet(retweets, cookies, dry_run=False))
# Official alternative: tweepy client.unretweet(source_tweet_id) per item.
Putting it together for a full account cleanup
If you are also deleting your own tweets (see /blog/delete-tweets-free-api-bulk-tutorial), run the pieces in this order.
- Request your X data archive and keep the zip. It is your only full record of what you liked, retweeted and posted (see also
/blog/twitter-history-api-export-guide). - Build
liked_ids.jsonfromdata/like.js, or from the official liked-tweets endpoint. - Dry-run the unlike loop, read the log, then run it for real through
/twitter/unlike_tweet_v2. - List your retweets with
/twitter/user/tweet_timelineand undo them with/twitter/unretweet_tweet_v2, reusing the same login. Do this before you delete your own tweets, so the timeline scan is not reading entries you are about to remove anyway. - Delete your own tweets last. twitterapi.io has
/twitter/delete_tweet_v2for that, with the same three body fields and the same $0.0006 price. - Check the result on your profile's Likes tab and timeline. Because twitterapi.io cannot list likes, the profile (or a fresh archive) is how you confirm the likes are gone.
A worked cost example using the prices above: 10,000 unlikes at $0.0006 is $6.00, one login is $0.10, looking up your user ID is $0.00018 and scanning a 10,000-tweet timeline for retweets is $1.50, and undoing 1,000 of those retweets is another $0.60 on the same login, so about $8.20 in total. The same 11,000 removals on the official API, billed as Interaction: Delete at $0.010 each, would be $110.00 before any read costs. On time: 10,000 calls with a 1.5 second pause is about 4.2 hours of waiting before you count the requests themselves, so plan for a long unattended run and rely on the log.
Side by side: four ways to bulk unlike and unretweet
The official API covers all four jobs with documented endpoints, including listing your likes. twitterapi.io covers three of the four (unlike, list retweets, unretweet) without an X developer app, and at $0.0006 per action plus one $0.10 login it costs less than the official $0.010 per request from the 11th action in a session; pair it with your X archive for the liked-tweet IDs. The trade-off is that you hand over your X login instead of OAuth tokens. The cleanup apps trade code for a user interface; their limits and prices change, so read their own pages instead of trusting a number quoted elsewhere. Doing it by hand is fine for a few dozen items.
Pacing, limits and what the script will not do
Pause 1.5 seconds between calls. The scripts sleep a fixed 1.5 seconds after each write. This is a conservative choice made for this guide, not a published limit. Its purpose is to keep your account's activity at a human pace. It is not a technique for avoiding detection, and nothing here should be used that way.
Official X API limits. The DELETE endpoints for likes and retweets have per-user rate limits listed at docs.x.com/x-api/fundamentals/rate-limits. Creating the tweepy client with wait_on_rate_limit=True makes it sleep until the window resets.
twitterapi.io limits. The OpenAPI spec does not state a rate limit for the write endpoints. Account-level request limits are described on /qps-limits. If calls start failing, stop and read the message text in the log; the scripts stop on their own after five failures in a row.
X's automation rules apply to you. Every unlike and unretweet runs as your own logged-in account, and X can rate-limit, lock or suspend an account whose activity it treats as abusive. X publishes rules for automated activity at help.x.com/en/rules-and-policies/x-automation. Cleaning up your own account is the use case here. Do not run these scripts against an account that is not yours.
No undo. An unlike or unretweet can be reversed one tweet at a time by liking or retweeting again, if the original tweet still exists. There is no bulk restore. The log file and your archive are the only record of what was removed, so keep both.
# Unlike everything in your X archive and undo your retweets, in one run.
# Uses only twitterapi.io endpoints: user_login_v2, unlike_tweet_v2,
# user/info, user/tweet_timeline, unretweet_tweet_v2.
import os, json, time, requests
from datetime import datetime, timezone
from pathlib import Path
BASE = "https://api.twitterapi.io"
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
PROXY = os.environ["X_PROXY"] # your own residential proxy URL
HANDLE = os.environ["X_USERNAME"]
LIKE_JS = os.environ.get("LIKE_JS", "twitter-archive/data/like.js")
WRITE_PRICE_USD = 0.0006 # per unlike or unretweet call
DRY_RUN = True # flip to False after reading the dry-run log
RUN_ID = datetime.now(timezone.utc).strftime("%Y%m%d_%H%M%S")
LOG_PATH = f"cleanup_{RUN_ID}.jsonl"
def pause():
time.sleep(1.5) # fixed 1.5 s between calls
def log_line(entry: dict):
entry["at"] = datetime.now(timezone.utc).isoformat()
with open(LOG_PATH, "a", encoding="utf-8") as log:
log.write(json.dumps(entry) + "\n")
def liked_ids_from_archive(path: str) -> list[str]:
raw = Path(path).read_text(encoding="utf-8")
entries = json.loads(raw[raw.index("["):])
return [str(e["like"]["tweetId"]) for e in entries
if e.get("like", {}).get("tweetId")]
def login() -> str:
body = {"user_name": HANDLE, "email": os.environ["X_EMAIL"],
"password": os.environ["X_PASSWORD"], "proxy": PROXY}
if os.environ.get("X_TOTP_SECRET"):
body["totp_secret"] = os.environ["X_TOTP_SECRET"]
r = requests.post(f"{BASE}/twitter/user_login_v2",
headers=HEADERS, json=body, timeout=120)
r.raise_for_status()
data = r.json()
if data.get("status") != "success":
raise RuntimeError(f"login failed: {data.get('message')}")
return data["login_cookies"]
def write(path: str, tweet_id: str, cookies: str) -> tuple[bool, str]:
"""POST one v2 write; path is the full endpoint path."""
r = requests.post(BASE + path, headers=HEADERS,
json={"login_cookies": cookies, "tweet_id": tweet_id,
"proxy": PROXY}, timeout=60)
try:
data = r.json()
except ValueError:
return False, f"http {r.status_code}, body was not JSON"
return r.ok and data.get("status") == "success", str(data.get("message"))
def user_id_for(handle: str) -> str:
r = requests.get(f"{BASE}/twitter/user/info", headers=HEADERS,
params={"userName": handle}, timeout=30)
r.raise_for_status()
return str(r.json()["data"]["id"]) # one lookup, $0.00018
def list_retweets(user_id: str) -> list[str]:
out, cursor = [], ""
while True:
r = requests.get(f"{BASE}/twitter/user/tweet_timeline", headers=HEADERS,
params={"userId": user_id, "cursor": cursor}, timeout=30)
r.raise_for_status()
resp = r.json()
tweets = (resp.get("data") or {}).get("tweets") or []
for t in tweets:
if t.get("retweeted_tweet"):
out.append(str(t["retweeted_tweet"]["id"])) # original tweet ID
cursor = resp.get("next_cursor")
if not resp.get("has_next_page") or not cursor:
return out
pause()
def run(action: str, path: str, tweet_ids: list[str], cookies: str) -> bool:
"""Loop one write endpoint over tweet_ids. Returns False if it had to stop."""
errors_in_a_row = 0
for tweet_id in tweet_ids:
if DRY_RUN:
log_line({"action": action, "tweet_id": tweet_id, "result": "dry_run"})
continue
try:
ok, msg = write(path, tweet_id, cookies)
except requests.RequestException as exc:
ok, msg = False, str(exc)
log_line({"action": action, "tweet_id": tweet_id,
"result": "done" if ok else f"error: {msg}"})
errors_in_a_row = 0 if ok else errors_in_a_row + 1
if errors_in_a_row >= 5:
print(f"5 {action} errors in a row, stopping; read the log before you retry")
return False
pause()
return True
liked = liked_ids_from_archive(LIKE_JS)
retweets = list_retweets(user_id_for(HANDLE))
Path(f"retweets_{RUN_ID}.json").write_text(json.dumps(retweets, indent=2))
total = len(liked) + len(retweets)
print(f"{len(liked)} likes and {len(retweets)} retweets, about "
f"${total * WRITE_PRICE_USD + 0.10:.2f} including one $0.10 login")
print(f"sleep time alone at 1.5 s per call: about {total * 1.5 / 60:.0f} minutes")
cookies = "" if DRY_RUN else login() # one login for the whole run
if run("unlike", "/twitter/unlike_tweet_v2", liked, cookies):
run("unretweet", "/twitter/unretweet_tweet_v2", retweets, cookies)
print(f"log: {LOG_PATH}")
Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.
Questions readers ask
Can I bulk unlike all tweets I've ever liked via the X API?
Yes, one call per tweet. First get the IDs from your X data archive (data/like.js) or the official GET /2/users/{id}/liked_tweets. Then unlike each one with the official DELETE /2/users/{id}/likes/{tweet_id} or with twitterapi.io POST /twitter/unlike_tweet_v2. There is no single 'unlike all' endpoint on either API, and twitterapi.io has no endpoint that lists your likes.
How do I undo all my retweets programmatically?
List them, then undo them one at a time. To list, look up your numeric ID once with GET /twitter/user/info ($0.00018), then page GET /twitter/user/tweet_timeline on twitterapi.io with that userId and keep tweets that have a retweeted_tweet object, or use the official GET /2/users/{id}/tweets with tweet.fields=referenced_tweets. To undo, log in once with POST /twitter/user_login_v2 and call POST /twitter/unretweet_tweet_v2 with login_cookies, tweet_id (the original tweet's ID) and proxy, at $0.0006 per call, so 1,000 unretweets cost $0.70 including the login. If the account never retweeted a tweet, the call is a no-op and returns success. The official alternative is DELETE /2/users/{id}/retweets/{source_tweet_id} at $0.010 per request. Runnable Python is in Step 3 above.
What do I need to call /twitter/unlike_tweet_v2 or /twitter/unretweet_tweet_v2?
A twitterapi.io API key in the X-API-Key header, and a JSON body with login_cookies, tweet_id and proxy, all required; both endpoints take the same body. login_cookies is the value of the same name returned by POST /twitter/user_login_v2, which takes user_name, email, password, proxy and an optional totp_secret; one login covers the whole session. The proxy is your own residential proxy URL. The pricing page lists $0.0006 per unlike or unretweet call and $0.10 per login call. A call that X rejects (status: error) is not charged, and neither is an HTTP 400.
Do I need OAuth 2.0 or OAuth 1.0a for the official delete endpoints?
The official endpoints need user-context auth, meaning the call is made as your account and not as an app only. The X API reference for each endpoint lists the accepted methods (docs.x.com/x-api/posts/likes/introduction and docs.x.com/x-api/posts/retweets/introduction). In tweepy, passing consumer_key, consumer_secret, access_token and access_token_secret to tweepy.Client uses OAuth 1.0a user context. The twitterapi.io endpoints do not use OAuth at all; they use an API key plus login cookies.
Is bulk unlike or unretweet against X's terms of service?
Removing your own likes and retweets through the official API is a documented use of those endpoints. X's rules for automated activity are published at help.x.com/en/rules-and-policies/x-automation and they apply whichever tool you use, so read them before a large run. With twitterapi.io the actions run as your own logged-in account, and X can rate-limit, lock or suspend an account whose activity it treats as abusive. Keep the pace slow, only act on your own account, and be careful with any tool that asks for your password. That includes the twitterapi.io login endpoint: you are sharing credentials with a third party, so decide whether you are comfortable with that first.
How fast can I run the loop?
This guide uses a fixed 1.5 second pause between calls. That is a deliberately slow choice for this guide and not a published limit. At 1.5 seconds each, 10,000 calls means about 4.2 hours of waiting plus request time. The official DELETE endpoints have per-user rate limits listed at docs.x.com/x-api/fundamentals/rate-limits. The twitterapi.io spec states no limit for the write endpoints; the scripts stop after five failures in a row so you can read the log.
Can I re-like or re-retweet what I've bulk-unliked?
One at a time, yes, as long as the original tweet still exists. Neither API remembers what you used to like, so a bulk restore is only possible if you kept the ID list. Keep your X archive and the log file the script writes. twitterapi.io has /twitter/like_tweet_v2 and /twitter/retweet_tweet_v2 for the reverse actions, with the same body fields.
How does this compare to Redact or Circleboom for the same workflow?
Those are apps with a user interface: you grant account access and pick what to remove, without writing code. Their features, limits and prices are set by each vendor and change over time, so check their own sites. The API route takes more setup but gives you the ID list, the pacing and the log in your own hands. For a few dozen items, doing it by hand in the X app is the least effort.
Continue
- X API — Likes (docs.x.com, 2026)
- X API — Retweets (docs.x.com, 2026)
- X API — pricing (docs.x.com, 2026)
- X API — rate limits (docs.x.com, 2026)
- Tweepy documentation
- twitterapi.io — pricing
- twitterapi.io — OpenAPI spec (endpoints, parameters, per-result prices)
- twitterapi.io — Unretweet Tweet V2
- twitterapi.io — v2 write actions overview
- twitterapi.io — Get User Timeline
- X Help — How to download your X archive
- X Help — Automation rules
- Twitter (X) API — cluster hub
- Mass Delete Tweets — Bulk API + Free Tools
- Twitter (X) history API — export timeline
- Rate Limit Exceeded on Twitter (X) — Fixes
- Mass unfollow Twitter (X) API tutorial
- twitterapi.io pricing
- 01Gnip and Twitter (X) Data: PowerTrack, Decahose and What Replaced Them
- 02Twitter (X) and Puppeteer in 2026: What a Node.js Scraper Runs Into, and the API Route
- 03Twitter (X) with Playwright in 2026: What a Browser Script Gets, and the JSON Route in Python and Node
- 04Twitter (X) Bookmarks API: Read, Add, Remove and Export Bookmarks, Plus What bookmarkCount Reveals
- 05TweeterPy for Twitter (X): which calls need a login, what breaks, and how to port it to REST
- 06Download Twitter (X) Media — Bulk API Workflow (Photos + Videos)
- 07Twitter (X) Templates — Bulk Post via API
- 08Mass Delete Tweets — Bulk API Workflow + Free Tool Options
Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.
Stop reading. Start building.
Starter credits cover real testing on real data. Google sign-in, no card, no application queue.
Get an API keyAlready building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.