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

# v1 to v2

## Standard v1.1 compared to X API v2

If you have been working with the standard v1.1 GET statuses/show and GET statuses/lookup, this guide will help you understand the similarities and differences between the standard and X API v2 Posts lookup endpoints.

You may also be interested in our [visual data format migration tool](/x-api/migrate/data-format-migration) to help you quickly see the differences between the [X API v1.1 data format](/x-api/fundamentals/data-dictionary) and the [X API v2 format](/x-api/fundamentals/data-dictionary).

* **Similarities**
  * OAuth 1.0a User Context
  * Posts per request limits
  * Support for Post edit history and metadata

* **Differences**
  * Endpoint URLs
  * App and Project requirements
  * Response data format
  * Request parameters

### Similarities

#### OAuth 1.0a User Context Authentication Method

The standard endpoint supports [OAuth 1.0a User Context](/resources/fundamentals/authentication), while the new X API v2 Post lookup endpoint supports both OAuth 1.0a User Context and [OAuth 2.0 App-Only](/resources/fundamentals/authentication). Therefore, if you were previously using one of the standard v1.1 Post lookup endpoints, you can continue using the same authentication method if you migrate to the X API v2 version.

App-Only authentication is likely the easiest way to get started. To learn how to generate an App Access Token, see [this OAuth 2.0 App-only guide](/resources/fundamentals/authentication).

#### Posts per Request Limits

The v1.1 [GET statuses/lookup](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-lookup) endpoint allows you to specify up to 100 Posts per request. This also applies to the GET /tweets endpoint. To specify a full 100 Posts, use the `ids` parameter as a query parameter with a comma-separated list of [Post IDs](/resources/fundamentals/x-ids).

**Support for Post Edit History and Metadata**

Both versions provide metadata that describes any edit history. Check out the Post lookup API References and the [Edit Posts fundamentals page](/x-api/fundamentals/edit-posts) for more details.

### Differences

#### Endpoint URLs

* **Standard v1.1 endpoints:**
  * `https://api.x.com/1.1/statuses/show`
  * `https://api.x.com/1.1/statuses/lookup`
* **X API v2 endpoint:**
  * `https://api.x.com/2/tweets`
  * `https://api.x.com/2/tweets/:id`

#### App and Project Requirements

X API v2 endpoints require credentials from a [developer App](/resources/fundamentals/developer-apps) associated with a [Project](/resources/fundamentals/developer-apps) for authentication. X API v1.1 endpoints can use credentials from Apps or Apps associated with an App.

#### Response Data Format

A significant difference between standard v1.1 and X API v2 endpoint versions is how fields are selected in the payload.

For standard endpoints, many response fields are included by default, with options to use parameters to specify additional fields.

X API v2, however, only delivers the Post `id` and `text` fields by default. Additional fields and objects require the use of [fields](/x-api/fundamentals/fields) and [expansions](/x-api/fundamentals/expansions) parameters. The expanded fields return in an `includes` object within the response, which can be matched to the primary Post object by matching IDs.

For more on using fields and expansions, see the [guide on how to use fields and expansions](/x-api/fundamentals/data-dictionary). A [data format migration guide](/x-api/fundamentals/fields) also maps standard v1.1 fields to the newer v2 fields.

