- like - Like a Tweet
- unlike - Unlike a Tweet
- retweet - Retweet a Tweet
- unretweet - Delete Retweet
- create_thread - Create a Tweet Thread
- create - Create a Tweet or Reply
- quote - Create a Quote Tweet
- create_without_cookie - Post Tweet (Auto Cookie)
- bookmark - Bookmark a Tweet
- unbookmark - Delete Bookmark
- delete_batch - Delete One or More Tweets
Likes a specific tweet on behalf of the user associated with the provided cookie,$0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.like(tweet_id="<id>", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", proxy="http://username:password@ip:port")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_id |
str | ✔️ | The numeric ID of the tweet to like. | |
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
proxy |
OptionalNullable[str] | ➖ | The proxy to use.Please use high-quality residential proxies and avoid free proxies.Required.Example: http://username:password@ip:port . You can get proxy from: https://app.proxy-cheap.com/r/qiMxub | http://username:password@ip:port |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Unlike a tweet, $0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.unlike(tweet_id="<id>", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_id |
str | ✔️ | The ID of the tweet to delete. | |
cookie |
str | ✔️ | The user's Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Retweets a specific tweet on behalf of the user associated with the provided cookie,$0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.retweet(tweet_id="<id>", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", proxy="http://username:password@ip:port")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_id |
str | ✔️ | The ID of the tweet to retweet. | |
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
proxy |
OptionalNullable[str] | ➖ | The proxy to use.Please use high-quality residential proxies and avoid free proxies.Required.Example: http://username:password@ip:port . You can get proxy from: https://app.proxy-cheap.com/r/qiMxub | http://username:password@ip:port |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Delete a retweet, $0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.unretweet(tweet_id="<id>", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_id |
str | ✔️ | The ID of the tweet to delete. | |
cookie |
str | ✔️ | The user's Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Create a tweet thread from an ordered list of texts, $0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.create_thread(items=[
"1/ hello",
"2/ world",
], cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", proxy="http://username:password@ip:port")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
items |
List[str] | ✔️ | JSON array of tweet texts, e.g. ["1/ hello","2/ world"]. | [ "1/ hello", "2/ world" ] |
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
proxy |
OptionalNullable[str] | ➖ | Optional HTTP proxy. Example: http://username:password@ip:port | http://username:password@ip:port |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Posts a new tweet. To create a reply, provide the reply_tweet_id. This endpoint does not handle quote tweets,$0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.create(tweet_content="Hello, Twitter! 🐦", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", media_url="https://example.com/image.jpg", media_urls=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg",
], delegated_account_username="elonmusk", schedule="2024-01-01T12:00:00Z", reply_tweet_id="1234567890123456789", community_name="Python Developers or 1234567890123456789", proxy="http://username:password@ip:port")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_content |
str | ✔️ | Content of the tweet to post | Hello, Twitter! 🐦 |
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
media_url |
OptionalNullable[str] | ➖ | Single media URL: image, GIF, or video. Prefer media_urls for multiple images. | https://example.com/image.jpg |
media_urls |
List[str] | ➖ | Media URLs to attach (max 4 images, or 1 GIF, or 1 video). Cannot mix GIF/video with other media. | [ "https://example.com/image1.jpg", "https://example.com/image2.jpg" ] |
delegated_account_username |
OptionalNullable[str] | ➖ | delegated account username | elonmusk |
schedule |
OptionalNullable[str] | ➖ | Schedule time for the tweet in ISO format | 2024-01-01T12:00:00Z |
reply_tweet_id |
OptionalNullable[str] | ➖ | ID of tweet to reply to | 1234567890123456789 |
community_name |
OptionalNullable[str] | ➖ | Name of Twitter community to post in or community id | Python Developers or 1234567890123456789 |
proxy |
OptionalNullable[str] | ➖ | The proxy to use.Please use high-quality residential proxies and avoid free proxies.Required.Example: http://username:password@ip:port . You can get proxy from: https://app.proxy-cheap.com/r/qiMxub | http://username:password@ip:port |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Posts a new tweet that quotes an existing tweet. Requires the URL of the tweet to be quoted and the new content,$0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.quote(tweet_content="Hello, Twitter! 🐦", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", media_url="https://example.com/image.jpg", media_urls=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg",
], delegated_account_username="elonmusk", community_name="Python Developers or 1234567890123456789", quote_tweet_url="https://twitter.com/user/status/1234567890123456789", proxy="http://username:password@ip:port")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_content |
str | ✔️ | Content of the tweet to post | Hello, Twitter! 🐦 |
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
media_url |
OptionalNullable[str] | ➖ | Single media URL: image, GIF, or video. Prefer media_urls for multiple images. | https://example.com/image.jpg |
media_urls |
List[str] | ➖ | Media URLs to attach (max 4 images, or 1 GIF, or 1 video). Cannot mix GIF/video with other media. | [ "https://example.com/image1.jpg", "https://example.com/image2.jpg" ] |
delegated_account_username |
OptionalNullable[str] | ➖ | delegated account username | elonmusk |
community_name |
OptionalNullable[str] | ➖ | Name of Twitter community to post in or community id | Python Developers or 1234567890123456789 |
quote_tweet_url |
OptionalNullable[str] | ➖ | URL of tweet to quote | https://twitter.com/user/status/1234567890123456789 |
proxy |
OptionalNullable[str] | ➖ | The proxy to use.Please use high-quality residential proxies and avoid free proxies.Required.Example: http://username:password@ip:port . You can get proxy from: https://app.proxy-cheap.com/r/qiMxub | http://username:password@ip:port |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Post a tweet using a random cookie from the pool, cookie management $0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.create_without_cookie(tweet_content="Hello, Twitter! 🐦", media_url="https://example.com/image.jpg", media_urls=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg",
], schedule="2024-01-01T12:00:00Z", reply_tweet_id="1234567890123456789", community_name="Python Developers or 1234567890123456789", quote_tweet_url="https://twitter.com/user/status/1234567890123456789")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_content |
str | ✔️ | Content of the tweet to post | Hello, Twitter! 🐦 |
media_url |
OptionalNullable[str] | ➖ | Single media URL: image, GIF, or video. Prefer media_urls for multiple images. | https://example.com/image.jpg |
media_urls |
List[str] | ➖ | Media URLs to attach (max 4 images, or 1 GIF, or 1 video). Cannot mix GIF/video with other media. | [ "https://example.com/image1.jpg", "https://example.com/image2.jpg" ] |
schedule |
OptionalNullable[str] | ➖ | Schedule time for the tweet in ISO format | 2024-01-01T12:00:00Z |
reply_tweet_id |
OptionalNullable[str] | ➖ | ID of tweet to reply to | 1234567890123456789 |
community_name |
OptionalNullable[str] | ➖ | Name of Twitter community to post in or community id | Python Developers or 1234567890123456789 |
quote_tweet_url |
OptionalNullable[str] | ➖ | URL of tweet to quote | https://twitter.com/user/status/1234567890123456789 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Adds a specific tweet to the bookmarks of the user associated with the provided cookie,$0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.bookmark(tweet_id="<id>", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", proxy="http://username:password@ip:port")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_id |
str | ✔️ | The ID of the tweet to bookmark. | |
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
proxy |
OptionalNullable[str] | ➖ | The proxy to use.Please use high-quality residential proxies and avoid free proxies.Required.Example: http://username:password@ip:port . You can get proxy from: https://app.proxy-cheap.com/r/qiMxub | http://username:password@ip:port |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Delete a bookmark, $0.001 per call.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.unbookmark(tweet_id="<id>", cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
tweet_id |
str | ✔️ | The ID of the tweet to delete. | |
cookie |
str | ✔️ | The user's Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |
Deletes one or more tweets from a specified user account. This endpoint supports two modes:
- Single Tweet Deletion: Provide a
target_idto delete a specific tweet. - Bulk Deletion: Omit the
target_idto delete all tweets from the user's account.
Warning: The bulk deletion mode is irreversible and will permanently remove all tweets from the account. Use with extreme caution.
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.tweets.actions.delete_batch(cookie="ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7", username="myusername", target_id="1234567890123456789")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
cookie |
str | ✔️ | Twitter authentication cookie or Twitter auth_token, how-to-get-twitter-cookie | ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7 |
username |
str | ✔️ | Twitter username whose tweets to delete | myusername |
target_id |
OptionalNullable[str] | ➖ | Specific tweet ID to delete (if not provided, deletes all user tweets) | 1234567890123456789 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XapiScraperDefaultError | 4XX, 5XX | */* |