> ## 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.

# v1에서 v2로

> standard v1.1 GET lists/statuses 엔드포인트를 사용해 왔다면 이 가이드가 도움이 됩니다. 마이그레이션을 다루는 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>;
};

### List Posts lookup: standard v1.1과 X API v2 비교

standard v1.1의 [GET lists/statuses](https://developer.x.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses) 엔드포인트를 사용해 왔다면, 이 가이드는 standard v1.1과 X API v2 엔드포인트 사이의 유사점과 차이점을 이해하는 데 도움이 될 것입니다.

* **유사점**
  * 인증 방식
  * Rate limit
* **차이점**
  * 엔드포인트 URL
  * App 및 Project 요구사항
  * 요청당 데이터 객체 수 제한
  * 응답 데이터 형식
  * 요청 매개변수

#### 유사점

**인증**

두 엔드포인트 버전 모두 [OAuth 1.0a User Context](/resources/fundamentals/authentication#oauth-2-0)를 지원합니다. 따라서 이전에 standard v1.1 List Posts lookup 엔드포인트 중 하나를 사용했다면 X API v2 버전으로 마이그레이션할 때도 동일한 인증 방식을 계속 사용할 수 있습니다.

선택한 인증 라이브러리/패키지에 따라 다르지만, App only 인증은 시작하기가 가장 쉽고 간단한 요청 헤더로 설정할 수 있습니다. App only Access Token을 생성하는 방법은 [이 App only 가이드](/resources/fundamentals/authentication#bearer-token-also-known-as-app-only)를 참조하세요.

**Rate limit**

|                                                                                                                 |                                                                                                                                                                              |
| :-------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Standard v1.1**                                                                                               | **X API v2**                                                                                                                                                                 |
| /1.1/lists/statuses.json<br /><br />OAuth 1.0a User Context로 15분 창당 900회 요청<br /><br />App only로 15분 창당 900회 요청 | /2/lists/:id/tweets<br /><br />OAuth 1.0a User Context로 15분 창당 900회 요청<br /><br />OAuth 2.0 Authorization Code with PKCE로 15분 창당 900회 요청<br /><br />App only로 15분 창당 900회 요청 |

#### 차이점

**엔드포인트 URL**

* Standard v1.1 엔드포인트:
  * GET [https://api.x.com/1.1/lists/statuses.json](https://api.x.com/1.1/lists/statuses.json)
    (지정된 List에서 Tweet 조회)
* X API v2 엔드포인트:
  * GET [https://api.x.com/2/lists/:id/tweets](https://api.x.com/2/lists/:id/tweets)
    (지정된 List에서 Tweet 조회)

**App 및 Project 요구사항**

X API v2 엔드포인트는 요청을 인증할 때 [Project](/resources/fundamentals/developer-apps)와 연결된 [developer App](/resources/fundamentals/developer-apps)의 자격 증명을 사용해야 합니다. 모든 X API v1.1 엔드포인트는 App 또는 project와 연결된 App의 자격 증명을 사용할 수 있습니다.

**요청당 데이터 객체 수 제한**

standard v1.1의 /lists/statuses 엔드포인트는 요청당 최대 5000개의 Post를 반환할 수 있습니다. 새로운 v2 엔드포인트는 요청당 최대 100개의 Post를 반환할 수 있습니다. 기본적으로 100개의 user 객체가 반환됩니다. 결과 수를 변경하려면 1-100 사이의 숫자를 사용하여 쿼리 매개변수 max\_results=를 전달해야 합니다. 이후 응답 페이로드에 반환된 next\_token을 다음 요청의 pagination\_token 쿼리 매개변수에 전달할 수 있습니다.

**응답 데이터 형식**

standard v1.1과 X API v2 엔드포인트 버전의 가장 큰 차이 중 하나는 페이로드에 반환될 필드를 선택하는 방식입니다.

standard 엔드포인트에서는 많은 응답 필드가 기본적으로 반환되며, 매개변수를 사용해 페이로드에서 어떤 추가 필드 또는 필드 세트가 반환될지 지정할 수 있습니다.

X API v2 버전은 기본적으로 Post id와 text 필드만 제공합니다. 추가 필드나 객체를 요청하려면 [fields](/x-api/fundamentals/fields) 및 [expansions](/x-api/fundamentals/expansions) 매개변수를 사용해야 합니다. 이 엔드포인트에서 요청한 모든 Post 필드는 기본 Post 객체에 반환됩니다. 확장된 객체 필드는 응답 내 includes 객체에 반환됩니다. 이후 기본 객체와 확장된 객체의 ID를 매칭하여 확장 객체를 기본 Post 객체에 다시 연결할 수 있습니다.

가능한 Post 필드 및 expansion의 예는 다음과 같습니다:

* attachments
* author\_id
* context\_annotations
* created\_at
* geo
* lang

|                     |               |
| :------------------ | :------------ |
| **Endpoint**        | **Expansion** |
| /2/lists/:id/tweets | author\_id    |

이 새로운 매개변수에 대한 자세한 내용은 각 가이드나 [fields와 expansions 사용법](/x-api/fundamentals/data-dictionary/reference#how-to-use-fields-and-expansions) 가이드를 읽어보시기 바랍니다.

또한 standard v1.1의 필드를 새로운 v2 필드에 매핑하는 데 도움을 주는 [데이터 형식 마이그레이션 가이드](/x-api/migrate/data-format-migration)도 준비되어 있습니다. 이 가이드는 v2 요청과 함께 특정 필드를 반환하기 위해 전달해야 하는 구체적인 expansion 및 field 매개변수도 제공합니다.

필드 요청 방식의 변경 외에도, X API v2는 [Post](/x-api/fundamentals/data-dictionary/reference#tweet) 및 [user](/x-api/fundamentals/data-dictionary/reference#user) 객체를 포함하여 API가 반환하는 객체에 대한 새로운 JSON 설계를 도입하고 있습니다.

* JSON 루트 레벨에서 standard 엔드포인트는 **statuses** 배열에 Post 객체를 반환하지만, X API v2는 **data** 배열을 반환합니다.

* Retweeted 및 Quoted "statuses"라는 표현 대신 X API v2 JSON은 Retweeted 및 Quoted Tweet이라는 표현을 사용합니다. **contributors** 및 **user.translator\_type**과 같은 많은 레거시 및 폐기 예정 필드가 제거되고 있습니다.

* **favorites** (Post 객체 내) 및 **favourites** (user 객체 내)를 함께 사용하는 대신, X API v2는 **like**라는 용어를 사용합니다.

* X는 값이 없는 JSON 값(예: **null**)은 페이로드에 기록하지 않는 규칙을 채택하고 있습니다. Post와 user 속성은 non-null 값을 가진 경우에만 포함됩니다.

**요청 매개변수**

다음 standard v1.1 요청 매개변수는 X API v2에서 대응되는 매개변수를 가집니다:

|                     |                                       |
| :------------------ | :------------------------------------ |
| Standard v1.1       | X API v2                              |
| list\_id            | id                                    |
| slug                | 대응되는 매개변수 없음                          |
| owner\_screen\_name | 대응되는 매개변수 없음                          |
| owner\_id           | author\_id 값을 사용한 expansions 매개변수로 요청 |
| since\_id           | 대응되는 매개변수 없음                          |
| max\_id             | 대응되는 매개변수 없음                          |
| include\_entities   | entities 값을 사용한 tweet.fields 매개변수로 요청 |
| include\_rts        | 대응되는 매개변수 없음                          |
| count               | max\_results                          |

***

## 코드 예제

### List에서 Post 가져오기 (v2)

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/lists/84839422/tweets?tweet.fields=created_at,public_metrics&max_results=100" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python title="Python" lines wrap icon="python" theme={null}
  import requests

  bearer_token = "YOUR_BEARER_TOKEN"
  url = "https://api.x.com/2/lists/84839422/tweets"

  params = {
      "tweet.fields": "created_at,public_metrics",
      "max_results": 100
  }
  headers = {"Authorization": f"Bearer {bearer_token}"}

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```

  ```python title="Python SDK" lines wrap icon="python" theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # List에서 Post 가져오기
  for page in client.lists.get_tweets(
      "84839422",
      tweet_fields=["created_at", "public_metrics"],
      max_results=100
  ):
      for post in page.data:
          print(f"{post.created_at}: {post.text[:50]}...")
  ```

  ```javascript title="JavaScript SDK" lines wrap icon="square-js" theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // List에서 Post 가져오기
  const paginator = client.lists.getTweets("84839422", {
    tweetFields: ["created_at", "public_metrics"],
    maxResults: 100,
  });

  for await (const page of paginator) {
    page.data?.forEach((post) => {
      console.log(`${post.created_at}: ${post.text?.slice(0, 50)}...`);
    });
  }
  ```
</CodeGroup>
