Felo APIs
X Search API
搜尋 X 使用者、tweets、時間線和回覆,並返回分頁中繼資料。
/v2/x/tweet/search認證
Bearer API key
Content type
application/json
限流說明
1 request per 10 seconds, 3 per minute, 10 per 10 minutes.
本頁說明既有的 /v2 Felo APIs,使用 Felo 帳戶權益與 Pro 點數規則。是否扣除點數取決於 操作。若要使用平台餘額呼叫,請選擇支援的 Felo OpenAPI 端點;請求與回應格式可能不同。
X Search API 提供存取 X(Twitter)資料的能力,包括使用者個人檔案、推文搜尋、使用者推文與推文回覆。
與 AI 代理人一起使用
安裝完整的 felo-ai 套件,為 Agent 提供 X Search 與所有其他可用的 Felo Skill。安裝程式會動態探索每個包含 SKILL.md 的套件目錄,而不是維持固定的 Skill 清單。請將所有探索到的 Skills 安裝到 Codex ~/.codex/skills、Claude Code ~/.claude/skills、OpenClaw ~/.agents/skills,或 Hermes Agent ~/.hermes/skills。請參閱 手動 AI Agent 設定指南,了解各平台的安裝、API 金鑰與驗證說明。
驗證
所有請求都需要在 Authorization 標頭中提供 API Key:
Authorization: Bearer YOUR_API_KEY1. 取得使用者資訊
依 username 批次擷取 X 使用者個人檔案。
端點
POST https://openapi.felo.ai/v2/x/user/info請求主體
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
usernames | array of strings | 是 | 要查詢的 X usernames 清單 |
範例
curl -X POST 'https://openapi.felo.ai/v2/x/user/info' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"usernames": ["elonmusk", "OpenAI"]
}'成功回應(200)
{
"status": 200,
"code": "OK",
"request_id": "req_example",
"message": null,
"data": {
"total": 2,
"users": [
{
"user_id": "44196397",
"username": "elonmusk",
"display_name": "Elon Musk",
"description": "...",
"followers_count": 100000000,
"following_count": 500,
"tweet_count": 30000,
"verified": true,
"blue_verified": true,
"profile_image_url": "https://pbs.twimg.com/...",
"created_at": "2009-06-02T00:00:00Z",
"location": "Mars"
}
]
}
}使用者物件欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
user_id | string | X user ID |
username | string | X handle(不含 @) |
display_name | string | 顯示名稱 |
description | string | 使用者簡介 |
followers_count | integer | 追蹤者數量 |
following_count | integer | 追蹤中數量 |
tweet_count | integer | 推文總數 |
verified | boolean | 帳號是否已驗證 |
blue_verified | boolean | 帳號是否具備 Blue 驗證 |
verified_type | string | 驗證類型 |
profile_image_url | string | 個人圖片 URL |
cover_image_url | string | 封面圖片 URL |
created_at | string | 帳號建立時間 |
location | string | 使用者位置 |
url | string | 使用者網站 URL |
protected | boolean | 帳號是否受保護 |
favorites_count | integer | 喜歡數量 |
media_count | integer | 媒體貼文數量 |
can_dm | boolean | 是否可傳送私訊 |
is_automated | boolean | 帳號是否自動化 |
pinned_tweet_ids | array of strings | 置頂推文 ID |
2. 搜尋使用者
依關鍵字搜尋 X 使用者。
端點
POST https://openapi.felo.ai/v2/x/user/search請求主體
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
query | string | 是 | 搜尋關鍵字 |
cursor | string | 否 | 前一個回應中的分頁游標 |
範例
curl -X POST 'https://openapi.felo.ai/v2/x/user/search' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "artificial intelligence"
}'成功回應(200)
{
"status": 200,
"code": "OK",
"request_id": "req_example",
"message": null,
"data": {
"total": 50,
"has_next": true,
"next_cursor": "cursor_abc123",
"users": [
{
"user_id": "...",
"username": "...",
"display_name": "..."
}
]
}
}回應欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
total | integer | 結果總數 |
has_next | boolean | 是否還有更多結果 |
next_cursor | string | 下一頁游標 |
users | array | 使用者物件清單(見第 1 節) |
3. 取得使用者推文
擷取特定 X 使用者的推文。
端點
POST https://openapi.felo.ai/v2/x/user/tweets請求主體
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
x_user_id | string | 否 | X user ID(請提供 x_user_id 或 username 其一) |
username | string | 否 | X username(請提供 x_user_id 或 username 其一) |
limit | integer | 否 | 要回傳的推文數量 |
cursor | string | 否 | 分頁游標 |
include_replies | boolean | 否 | 是否包含回覆 |
範例
curl -X POST 'https://openapi.felo.ai/v2/x/user/tweets' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"username": "elonmusk",
"limit": 20
}'成功回應(200)
{
"status": 200,
"code": "OK",
"request_id": "req_example",
"message": null,
"data": {
"total": 20,
"has_next": true,
"next_cursor": "cursor_def456",
"tweets": [
{
"id": "1234567890",
"content": "Tweet content here...",
"author": { "user_id": "...", "username": "elonmusk" },
"created_at": "2026-03-09T12:00:00Z",
"metrics": {
"retweet_count": 1000,
"favorite_count": 5000,
"reply_count": 200,
"quote_count": 100,
"view_count": 500000,
"bookmark_count": 50
},
"hashtags": ["AI"],
"mentions": ["OpenAI"],
"url": "https://x.com/elonmusk/status/1234567890",
"lang": "en"
}
]
}
}推文物件欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
id | string | 推文 ID |
content | string | 推文文字內容 |
author | object | 作者使用者物件(見第 1 節) |
created_at | string | 推文建立時間 |
metrics | object | 互動指標(見下方) |
replies | array | 回覆推文(若有) |
conversation_id | string | 對話串 ID |
media_urls | array | 附加媒體 |
hashtags | array of strings | 推文中的 hashtags |
mentions | array of strings | 被提及的使用者名稱 |
urls | array of strings | 推文中的 URL |
url | string | 推文永久連結 |
source | string | 推文來源(例如 "Twitter Web App") |
lang | string | 推文語言代碼 |
is_reply | boolean | 是否為回覆 |
in_reply_to_id | string | 被回覆推文的 ID |
in_reply_to_user_id | string | 被回覆推文的使用者 ID |
in_reply_to_username | string | 被回覆推文的 username |
quoted_tweet | object | 被引用的推文物件(遞迴) |
retweeted_tweet | object | 被轉貼的推文物件(遞迴) |
is_limited_reply | boolean | 回覆是否受限 |
指標物件欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
retweet_count | integer | 轉推數 |
favorite_count | integer | 喜歡數 |
reply_count | integer | 回覆數 |
quote_count | integer | 引用數 |
view_count | integer | 瀏覽數 |
bookmark_count | integer | 書籤數 |
4. 搜尋推文
使用進階查詢支援依關鍵字搜尋 X 推文。
端點
POST https://openapi.felo.ai/v2/x/tweet/search請求主體
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
query | string | 是 | 搜尋查詢(支援進階搜尋語法) |
query_type | string | 否 | 查詢類型篩選 |
since_time | integer | 否 | 開始時間篩選(Unix 秒時間戳) |
until_time | integer | 否 | 結束時間篩選(Unix 秒時間戳) |
limit | integer | 否 | 要回傳的推文數量 |
cursor | string | 否 | 分頁游標 |
範例
curl -X POST 'https://openapi.felo.ai/v2/x/tweet/search' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "artificial intelligence",
"limit": 20
}'成功回應(200)
{
"status": 200,
"code": "OK",
"request_id": "req_example",
"message": null,
"data": {
"total": 20,
"has_next": true,
"next_cursor": "cursor_ghi789",
"tweets": [
{
"id": "...",
"content": "...",
"author": { "user_id": "...", "username": "..." },
"created_at": "2026-03-09T12:00:00Z",
"metrics": { "retweet_count": 100, "favorite_count": 500 }
}
]
}
}回應欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
total | integer | 結果總數 |
has_next | boolean | 是否還有更多結果 |
next_cursor | string | 下一頁游標 |
tweets | array | 推文物件清單(見第 3 節) |
5. 取得推文回覆
擷取特定推文的回覆。
端點
POST https://openapi.felo.ai/v2/x/tweet/replies請求主體
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
tweet_ids | array of strings | 是 | 要取得回覆的推文 ID |
cursor | string | 否 | 分頁游標 |
since_time | integer | 否 | 開始時間篩選(Unix timestamp) |
until_time | integer | 否 | 結束時間篩選(Unix timestamp) |
範例
curl -X POST 'https://openapi.felo.ai/v2/x/tweet/replies' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"tweet_ids": ["1234567890"]
}'成功回應(200)
{
"status": 200,
"code": "OK",
"request_id": "req_example",
"message": null,
"data": {
"results": [
{
"tweet_id": "1234567890",
"total": 10,
"has_next": true,
"next_cursor": "cursor_jkl012",
"replies": [
{
"id": "...",
"content": "Great tweet!",
"author": { "user_id": "...", "username": "..." },
"created_at": "2026-03-09T12:30:00Z"
}
]
}
]
}
}回應欄位
| 欄位 | 類型 | 說明 |
|---|---|---|
results | array | 回覆結果物件清單 |
results[].tweet_id | string | 原始推文 ID |
results[].total | integer | 回覆總數 |
results[].has_next | boolean | 是否還有更多回覆 |
results[].next_cursor | string | 下一頁游標 |
results[].replies | array | 回覆推文物件清單(見第 3 節) |
錯誤代碼
| 代碼 | HTTP 狀態 | 說明 |
|---|---|---|
INVALID_API_KEY | 401 | API Key 無效或已撤銷 |
X_SEARCH_INVALID_PARAMETER | 400 | 請求參數無效 |
X_SEARCH_PRO_REQUIRED | 403 | 使用 X API 需要 PRO 訂閱 |
X_SEARCH_FORBIDDEN | 403 | 你無權存取此資源 |
X_SEARCH_NOT_FOUND | 404 | 找不到要求的資源 |
INSUFFICIENT_CREDITS | 402 | 點數不足,無法完成請求 |
RATE_LIMITED | 429 | 請求過多,請在短暫延遲後重試 |
X_SEARCH_FAILED | 400/502/503 | X 搜尋請求失敗(未分類的用戶端錯誤、下游失敗,或無法驗證訂閱狀態) |
當有可用的下游錯誤訊息時,message 欄位會原樣承載該訊息,因此 402 會顯示為 Insufficient credits available,而不是一般性的失敗。
訂閱需求
所有 X 端點都需要有效的 PRO 訂閱。來自免費帳戶的請求會以 HTTP 403 與代碼 X_SEARCH_PRO_REQUIRED 被拒絕,不論點數餘額為何——加值點數不會授予存取權,升級訂閱才會。
如果無法連線到訂閱服務,請求會以 HTTP 503 失敗,而不會被視為免費帳戶,因此短暫中斷不會悄悄降級已付費的客戶。請稍後重試。
點數與速率限制
點數成本
每次 API 呼叫會依回傳結果數量扣除點數:
| 端點 | 點數成本 |
|---|---|
POST /x/user/info | 每回傳 1 位使用者扣 1 點 |
POST /x/user/search | 每回傳 1 位使用者扣 1 點 |
POST /x/user/tweets | 每回傳 1 則推文扣 1 點 |
POST /x/tweet/search | 每回傳 1 則推文扣 1 點 |
POST /x/tweet/replies | 每回傳 1 則回覆扣 1 點 |
點數會在請求完成後,依實際結果數量扣除。若請求回傳 0 筆結果,則不會扣除點數。
最低餘額需求: 你的帳戶至少必須有 10 點才能發出任何 X API 請求。點數少於 10 點的請求會以 HTTP 402 拒絕。
速率限制
這些端點沒有低餘額速率限制:它只曾適用於免費帳戶,而免費帳戶現在已無法存取 X API(請見 訂閱需求)。PRO 訂閱者無論點數餘額多少,都不受速率限制。
當受到速率限制時,API 會回傳 HTTP 429。Retry-After 標頭會指出建議等待的秒數。