ポストの分析情報を取得
curl --request GET \
--url https://api.x.com/2/tweets/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/tweets/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.x.com/2/tweets/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.x.com/2/tweets/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "1346889436626259968",
"timestamped_metrics": [
{
"metrics": {
"app_install_attempts": 123,
"app_opens": 123,
"detail_expands": 123,
"email_tweet": 123,
"engagements": 123,
"follows": 123,
"hashtag_clicks": 123,
"impressions": 123,
"likes": 123,
"link_clicks": 123,
"media_engagements": 123,
"media_views": 123,
"permalink_clicks": 123,
"profile_visits": 123,
"quote_tweets": 123,
"replies": 123,
"retweets": 123,
"url_clicks": 123,
"user_profile_clicks": 123
},
"timestamp": "2025-03-17T06:30:00Z"
}
]
}
],
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
]
}{
"code": 123,
"message": "<string>"
}エンゲージメント指標
ポストの分析情報を取得
指定したポストについて、指定した時間範囲内の分析データを取得します。
GET
/
2
/
tweets
/
analytics
ポストの分析情報を取得
curl --request GET \
--url https://api.x.com/2/tweets/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/tweets/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.x.com/2/tweets/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.x.com/2/tweets/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "1346889436626259968",
"timestamped_metrics": [
{
"metrics": {
"app_install_attempts": 123,
"app_opens": 123,
"detail_expands": 123,
"email_tweet": 123,
"engagements": 123,
"follows": 123,
"hashtag_clicks": 123,
"impressions": 123,
"likes": 123,
"link_clicks": 123,
"media_engagements": 123,
"media_views": 123,
"permalink_clicks": 123,
"profile_visits": 123,
"quote_tweets": 123,
"replies": 123,
"retweets": 123,
"url_clicks": 123,
"user_profile_clicks": 123
},
"timestamp": "2025-03-17T06:30:00Z"
}
]
}
],
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
]
}{
"code": 123,
"message": "<string>"
}承認
OAuth2UserTokenUserToken
The access token received from the authorization server in the OAuth 2.0 flow.
クエリパラメータ
カンマ区切りのポスト ID のリスト。1 回のリクエストで最大 100 件まで指定できます。
Required array length:
1 - 100 elementsこのツイートの一意の識別子。大きな整数を扱えない言語やツールでの問題を避けるため、文字列として返されます。
Pattern:
^[0-9]{1,19}$YYYY-MM-DDTHH:mm:ssZ 形式の、時間範囲の終了時刻を表す UTC タイムスタンプ。
YYYY-MM-DDTHH:mm:ssZ。時間範囲の開始を表す UTC のタイムスタンプ。
検索カウント結果の集計粒度。
利用可能なオプション:
hourly, daily, weekly, total 表示対象の Analytics フィールドをカンマ区切りで指定するリスト。 Analytics オブジェクトで利用可能なフィールド。
Minimum array length:
1利用可能なオプション:
app_install_attempts, app_opens, bookmarks, detail_expands, email_tweet, engagements, follows, hashtag_clicks, id, impressions, likes, media_views, permalink_clicks, quote_tweets, replies, retweets, shares, timestamp, unfollows, unlikes, url_clicks, user_profile_clicks 例:
[ "app_install_attempts", "app_opens", "bookmarks", "detail_expands", "email_tweet", "engagements", "follows", "hashtag_clicks", "id", "impressions", "likes", "media_views", "permalink_clicks", "quote_tweets", "replies", "retweets", "shares", "timestamp", "unfollows", "unlikes", "url_clicks", "user_profile_clicks" ]
レスポンス
リクエストは成功しました。
Show child attributes
Show child attributes
Minimum array length:
1IETF RFC 7807 (https://tools.ietf.org/html/rfc7807) で定義された HTTP Problem Details オブジェクト。
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
Show child attributes
Show child attributes