メインコンテンツへスキップ
GET
/
2
/
tweets
/
counts
/
recent
直近の投稿数を取得する
curl --request GET \
  --url https://api.x.com/2/tweets/counts/recent \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "end": "2023-11-07T05:31:56Z",
      "start": "2023-11-07T05:31:56Z",
      "tweet_count": 123
    }
  ],
  "errors": [
    {
      "title": "<string>",
      "type": "<string>",
      "detail": "<string>",
      "status": 123
    }
  ],
  "meta": {
    "newest_id": "<string>",
    "next_token": "<string>",
    "oldest_id": "<string>",
    "total_tweet_count": 123
  }
}

承認

Authorization
string
header
必須

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

クエリパラメータ

query
string
必須

投稿と照合するための単一のクエリ/ルール/フィルターです。最大クエリ長については https://t.co/rulelength を参照してください。

Required string length: 1 - 4096
:

"(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet"

start_time
string<date-time>

YYYY-MM-DDTHH:mm:ssZ。過去7日間の範囲内で、ポストを取得する最も古いUTCタイムスタンプを指定します。タイムスタンプは秒単位の粒度で、両端を含みます(例:12:00:01 はその1分間の最初の1秒として含まれます)。

end_time
string<date-time>

YYYY-MM-DDTHH:mm:ssZ。ポストが返される、最も新しい(最新の)UTC タイムスタンプを指定します。タイムスタンプは秒単位の粒度で、排他的です(例: 12:00:01 を指定した場合、その分の最初の 1 秒は除外されます)。

since_id
string

指定した id より大きい(つまり、より新しい)ポストの id を持つ結果を返します。 このツイートの一意の識別子。大きな整数を扱えない言語やツールでの問題を避けるため、文字列として返されます。

Pattern: ^[0-9]{1,19}$
:

"1346889436626259968"

until_id
string

指定した id より小さい(つまり、より古い)ポストの id を持つ結果を返します。 このツイートの一意の識別子。大きな整数を扱えない言語やツールでの問題を避けるため、文字列として返されます。

Pattern: ^[0-9]{1,19}$
:

"1346889436626259968"

next_token
string

このパラメータは、結果の次ページを取得するために使用します。API レスポンスからそのまま返される値を指定し、変更しないでください。 Base36 形式のページネーショントークン。

Minimum string length: 1
pagination_token
string

このパラメータは、結果の次ページを取得するために使用します。API レスポンスからそのまま返される値を指定し、変更しないでください。 Base36 形式のページネーショントークン。

Minimum string length: 1
granularity
enum<string>
デフォルト:hour

検索結果件数の集計単位(粒度)を指定します。

利用可能なオプション:
minute,
hour,
day
search_count.fields
enum<string>[]

レスポンスに含める SearchCount フィールドのカンマ区切りのリスト。 SearchCount オブジェクトで利用可能なフィールド。

Minimum array length: 1
利用可能なオプション:
end,
start,
tweet_count
:
["end", "start", "tweet_count"]

レスポンス

リクエストは成功しました。

data
object[]
Minimum array length: 1
errors
object[]
Minimum array length: 1

IETF RFC 7807 (https://tools.ietf.org/html/rfc7807) で定義された HTTP Problem Details オブジェクト。

meta
object