From x-api
Interact with the X (Twitter) API v2 using curl commands. Use this skill to look up user profiles, search recent posts, retrieve tweets, get user timelines, and explore other public X API v2 endpoints.
How this skill is triggered — by the user, by Claude, or both
Slash command
/x-api:x-apiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use curl commands to interact with the X (Twitter) API v2. This skill covers read-only, public endpoints that do not require an authenticated user context — things like looking up profiles, searching recent posts, and retrieving tweets.
Use curl commands to interact with the X (Twitter) API v2. This skill covers read-only, public endpoints that do not require an authenticated user context — things like looking up profiles, searching recent posts, and retrieving tweets.
Authentication assumption: The environment variable X_BEARER_TOKEN must already be set with a valid X API v2 Bearer Token. All commands below rely on it.
All requests follow this pattern:
curl "<endpoint_url>" \
-H "Authorization: Bearer $X_BEARER_TOKEN"
For any endpoint that returns tweets, always include note_tweet in tweet.fields so long posts return full content.
Always write API responses to a file first, then read/search only the fields you need. Do not paste large raw JSON directly into chat output.
# 1) Store response
curl -sS "<endpoint_url>" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_api_response.json
# 2) Inspect or extract specific fields
jq '.' /tmp/x_api_response.json
jq '.data' /tmp/x_api_response.json
jq -r '.data[]?.text' /tmp/x_api_response.json
rg -n "next_token|id|username" /tmp/x_api_response.json
If the response is large, summarize using targeted jq queries (counts, IDs, timestamps, specific text fields) instead of returning entire payloads.
curl -sS "https://api.x.com/2/users/by/username/xdevelopers" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_user_profile.json
jq '.data' /tmp/x_user_profile.json
curl -sS "https://api.x.com/2/users/by/username/xdevelopers?user.fields=created_at,description,public_metrics" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_user_profile_fields.json
jq '.data | {id,username,created_at,description,public_metrics}' /tmp/x_user_profile_fields.json
Common user.fields: created_at, description, entities, id, location, name, pinned_tweet_id, profile_image_url, protected, public_metrics, url, username, verified, withheld.
curl -sS "https://api.x.com/2/tweets/1460323737035677698?tweet.fields=note_tweet,created_at,public_metrics" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_tweet_lookup.json
jq '.data | {id,created_at,text,note_tweet,public_metrics}' /tmp/x_tweet_lookup.json
Common tweet.fields: note_tweet, attachments, author_id, conversation_id, created_at, entities, id, in_reply_to_user_id, lang, public_metrics, referenced_tweets, source, text, withheld.
curl -sS "https://api.x.com/2/tweets/search/recent?query=from:xdevelopers&tweet.fields=note_tweet,created_at" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_recent_search.json
jq -r '.data[]? | [.id, .created_at, (.note_tweet.text // .text)] | @tsv' /tmp/x_recent_search.json
The query parameter supports the full X search query syntax. Examples:
from:username — posts from a specific userto:username — replies to a specific user"exact phrase" — posts containing an exact phrasekeyword1 keyword2 — posts containing both keywordskeyword1 OR keyword2 — posts containing either keyword#hashtag — posts with a specific hashtaghas:media — posts that contain mediahas:links — posts that contain linkslang:en — posts in a specific languagecurl -sS "https://api.x.com/2/users/2244994945/tweets?max_results=5&tweet.fields=note_tweet" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_user_tweets.json
jq -r '.data[]? | [.id, (.note_tweet.text // .text)] | @tsv' /tmp/x_user_tweets.json
You can add more tweet.fields, max_results (5-100), and pagination tokens to customize the response, but always keep note_tweet included.
curl -sS "https://api.x.com/2/users/2244994945/mentions?max_results=5&tweet.fields=note_tweet,created_at,author_id" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_user_mentions.json
jq -r '.data[]? | [.id, .author_id, .created_at, (.note_tweet.text // .text)] | @tsv' /tmp/x_user_mentions.json
curl -sS "https://api.x.com/2/users/by?usernames=xdevelopers,twitterdev&user.fields=description,public_metrics" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_users_by_username.json
jq '.data[] | {id,username,description,public_metrics}' /tmp/x_users_by_username.json
curl -sS "https://api.x.com/2/tweets/counts/recent?query=from:xdevelopers" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_tweet_counts.json
jq '.meta, .data[:5]' /tmp/x_tweet_counts.json
Returns the count of tweets matching the query, grouped by time period.
curl -sS "https://api.x.com/2/users/2244994945/followers?max_results=10&user.fields=description,public_metrics" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_followers.json
jq '.data[] | {id,username,public_metrics}' /tmp/x_followers.json
curl -sS "https://api.x.com/2/users/2244994945/following?max_results=10&user.fields=description,public_metrics" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_following.json
jq '.data[] | {id,username,public_metrics}' /tmp/x_following.json
# Get list details
curl -sS "https://api.x.com/2/lists/84839422" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_list_details.json
jq '.data' /tmp/x_list_details.json
# Get list members
curl -sS "https://api.x.com/2/lists/84839422/members?user.fields=description,public_metrics" \
-H "Authorization: Bearer $X_BEARER_TOKEN" \
-o /tmp/x_list_members.json
jq '.data[] | {id,username,public_metrics}' /tmp/x_list_members.json
id field from the response.expansions to include related objects in the response. For example, expansions=author_id on a tweet lookup will include the author's user object.next_token field. Pass it as pagination_token in the next request.curl -sS -o <file> with follow-up jq filters so output remains compact and targeted.Full OpenAPI specification: https://api.x.com/2/openapi.json
The X_BEARER_TOKEN environment variable must be set with a valid Bearer Token. This token provides app-only authentication, which grants access to public read-only endpoints.
To obtain a Bearer Token, create a project and app in the X Developer Portal and generate a Bearer Token from your app's "Keys and tokens" settings.
npx claudepluginhub superconductor/superconductor-plugin-marketplace --plugin x-apiReads public X/Twitter data through UnifAPI — profiles, posts, engagement, followers/following, search, autocomplete, and trends. Read-only, never posts.
Searches X (Twitter) for users, tweets, trending topics, and replies via the Felo X Search API. Use with explicit commands or when users ask about X/Twitter data.
Fetches recent tweets from a specific X/Twitter user via the X API. Requires X_BEARER_TOKEN.