Documentation Index
Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
このガイドでは、逆時系列のホームタイムラインエンドポイントへの最初のリクエストの手順を説明します。
前提条件作業を始める前に、次を用意してください:
- 承認済みの App を持つ開発者アカウント
- ユーザーアクセストークン (このエンドポイントではユーザー認証が必要です)
取得したいホームタイムラインのアカウントのユーザー ID が必要です。次の username ルックアップエンドポイントを使って取得します:
curl "https://api.x.com/2/users/by/username/XDevelopers" \
-H "Authorization: Bearer $BEARER_TOKEN"
レスポンスにはユーザー ID が含まれます。
{
"data": {
"id": "2244994945",
"name": "X Developers",
"username": "XDevelopers"
}
}
ユーザー ID と User Access Token を指定して GET リクエストを送信します:
curl "https://api.x.com/2/users/2244994945/timelines/reverse_chronological" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
{
"data": [
{
"id": "1524796546306478083",
"text": "Today marks the launch of Devs in the Details...",
"edit_history_tweet_ids": ["1524796546306478083"]
},
{
"id": "1524468552404668416",
"text": "Join us tomorrow for a discussion about bots...",
"edit_history_tweet_ids": ["1524468552404668416"]
}
],
"meta": {
"result_count": 2,
"newest_id": "1524796546306478083",
"oldest_id": "1524468552404668416",
"next_token": "7140dibdnow9c7btw421dyz6jism75z99gyxd8egarsc4"
}
}
ステップ 4: フィールドと Expansions を追加する
クエリパラメータで追加のデータをリクエストします:
curl "https://api.x.com/2/users/2244994945/timelines/reverse_chronological?\
tweet.fields=created_at,public_metrics,author_id&\
expansions=author_id&\
user.fields=username,verified&\
max_results=10" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
SDK ではページネーションが自動的に処理されます。cURL を使用する場合は、レスポンスの next_token を使って、より多くの結果を取得します。
curl "https://api.x.com/2/users/2244994945/timelines/reverse_chronological?\
max_results=10&\
pagination_token=7140dibdnow9c7btw421dyz6jism75z99gyxd8egarsc4" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
| Parameter | 説明 | デフォルト |
|---|
max_results | 1 ページあたりの結果数 (1-100) | 10 |
start_time | 最も古いポストのタイムスタンプ (ISO 8601) | — |
end_time | 最も新しいポストのタイムスタンプ (ISO 8601) | — |
since_id | この ID 以降の投稿を返す | — |
until_id | この ID より前の投稿を返す | — |
exclude | retweets、replies、または両方を除外 | — |
ユーザーのメンション
ユーザーがメンションされている投稿を取得する
インテグレーションガイド
基本概念とベストプラクティス
APIリファレンス
エンドポイントの詳細ドキュメント