> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Post Counts

> Post counts 엔드포인트는 게시물 자체를 반환하지 않고, 시간에 따라 쿼리에 매칭되는 게시물의 볼륨을 반환합니다. counts를 다루는 X API v2 standard 티어 레퍼런스입니다.

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>;
};

Post counts 엔드포인트는 게시물 자체를 반환하지 않고, 시간에 따라 쿼리에 매칭되는 게시물의 볼륨을 반환합니다. 이 엔드포인트를 사용해 트렌드를 분석하고, 대화 규모를 파악하고, 검색 전에 쿼리를 다듬을 수 있습니다.

## 개요

<CardGroup cols={2}>
  <Card title="볼륨 분석" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-bar-chart.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=e2a41caa858b122416f0005a55a8f143" width="24" height="24" data-path="icons/xds/icon-bar-chart.svg">
    시간에 따른 게시물 볼륨을 보여주는 트렌드라인과 시각화 자료 구축
  </Card>

  <Card title="쿼리 다듬기" icon="https://mintcdn.com/x-preview/szd6PKNMlRQoyyAo/icons/xds/icon-filter.svg?fit=max&auto=format&n=szd6PKNMlRQoyyAo&q=85&s=5d59aff402c1f2aeae0e9e44bb23400e" width="24" height="24" data-path="icons/xds/icon-filter.svg">
    전체 검색 쿼리를 실행하기 전에 결과 규모 추정
  </Card>

  <Card title="이벤트 감지" icon="calendar">
    이벤트를 중심으로 대화가 정점에 이른 시점 확인
  </Card>

  <Card title="효율적인 리서치" icon="gauge-high">
    모든 게시물을 가져오지 않고도 대화 규모 파악
  </Card>
</CardGroup>

***

## 엔드포인트

| Endpoint                                                                | Description      | Access                  |
| :---------------------------------------------------------------------- | :--------------- | :---------------------- |
| GET [`/2/tweets/counts/recent`](/x-api/posts/get-count-of-recent-posts) | 최근 7일간의 게시물 카운트  | 모든 개발자                  |
| GET [`/2/tweets/counts/all`](/x-api/posts/get-count-of-all-posts)       | 전체 아카이브의 게시물 카운트 | Pay-per-use, Enterprise |

***

## Granularity 옵션

`granularity` 파라미터를 사용해 카운트가 어떻게 그룹화될지 지정합니다:

| Granularity | Description     | Use case |
| :---------- | :-------------- | :------- |
| `minute`    | 분 단위 카운트        | 실시간 모니터링 |
| `hour`      | 시간 단위 카운트 (기본값) | 일별 분석    |
| `day`       | 일 단위 카운트        | 장기 트렌드   |

***

## Recent counts

**최근 7일**의 게시물을 카운트합니다. 모든 개발자가 사용할 수 있습니다.

### 기능

* 분, 시간, 일 단위로 그룹화된 카운트
* recent search와 동일한 쿼리 연산자
* 512자 쿼리 길이

### 예시 응답

```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="퀵스타트" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-rocket.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=b978d7a9225de31709efbbed5b84e92d" href="/x-api/posts/counts/quickstart/recent-tweet-counts" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    첫 recent counts 요청 만들기
  </Card>

  <Card title="API 레퍼런스" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/posts/get-count-of-recent-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    전체 엔드포인트 문서
  </Card>
</CardGroup>

***

## Full-archive counts

2006년까지의 **전체 아카이브**에서 게시물을 카운트합니다.

<Note>
  Full-archive counts는 pay-per-use 및 Enterprise 고객이 사용할 수 있습니다.
</Note>

### 기능

* 임의의 기간에 대한 과거 게시물 카운트
* 모든 쿼리 연산자 사용 가능
* 1,024자 쿼리 길이 (Enterprise의 경우 4,096자)

### 페이지네이션

결과는 응답당 31일 단위로 페이지네이션됩니다:

* **Day granularity**: 페이지당 31일
* **Hour granularity**: 페이지당 744시간 (31일)
* **Minute granularity**: 페이지당 44,640분 (31일)

<CardGroup cols={2}>
  <Card title="퀵스타트" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-rocket.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=b978d7a9225de31709efbbed5b84e92d" href="/x-api/posts/counts/quickstart/full-archive-tweet-counts" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    첫 full-archive counts 요청 만들기
  </Card>

  <Card title="API 레퍼런스" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/posts/get-count-of-all-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    전체 엔드포인트 문서
  </Card>
</CardGroup>

***

## 쿼리 연산자

Post counts는 search 엔드포인트와 동일한 쿼리 구문을 사용합니다:

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

<Card title="쿼리 작성" icon="https://mintcdn.com/x-preview/cfyQtgCdwk8p69aa/icons/xds/icon-search.svg?fit=max&auto=format&n=cfyQtgCdwk8p69aa&q=85&s=8c11ad89387b7c09ced1553d5c232834" href="/x-api/posts/counts/integrate/build-a-query" width="24" height="24" data-path="icons/xds/icon-search.svg">
  쿼리 구문 및 연산자 익히기
</Card>

***

## 중요 참고사항

<Note>
  **Counts vs 검색 결과**

  카운트가 검색 결과와 정확히 일치하지 않을 수 있습니다. Search 엔드포인트는 카운트 엔드포인트가 수행하지 않는 추가적인 컴플라이언스 필터링을 적용합니다.
</Note>

***

## 시작하기

<Note>
  **사전 요구사항**

  * 승인된 [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * Developer Console 내의 [Project와 App](/resources/fundamentals/developer-apps)
  * App의 [Bearer Token](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="Recent counts 퀵스타트" icon="clock" href="/x-api/posts/counts/quickstart/recent-tweet-counts">
    최근 7일간의 게시물 카운트
  </Card>

  <Card title="Full-archive 퀵스타트" icon="vault" href="/x-api/posts/counts/quickstart/full-archive-tweet-counts">
    과거 게시물 카운트
  </Card>

  <Card title="통합 가이드" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-book.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=22ac564792481d14ae36a941546039c8" href="/x-api/posts/counts/integrate/overview" width="24" height="24" data-path="icons/xds/icon-book.svg">
    핵심 개념 및 모범 사례
  </Card>

  <Card title="샘플 코드" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    동작하는 코드 예제
  </Card>
</CardGroup>
