rest_idinteger
User ID, for example: 44196397, if the user ID is used, the username will be ignored, only one of them can be selected.
https://api.sandbase.ai/v1/api/twitter/web/user-profileGet a Twitter / X user profile by screen name or user ID: name, bio, follower and following counts, post and media counts, verification and creation date.
[
{
"data": {
"affiliates": null,
"avatar": null,
"blue_verified": null,
"business_account": null,
"created_at": null,
"desc": null,
"friends": null,
"header_image": null,
"id": null,
"location": null,
"media_count": null,
"name": null,
"pinned_tweet_ids_str": null,
"profile": null,
"protected": null,
"rest_id": null,
"status": "notfound",
"statuses_count": null,
"sub_count": null,
"verification_type": null
}
}
]選擇一個範例,將其輸入與結果載入 playground。
Returns the public profile of a Twitter / X account: name, bio, location, website, verification status, creation date and activity counts. Send either screen_name (for example NASA) or the numeric rest_id.
rest_id for use in other calls.sub_count and statuses_count on a schedule to chart account growth.curl -X POST "https://api.sandbase.ai/v1/api/twitter/web/user-profile" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"screen_name": "NASA"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
rest_id | integer | No | User ID, for example: 44196397, if the user ID is used, the username will be ignored, only one of them can be selected. |
screen_name | string | No | Screen Name, for example: elonmusk, can be obtained from the user's homepage link, for example: elonmusk in https://twitter.com/elonmusk |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"affiliates": [],
"avatar": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"blue_verified": true,
"business_account": {
"affiliates_count": 85
},
"created_at": "Wed Dec 19 20:20:32 +0000 2007",
"desc": "Making the seemingly impossible, possible. ✨",
"friends": 115,
"header_image": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
"id": "11348282",
"location": "Pale Blue Dot",
"media_count": 28223,
"name": "NASA"
}
| Field | Meaning |
|---|---|
rest_id / id | Numeric user ID of the account, returned as a string. It stays the same if the handle changes. |
name / profile | Display name of the account. In this response both fields hold NASA. |
desc | Bio text of the account. |
sub_count | Follower count of the account. |
friends | Number of accounts this user follows. |
statuses_count / media_count | Total number of posts and total number of media posts for the account. |
blue_verified / verification_type | blue_verified is a displayed verification flag, not independent proof of payment or identity. verification_type gives the kind of verification, such as Government. |
created_at | Date and time the account was created, in the format Wed Dec 19 20:20:32 +0000 2007. |
pinned_tweet_ids_str[] | IDs of the tweets pinned to the profile, as strings. |
avatar / header_image / website / location | Profile image URL, banner image URL, website link and free-text location from the profile. |
rest_id, the API ignores screen_name.screen_name from the profile URL. For https://twitter.com/elonmusk, use elonmusk.pinned_tweet_ids_str[] to Twitter Tweet Detail to read the pinned post.$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Send screen_name with a bare handle, such as NASA, when that is the account identifier you have. The alternative rest_id is an integer; it is not the camel-case restId string used by the other route. Choose one identifier. The contract says rest_id overrides screen_name when both are sent, so do not combine a new handle with an unrelated saved ID.
The selected full saved example was created on August 20, 2026 with an empty input object. Its business status is notfound and its identity and counters are null. It is negative evidence, not a successful NASA lookup. The NASA-shaped response in the shortened README is a separate, undated reference. A valid teaching body with screen_name does not retroactively turn that saved empty-input request into a tested success.
Check the returned string rest_id or id and preserve the selected handle with it. Reject missing identity and conflicting returned IDs before storing a successful record. A handle can change; do not merge unrelated profiles merely because display names match. Store exact IDs as strings. For JavaScript integer rest_id inputs, reject unsafe integers before serialization; converting an already rounded Number to a string cannot recover the original ID.
The reference describes sub_count as followers and friends as following. Keep missing counts unknown and retain observation time; one profile cannot measure growth, reach or campaign results. Free-text location is not verified geography, and blue_verified or verification_type does not independently verify identity, partnership or payment history. Optional affiliates and business_account structures differ across the two route examples, so preserve them instead of enforcing one shared nested shape.
Need an exact large ID as a string? Separately select User Detail and review its price. This task does not retrieve pinned posts, followers, media or a timeline, and it does not contact the account.
Choose a handle lookup or an exact-ID lookup before running. A connected agent needs that identifier, the selected endpoint and the result you want. For a new integration, share the setup Skill, Markdown quickstart and chosen task. Keep SANDBASE_API_KEY locally and use POST /v1/api/ with Bearer authentication.
Validate completed SandBase status and an object at outputs[0].data, then check the business result. The selected references describe flat profile fields, not a nested user or data.data wrapper. An explicit status notfound or missing usable identity is not a successful empty profile. Do not invent a universal code/message success flag; preserve unknown optional fields rather than coercing them into zero or false.
Pricing checked on 2026-11-08: Web User Profile lists $0.001 per call; User Detail lists $0.014286 per call. Both show eligibility for 100 daily calls shared across eligible data APIs in the organization, resetting at 00:00 UTC. Eligibility is not remaining allowance. Check current pricing and do not silently retry against the other, differently priced route. No new business request was made for this revision. The X/Twitter Python profile guide distinguishes historical illustrations, public references and offline validation.
開始建置
具備統一驗證與用量追蹤的平台 API 端點。
curl -X POST "https://api.sandbase.ai/v1/api/twitter/web/user-profile" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"screen_name": "NASA"
}'請將您的 SandBase API 金鑰設定在伺服器環境中。請求使用 Bearer 驗證。
export SANDBASE_API_KEY="YOUR_API_KEY"請將金鑰保留在伺服器端,不要在瀏覽器程式碼中公開。
rest_idintegerUser ID, for example: 44196397, if the user ID is used, the username will be ignored, only one of them can be selected.
screen_namestringScreen Name, for example: elonmusk, can be obtained from the user's homepage link, for example: elonmusk in https://twitter.com/elonmusk
這是此 API 的已儲存範例回應;檢視時不會發出即時請求。
[
{
"data": {
"affiliates": null,
"avatar": null,
"blue_verified": null,
"business_account": null,
"created_at": null,
"desc": null,
"friends": null,
"header_image": null,
"id": null,
"location": null,
"media_count": null,
"name": null,
"pinned_tweet_ids_str": null,
"profile": null,
"protected": null,
"rest_id": null,
"status": "notfound",
"statuses_count": null,
"sub_count": null,
"verification_type": null
}
}
]探索更多
| API | 價格 | 回應 |
|---|---|---|
Twitter | 每次呼叫 $0.001 | JSON |
Twitter | 每次呼叫 $0.001 | JSON |
Twitter | 每次呼叫 $0.001 | JSON |
Twitter | 每次呼叫 $0.001 | JSON |
Twitter | 每次呼叫 $0.001 | JSON |
Twitter | 每次呼叫 $0.001 | JSON |
指南:X API alternative: pay per call, not per postBest Twitter API in 2026: X API Pricing Compared
問題
使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/twitter/web/user-profile。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。
每次 $0.001。每個組織每個 UTC 日可免費呼叫 100 次,並可在包含此 API 在內的所有符合資格之 SandBase APIs 間共用;超過後,每次呼叫都會從您的 SandBase 餘額中以此價格計費。沒有訂閱方案。
這個個人檔案請求請選擇 screen_name(字串)或 rest_id(整數)。schema 將兩者各自標為可選,但第一次空請求不會選定帳號。如果同時提供,rest_id 會優先,screen_name 會被忽略;請改為只傳一個明確要用的識別碼。
在同一個 HTTP 請求中回傳的 JSON 回應(同步)。 本頁的 README 包含範例回應。
不需要。Twitter (X) User Profile 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 Twitter API 存取權。
擇一即可:screen_name 是字串 handle,rest_id 是整數。若兩者都送,合約會以 rest_id 為優先。選填的單欄位不代表空白的第一個 body 也能運作。請在序列化前拒絕不安全的 JavaScript 整數 ID;四捨五入後的數字無法在事後修復。
不是。8 月 20 日已儲存的範例狀態是 notfound,且身分/計數欄位為 null。那份 NASA 風格的 README 是獨立且未標日期的參考資料。完成的 SandBase 封裝不會把 notfound 的業務回應變成成功的個人檔案。
否。請保留 follower/following 計數、null 值與觀測時間。單一快照無法證明成長或觸及,而且 verification 標記或 organization 標籤也不能單獨驗證身分或合作關係。此讀取不會聯絡該帳號。