> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-oauth-2-ios.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

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](https://developer.x.com/resources/fundamentals/authentication#app-only-authentication-and-oauth-2-0-bearer-token) from the [developer portal](https://developer.x.com/en/portal/dashboard). 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"
    }
}
```

<Note>
  **Account setup**

  To access these endpoints, you will need:

  * An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info).
  * To authenticate using the keys and tokens from a [developer App](/resources/fundamentals/developer-apps) that is located within a [Project](/resources/fundamentals/projects). 

  Learn more about getting access to the X API v2 endpoints in our [getting started guide](/x-api/getting-started/getting-access).
</Note>

<div className="flex space-x-2">
  <Button href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    Sample code
  </Button>

  <Button href="https://app.getpostman.com/run-collection/9956214-784efcda-ed4c-4491-a4c0-a26470a67400">
    Run in Postman
  </Button>
</div>