Additionally, X API v2 introduces new JSON designs for objects, including the Post and [user](/x-api/fundamentals/data-dictionary#user) objects:

* Standard endpoints return Post objects in a `statuses` array, while X API v2 uses a `data` array.
* Retweeted and Quoted Tweets in X API v2 replace "statuses" terminology.
* New terminology such as `like` replaces terms like `favorites` and `favourites`.
* Attributes with no values (e.g., `null`) are not included in X API v2 payloads.

The Post object in X API v2 includes new fields such as:

* `conversation_id`
* Two new [annotations](/x-api/fundamentals/post-annotations) fields (`context` and `entities`)
* New [metrics](/x-api/fundamentals/metrics) fields
* `reply_setting` field showing who can reply to a given Post

#### Request Parameters

The following standard v1.1 request parameters have equivalents in X API v2:

| Standard | X API v2 |
| :------- | :------- |
| `id`     | `ids`    |

Certain standard v1.1 parameters are **not** supported in X API v2:

| Standard               | Comment                                                                                                          |
| :--------------------- | :--------------------------------------------------------------------------------------------------------------- |
| `tweet_mode`           | Replaced by fields and expansions functionality.                                                                 |
| `trim_user`            | Replaced by fields and expansions. Use `author_id` expansion and `user.fields` for user data.                    |
| `include_my_retweet`   | Provides the ID of the source Post for Retweeted Posts by the authenticating user.                               |
| `include_entities`     | Use fields and expansions to control entities in the payload.                                                    |
| `include_ext_alt_text` | Adds `ext_alt_text` field in media entity if alt text is present.                                                |
| `include_card_uri`     | Adds `card_uri` when an ads card is attached.                                                                    |
| `map`                  | Returns the Post ID and error message for unavailable Posts in X API v2, as opposed to nullified fields in v1.1. |

### Code Examples

The following examples show standard v1.1 endpoints and their v2 equivalents. Replace credentials with your actual tokens. For v2 endpoints, the token must belong to a [developer App](/resources/fundamentals/developer-apps/overview) within a [Project](/resources/fundamentals/developer-apps/overview).

The response payloads from v1.1 will differ from v2. With v2, you can request different fields with the [fields](/x-api/fundamentals/fields) and [expansions](/x-api/fundamentals/expansions) parameters.

**Multiple Posts lookup: v1.1 `GET statuses/lookup` → v2 `GET /tweets`**

<CodeGroup dropdown>
  ```bash cURL (v1.1) theme={null}
  curl --request GET \
    --url 'https://api.x.com/1.1/statuses/lookup.json?id=1460323737035677698%2C1460323743339741184' \
    --header 'Authorization: Bearer $ACCESS_TOKEN'
  ```

  ```bash cURL (v2) theme={null}
  curl --request GET \
    --url 'https://api.x.com/2/tweets?ids=1460323737035677698%2C1460323743339741184&tweet.fields=created_at&expansions=author_id&user.fields=created_at' \
    --header 'Authorization: Bearer $ACCESS_TOKEN'
  ```

  ```python Python (v2) theme={null}
  import requests

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

  params = {
      "ids": "1460323737035677698,1460323743339741184",
      "tweet.fields": "created_at",
      "expansions": "author_id",
      "user.fields": "created_at"
  }

  headers = {"Authorization": f"Bearer {bearer_token}"}
  response = requests.get(url, headers=headers, params=params)

  print(response.json())
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # Get multiple Posts by IDs with fields and expansions
  response = client.posts.get_posts(
      ids=["1460323737035677698", "1460323743339741184"],
      tweet_fields=["created_at"],
      expansions=["author_id"],
      user_fields=["created_at"]
  )

  for post in response.data:
      print(f"Post: {post.text}")
      print(f"Created at: {post.created_at}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

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

  // Get multiple Posts by IDs with fields and expansions
  const response = await client.posts.getPosts({
    ids: ["1460323737035677698", "1460323743339741184"],
    tweetFields: ["created_at"],
    expansions: ["author_id"],
    userFields: ["created_at"],
  });

  response.data?.forEach((post) => {
    console.log(`Post: ${post.text}`);
    console.log(`Created at: ${post.created_at}`);
  });
  ```
</CodeGroup>

**Single Post lookup: v1.1 `GET statuses/show/:id` → v2 `GET /tweets/:id`**

<CodeGroup dropdown>
  ```bash cURL (v1.1) theme={null}
  curl --request GET \
    --url 'https://api.x.com/1.1/statuses/show.json?id=1460323737035677698' \
    --header 'Authorization: Bearer $ACCESS_TOKEN'
  ```

  ```bash cURL (v2) theme={null}
  curl --request GET \
    --url 'https://api.x.com/2/tweets/1460323737035677698?tweet.fields=created_at&expansions=author_id&user.fields=created_at' \
    --header 'Authorization: Bearer $ACCESS_TOKEN'
  ```

  ```python Python (v2) theme={null}
  import requests

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

  params = {
      "tweet.fields": "created_at",
      "expansions": "author_id",
      "user.fields": "created_at"
  }

  headers = {"Authorization": f"Bearer {bearer_token}"}
  response = requests.get(url, headers=headers, params=params)

  print(response.json())
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # Get a single Post by ID
  response = client.posts.get(
      "1460323737035677698",
      tweet_fields=["created_at"],
      expansions=["author_id"],
      user_fields=["created_at"]
  )

  print(f"Post: {response.data.text}")
  print(f"Created at: {response.data.created_at}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

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

  // Get a single Post by ID
  const response = await client.posts.get("1460323737035677698", {
    tweetFields: ["created_at"],
    expansions: ["author_id"],
    userFields: ["created_at"],
  });

  console.log(`Post: ${response.data?.text}`);
  console.log(`Created at: ${response.data?.created_at}`);
  ```
</CodeGroup>
