Introduction
The Usage API in the X API v2 allows developers to programmatically retrieve their project usage. Using this endpoint, developers can keep track and monitor the number of Posts they have pulled for a given billing cycle.
Developers can use the GET endpoint to get the daily project usage for upto the last 90 days. The usage can also be aggregated per client app connected to your project.
There is a app rate limit of 50 requests per 15 minutes for this GET endpoint.
Getting started
To use this endpoint, you need a bearer token from the developer portal. Once you have the bearer token, you can call the usage API as shown below:
curl 'https://api.x.com/2/usage/tweets' --header 'Authorization: Bearer XXXXX'
If the request is successful, you should see the JSON response as shown below:
{
"data": {
"cap_reset_day": 10,
"project_cap": "5000000000",
"project_id": "1369785403853424",
"project_usage": "43435"
}
}
Account setup
To access these endpoints, you will need:
- An approved developer account.
- To authenticate using the keys and tokens from a developer App that is located within a Project.
Learn more about getting access to the X API v2 endpoints in our getting started guide.