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

# Post Counts

> The Post counts endpoints return the volume of Posts matching a query over time, without returning. Reference for the X API v2 standard tier covering counts.

export const Button = ({href, children}) => {
  return <div className="not-prose">
    <a href={href}>
      <button className="x-btn">
        <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 Post counts endpoints return the volume of Posts matching a query over time, without returning the Posts themselves. Use these endpoints to analyze trends, understand conversation size, and refine queries before searching.

## Overview

<CardGroup cols={2}>
  <Card title="Volume analysis" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/r5kq0chEtxapqq3m/icons/xds/icon-bar-chart.svg?fit=max&auto=format&n=r5kq0chEtxapqq3m&q=85&s=bc65b9ac984c13d16c4ca560faa3420f" width="24" height="24" data-path="icons/xds/icon-bar-chart.svg">
    Build trendlines and visualizations showing Post volume over time
  </Card>

  <Card title="Query refinement" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/BSniKxxp6bqWreF4/icons/xds/icon-filter.svg?fit=max&auto=format&n=BSniKxxp6bqWreF4&q=85&s=704550419e4a40ed6cca6907d032660c" width="24" height="24" data-path="icons/xds/icon-filter.svg">
    Estimate result size before running full search queries
  </Card>

  <Card title="Event detection" icon="calendar">
    Identify when conversations peaked around events
  </Card>

  <Card title="Efficient research" icon="gauge-high">
    Understand conversation scale without retrieving all Posts
  </Card>
</CardGroup>

***

## Endpoints

| Endpoint | Description | Access |
| :- | :- | :- |
| GET [`/2/tweets/counts/recent`](/x-api/posts/get-count-of-recent-posts) | Count Posts from last 7 days | All developers |
| GET [`/2/tweets/counts/all`](/x-api/posts/get-count-of-all-posts) | Count Posts from complete archive | Pay-per-use, Enterprise |

***

## Granularity options

Specify how counts are grouped using the `granularity` parameter:

| Granularity | Description | Use case |
| :- | :- | :- |
| `minute` | Counts per minute | Real-time monitoring |
| `hour` | Counts per hour (default) | Daily analysis |
| `day` | Counts per day | Long-term trends |

***

## Recent counts

Count Posts from the **last 7 days**. Available to all developers.

### Features

* Counts grouped by minute, hour, or day
* Same query operators as recent search
* 512-character query length

### Example response

```json theme={null}
{
  "data": [
    { "start": "2024-01-15T00:00:00.000Z", "end": "2024-01-15T01:00:00.000Z", "tweet_count": 1523 },
    { "start": "2024-01-15T01:00:00.000Z", "end": "2024-01-15T02:00:00.000Z", "tweet_count": 1247 },
    { "start": "2024-01-15T02:00:00.000Z", "end": "2024-01-15T03:00:00.000Z", "tweet_count": 892 }
  ],
  "meta": {
    "total_tweet_count": 3662
  }
}
```

<CardGroup cols={2}>
  <Card title="Quickstart" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/HazjhzcnQyryvfGR/icons/xds/icon-rocket.svg?fit=max&auto=format&n=HazjhzcnQyryvfGR&q=85&s=d0f5cef99b2c696bbfb49fa10afdd62f" href="/x-api/posts/counts/quickstart/recent-tweet-counts" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Make your first recent counts request
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/Rr7J7_M_U1YKwpT1/icons/xds/icon-code.svg?fit=max&auto=format&n=Rr7J7_M_U1YKwpT1&q=85&s=91f901377ed7f56087005ca8f2202ae3" href="/x-api/posts/get-count-of-recent-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Full endpoint documentation
  </Card>
</CardGroup>

***

## Full-archive counts

Count Posts from the **complete archive** back to 2006.

<Note>
  Full-archive counts are available to pay-per-use and Enterprise customers.
</Note>

### Features

* Count historical Posts from any time period
* All query operators available
* 1,024-character query length (4,096 for Enterprise)

### Pagination

Results paginate at 31 days per response:

* **Day granularity**: 31 days per page
* **Hour granularity**: 744 hours (31 days) per page
* **Minute granularity**: 44,640 minutes (31 days) per page

<CardGroup cols={2}>
  <Card title="Quickstart" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/HazjhzcnQyryvfGR/icons/xds/icon-rocket.svg?fit=max&auto=format&n=HazjhzcnQyryvfGR&q=85&s=d0f5cef99b2c696bbfb49fa10afdd62f" href="/x-api/posts/counts/quickstart/full-archive-tweet-counts" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Make your first full-archive counts request
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/Rr7J7_M_U1YKwpT1/icons/xds/icon-code.svg?fit=max&auto=format&n=Rr7J7_M_U1YKwpT1&q=85&s=91f901377ed7f56087005ca8f2202ae3" href="/x-api/posts/get-count-of-all-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Full endpoint documentation
  </Card>
</CardGroup>

***

## Query operators

Post counts use the same query syntax as search endpoints:

```
python lang:en -is:retweet
```

<Card title="Build a query" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/Y9anV6Yuzgh5cdxI/icons/xds/icon-search.svg?fit=max&auto=format&n=Y9anV6Yuzgh5cdxI&q=85&s=390162fcdf84bf652d239618065e59df" href="/x-api/posts/counts/integrate/build-a-query" width="24" height="24" data-path="icons/xds/icon-search.svg">
  Learn query syntax and operators
</Card>

***

## Important notes

<Note>
  **Counts vs search results**

  Counts may not exactly match search results. Search endpoints apply additional compliance filtering that counts endpoints do not perform.
</Note>

***

## Getting started

<Note>
  **Prerequisites**

  * An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * A [Project and App](/resources/fundamentals/developer-apps) in the Developer Console
  * Your App's [Bearer Token](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="Recent counts quickstart" icon="clock" href="/x-api/posts/counts/quickstart/recent-tweet-counts">
    Count Posts from the last 7 days
  </Card>

  <Card title="Full-archive quickstart" icon="vault" href="/x-api/posts/counts/quickstart/full-archive-tweet-counts">
    Count historical Posts
  </Card>

  <Card title="Integration guide" icon="https://mintcdn.com/x-preview-mintlify-24fef6d1/r5kq0chEtxapqq3m/icons/xds/icon-book.svg?fit=max&auto=format&n=r5kq0chEtxapqq3m&q=85&s=9159c974d1dbc9f6988e28466c342ea4" href="/x-api/posts/counts/integrate/overview" width="24" height="24" data-path="icons/xds/icon-book.svg">
    Key concepts and best practices
  </Card>

  <Card title="Sample code" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    Working code examples
  </Card>
</CardGroup>
