GET /2/usage/tweets

GET /2/usage/tweets

Get the Tweet usage within the context of a project

Endpoint URL

https://api.x.com/2/usage/tweets

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 2.0 App-only

Rate limit

App rate limit (Application-only): 50 requests per 15-minute window shared among all users of your app

Query parameters

NameTypeDescription
days
�Optional�
numberThe number of days for which you need the Tweet usage for. You can get usage for upto 90 days.
usage.fields
�Optional�
enum (daily_client_app_usage, daily_project_usage)This parameter is used to specify if you want the daily usage returned and at a client app level.


Example code with offical SDKs

TypeScript
Java
      (async () => {
  try {
    const getUsage =
      await twitterClient.usage.getUsage();
    console.dir(getUsage, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      try {
    UsageResponse result = apiInstance.usage().getUsage();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling UsageApi#getUsage");
    System.err.println("Status code: " + e.getCode());
    System.err.println("Reason: " + e.getResponseBody());
    System.err.println("Response headers: " + e.getResponseHeaders());
    e.printStackTrace();
}

    

Example responses

Default Fields
Optional Fields
      {
  "data": {
    "cap_reset_day": 10,
    "project_cap": "2000000",
    "project_id": "1281043626347900822499",
    "project_usage": "2007"
  }
}
    
      {
  "data": {
    "daily_client_app_usage": [
      {
        "usage": [
          {
            "date": "2023-11-01T00:00:00.000Z",
            "usage": "200"
          }
        ],
        "client_app_id": "101111140",
        "usage_result_count": 1
      }
    ],
    "project_cap": "2000000",
    "daily_project_usage": {
      "project_id": "1281043626347900822499",
      "usage": [
        {
          "date": "2023-11-01T00:00:00.000Z",
          "usage": "200"
        }
      ]
    },
    "project_usage": "200",
    "cap_reset_day": 5,
    "project_id": "1281043626347900822499"
  }
}
    

Response fields

NameTypeDescription
project_idstringThe unique identifier for this project.
project_capstringThe total number of Tweets that can be read with this project per month.
project_usagestringThe total number of Tweets that have been read with this project in the current billing cycle.
cap_reset_dayintegerThe day of the month when the Tweet cap is reset.
daily_project_usageobjectThis object and its fields contain daily usage breakdown for a project.
daily_project_usage.project_idstringThe unique identifier for this project.
daily_project_usage.usagearrayThis array contains the usage information.
daily_project_usage.usage.datedate (ISO 8601)The date for which the usage is returned.
daily_project_usage.usage.usagestringThe project usage for a day.
daily_client_app_usagearrayThis object and its fields contain daily usage breakdown per client app.
daily_client_app_usage.usagearrayThis array contains the usage information.
daily_client_app_usage.usage.datedate (ISO 8601)The date for which the usage is returned.
daily_client_app_usage.usage.usagestringThe project usage for a day.