twitterapi

v0.1.2
io.github.pedrot95dev/twitterapi Checked 4 days ago Published 5 months ago

Read/write X (Twitter) via twitterapi.io: mentions, thread context, create and delete tweets.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_user_mentions Get user mentions

Fetch tweets mentioning a specific X/Twitter user. Makes a single request per call. The caller handles pagination by passing `cursor` (from a previous `next_cursor`).

ParameterTypeDescription
user_name *stringX username, with or without @
cursorstringPagination cursor from a previous response's next_cursor
limitintegerMax tweets to return from this single request (default 50)
query_typestringSort mode (default Latest)
since_timestringStart time filter (e.g. 2025-06-01 or ISO datetime)
until_timestringEnd time filter

get_tweet_thread_context Get tweet thread context

Fetch one page of the conversation thread around a tweet (to find links in context). Returns the original tweet, intermediate replies up the chain, the tweet itself, and its direct replies; each tweet includes `entities.urls` with expanded links. Makes exactly one request per call: pages are uneven (a page may be empty while `has_next_page` is true), so pass `next_cursor` back as `cursor` to fetch the next page.

ParameterTypeDescription
tweet_id *stringThe tweet ID to get the thread context for
cursorstringPagination cursor from a previous response's next_cursor

create_tweet Create tweet

Create or reply to a tweet via the v2 endpoint. Uses `login_cookies` built from the account's `auth_token`/`ct0` env vars (requires TWITTERAPI_IO_AUTH_TOKEN, TWITTERAPI_IO_CT0, TWITTERAPI_IO_PROXY).

ParameterTypeDescription
tweet_text *stringThe text content of the tweet
attachment_urlstringURL for quote (alternative to quote_tweet_id)
community_idstringPost inside a specific community
is_note_tweetbooleanAllow >280 chars (Premium accounts)
media_idsarrayMedia IDs from prior /twitter/upload_media_v2
quote_tweet_idstringTweet ID to quote
reply_to_tweet_idstringTweet ID to reply to (makes this a reply)
schedule_forstringISO-8601 future time e.g. 2026-01-20T10:00:00.000Z

delete_tweet Delete tweet

Delete a tweet by ID (must be owned by the logged-in account). Uses `login_cookies` built from the account's `auth_token`/`ct0` env vars.

ParameterTypeDescription
tweet_id *stringThe ID of the tweet to delete