How to Like a Tweet via API in 2026 (No Dev Account)
Like (favorite) tweets programmatically via API in 2026 without an X developer account. The auth_token model, working curl, Python, and Node code, and per-call cost.
Liking a tweet programmatically sounds trivial, and it is, once you get past the official X API's setup. Developers reach for a like (favorite) endpoint to power engagement bots, reward loops that thank users who mention a brand, "auto-like replies to my posts" workflows, and growth tooling that engages with a filtered feed. The action itself is one HTTP call. The friction is everything the official path wraps around it.
This guide shows how to like a tweet via API in 2026 without an X developer account: the auth_token model that authorizes the action, working code in curl, Python, and Node, how to like tweets in bulk safely, and the errors worth handling. A like call costs $0.001.
What the like endpoint lets you do
A programmatic like is a small primitive that shows up in a lot of engagement workflows:
- Engagement bots. Automatically like replies to your own posts, or like tweets that mention your brand, so your account stays visibly active without a human in the loop.
- Reward loops. Thank users who share your content or use your hashtag by liking their post, a lightweight signal that scales better than replying to everyone.
- Curated feeds. Pull tweets from a search query or a list, filter by your own criteria, and like the ones that match, useful for community management and topic monitoring.
- Growth tooling. Combine likes with follows and replies in a paced engagement routine. The building block for a Twitter bot is exactly this kind of single-action call.
Because each like is its own call at $0.001, you can model cost directly by volume: 1,000 likes is $1, 10,000 likes is $10.
The problem with the official X API for likes
Since February 2026, X replaced its fixed pricing tiers with a pay-per-use model, and write actions like a favorite still sit behind the full developer stack: an approved account, an app, and an OAuth 2.0 PKCE flow with the like.write scope. That is a lot of scaffolding for a one-line action.
| Requirement | Official X API | GetXAPI |
|---|---|---|
| Developer account | Required (approval needed) | Not required |
| Auth flow | OAuth 2.0 PKCE, three-legged | One Bearer key + registered auth_token |
| Scopes to configure | like.write, token refresh loop |
None |
| Endpoint | POST /2/users/:id/likes |
POST /twitter/tweet/favorite |
| Cost per like | Bundled into pay-per-use request pricing | $0.001 flat |
| Time to first call | Hours to days (approval) | Under a minute |
The third-party route collapses the OAuth handshake into a single registered session, so there is no redirect server, no consent screen, and no token-refresh loop to maintain.
Start building with GetXAPI
$0.05 per 1,000 tweets. $0.10 free credits. No credit card required.
The auth_token model in one paragraph
A like acts on behalf of a specific account, so the API needs that account's session to authorize it. That session is the auth_token, the cookie X sets in your browser to keep you logged in. You register it once against your GetXAPI account, and from then on every write call is gated by your API key and tied to that registered X account. The token is used in-flight and never stored. This is the same model used for posting, replying, following, and sending DMs, covered in depth in the post tweets via API guide.
Like a tweet via API: curl, Python, Node
Grab an API key from the API key page (30-second signup, $0.10 in free credits), register your account's auth_token once, then the call is the same everywhere. You need the numeric tweet_id of the post you want to like.
curl
curl -X POST https://api.getxapi.com/twitter/tweet/favorite \
-H "Authorization: Bearer $GETXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"tweet_id": "1799999999999999999"}'
Python
import requests
API_KEY = "YOUR_GETXAPI_KEY"
def like_tweet(tweet_id: str) -> dict:
resp = requests.post(
"https://api.getxapi.com/twitter/tweet/favorite",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"tweet_id": tweet_id},
timeout=15,
)
resp.raise_for_status()
return resp.json()
print(like_tweet("1799999999999999999"))
Node
async function likeTweet(tweetId) {
const res = await fetch("https://api.getxapi.com/twitter/tweet/favorite", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GETXAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ tweet_id: tweetId }),
});
if (!res.ok) {
throw new Error(`Like failed: ${res.status}`);
}
return res.json();
}
likeTweet("1799999999999999999").then(console.log);
That is the whole thing: a Bearer header, a JSON body with tweet_id, and a POST.
Like every tweet matching a search
The common real workflow is not liking one tweet, it is liking a filtered stream of them. Pull results from the search endpoint, then like each one with a short delay so the sequence does not look like a burst.
import time
import requests
API_KEY = "YOUR_GETXAPI_KEY"
BASE = "https://api.getxapi.com"
def search(query: str) -> list[dict]:
r = requests.post(
f"{BASE}/twitter/tweet/advanced_search",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"query": query, "product": "Latest"},
timeout=15,
)
r.raise_for_status()
return r.json().get("tweets", [])
def like(tweet_id: str) -> None:
r = requests.post(
f"{BASE}/twitter/tweet/favorite",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"tweet_id": tweet_id},
timeout=15,
)
r.raise_for_status()
for tweet in search("getxapi"):
like(tweet["id"])
time.sleep(2) # pace it so the account stays safe
The time.sleep(2) is the important line. GetXAPI has no platform-level rate cap, so the throttle you write is the one that keeps the account from tripping X's own anti-spam systems.
The cheapest Twitter API. Try it free.
$0.05 per 1,000 tweets. $0.10 free credits. No credit card required.
Handling errors
Three status codes cover almost everything you will see on the like endpoint:
- 401 Unauthorized. Bad or expired credentials, usually a stale
auth_tokenthat needs re-registering. It is not a retry situation, fix the token. - 403 Forbidden. The action is not allowed: the tweet is from a protected account you do not follow, it was deleted, or you have already liked it. Log and skip.
- 429 Too Many Requests. X itself throttled the account for action velocity. Back off with exponential delay and retry after the window resets. The rate limits guide has the backoff pattern.
Wrap every call in a try/except (or try/catch), read the status code, and branch on it. Retrying a 401 or 403 will never succeed; only the 429 is worth a retry.
Cost and rate limits
A like is $0.001 per call, flat. There is no platform-level rate limit on the GetXAPI side, so throughput is bounded by your credits and by whatever pacing you set to stay inside X's automation rules, not by a per-endpoint window. For the full economics of engagement automation, see the pricing page and the live cost calculator.
Related write actions
Liking is one of a family of single-action write calls that all share the same Bearer-key-plus-auth_token pattern. Retweeting is POST /twitter/tweet/retweet, bookmarking is POST /twitter/tweet/bookmark, and posting or replying is covered in the post tweets via API guide. If you are building a full engagement routine, combine them with reads like follower export and search to decide what to engage with in the first place.
Frequently Asked Questions
Yes. The official X API requires an approved developer account on developer.x.com plus a paid write tier to like posts programmatically. A third-party write API skips both. With GetXAPI you register the X account you want to act from once (using its auth_token), then call POST /twitter/tweet/favorite with a single Bearer key and a tweet_id. There is no developer-portal application and no OAuth handshake. A like call costs $0.001. See the [pricing page](/pricing) for the full rate card.
Yes. A like is a write action that happens on behalf of a specific account, so the API needs that account's session to authorize it. The auth_token is the cookie X sets in your browser to keep you logged in. You register it once against your GetXAPI account, and every write call is then gated by your API key and tied to that registered X account. The token is used in-flight and never stored. Read-only calls do not need it.
The three you will hit most are 401 (bad or expired credentials, usually a stale auth_token that needs re-registering), 403 (the action is not allowed, for example the tweet is protected or already liked), and 429 (rate limited by X, back off and retry after the window resets). Wrap every call in a try/except, read the status code, and treat 429 with exponential backoff. The [rate limits guide](/twitter-api-rate-limits) covers the backoff math.
Through GetXAPI, a like (favorite) call costs $0.001, one of the cheapest actions on the rate card. At 10,000 likes a month that is $10. The $0.10 in free credits you get at signup covers 100 test likes before you pay anything. Model your exact mix with the [cost calculator](/twitter-api-cost-calculator).
You can, but pace them. X suspends accounts for action velocity (too many likes in a short window) and bot-like patterns, not for using an API specifically. Stay safe by spreading likes out (a few per minute, not hundreds in a burst), only liking relevant content, and warming a new account before automating it. X publishes its [automation rules](https://help.x.com/en/rules-and-policies/x-automation); following them matters more than which API you use. There is no platform-level rate cap on the GetXAPI side, so the throttle you set is the one that keeps the account safe.
All three, because the API is plain HTTP. The same POST /twitter/tweet/favorite call works from Python requests, Node fetch, Go, Ruby, or a raw curl command, since the only requirements are a Bearer header and a JSON body with the tweet_id. This guide shows all three.
Check out similar blogs
More guides on the Twitter/X API, scraping, and pricing.







