> ## 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 (Enterprise)

### Enterprise compared to X API v2

**Similarities**

* Pagination
* Timezone
* Support for Post edit history and metadata. 

**Differences**

* Endpoint URLs
* App and Project requirement
* Available time periods
* Response data format
* HTTP methods
* Request time formats
* Request parameters
* Filtering operators

#### Similarities

**Pagination**

While v2 has additional pagination features (new pagination parameters that allow you to navigate using Post IDs with `since_id` and `until_id`), both enterprise and v2 allow you to paginate using time (`fromDate` and `toDate` with enterprise, and `start_time` and `end_time` for v2).
 

**Timezone**

As noted in the pagination section, you can navigate different pages of data using time for both enterprise and v2. In both cases, you will be using UTC as the timezone when using these parameters.

**Support for Post edit history and metadata**

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

#### Differences

**Endpoint URLs**

* Enterprise endpoints:
  * 30 day - `http://gnip-api.x.com/search/30day/accounts/:account_name/:label.json`
  * Full-archive - `http://gnip-api.x.com/search/fullarchive/accounts/:account_name/:label.json`
* X API v2 endpoints
  * Recent (7 day) - `https://api.x.com/2/tweets/search/recent`
  * Full-archive - `https://api.x.com/2/tweets/search/all`

**App and Project requirement**

The X API v2 endpoints require that you use credentials from a Project when authenticating your requests. All X API v1.1 endpoints can use credentials from Apps or Apps associated with an App.
 

**Available time periods**

Both the enterprise API and X API v2 offer endpoints that allow you to retrieve filtered Post data for the full-archive of Posts.

However, the X API v2 does not offer a 30 day time period endpoint like the enterprise API does. Instead it offers the aforementioned full-archive, or a 7 day time period, which align with the Native Enriched to v2 and [Activity Streams to v2](/x-api/migrate/data-format-migration#migrating-from-activity-streams-data-format-to-v2) which can help you map enterprise fields to the newer v2 fields. This guide will also provide you the specific expansion and field parameter that you will need to pass with your v2 request to return specific fields.
 

**Response data format**

One of the biggest differences between the [enterprise response format](https://developer.x.com/x-api/enterprise-gnip-2.0/fundamentals/data-dictionary) and[X API v2’s format](/x-api/fundamentals/data-dictionary) is how you select which fields return in your payload.

For the enterprise Search API, you receive many of the response fields by default, and then have the option to use parameters to identify which fields or sets of fields should return in the payload.

The X API v2 version only delivers the Post `id` and `text` fields by default. To request any additional fields or objects, you will need to use the [fields](/x-api/fundamentals/fields) and [expansions](/x-api/fundamentals/expansions) parameters. Any Post fields that you request from these endpoints will return in the primary Post object. Any expanded user, media, poll, or place objects and fields will return in an `includes` object within your response. You can then match any expanded objects back to the Post object by matching the IDs located in both the Post and the expanded object.

We encourage you to read more about these new parameters in their respective guides, or by reading our guide on [how to use fields and expansions](/x-api/fundamentals/data-dictionary#how-to-use-fields-and-expansions).

In addition to the changes in how you request certain fields, X API v2 is also introducing new JSON designs for the objects returned by the APIs, including [Post](/x-api/fundamentals/data-dictionary#tweet) and [user](/x-api/fundamentals/data-dictionary#user) objects.

* At the JSON root level, the standard endpoints return Post objects in a `statuses` array, while X API v2 returns a `data` array.
* Instead of referring to Retweeted and Quoted "statuses", X API v2 JSON refers to Retweeted and Quoted Tweets. Many legacy and deprecated fields, such as `contributors` and `user.translator_type` are being removed.
* Instead of using both `favorites` (in Post object) and `favourites` (in user object), X API v2 uses the term like.
* X is adopting the convention that JSON values with no value (for example, `null`) are not written to the payload. Post and user attributes are only included if they have non-null values.
   

We also introduced a new set of fields to the Post object including the following:

* A [conversation\_id](/x-api/fundamentals/conversation-id) field
* Two new [annotations](/x-api/fundamentals/post-annotations) fields, including context and entities
* Several new [metrics](/x-api/fundamentals/metrics) fields
* A new `reply_setting` field, which shows you who can reply to a given Post

And one last note. The premium response includes a `requestParameters` object at the root level, which contains the parameters that you included in your request. The v2 version instead contains a `meta` object that lives at the root level which includes the `newest_id`, `oldest_id`, `result_count`, and `next_token` if there is an additional page of results.

**HTTP methods**

The enterprise version of the API allows you to pass the request as either a POST HTTP method with a JSON body, or a GET HTTP method with a query string.

V2 only allows you to use the GET HTTP method with a query string.
 

**Request time formats**

The enterprise version of this endpoint uses the following date/time format in both the pagination parameters and the `timePeriod` response field: `YYYYMMDDHHmm`

The v2 endpoint uses ISO 8601/RFC 3339 date/time format in both the pagination parameters and the `start` and `end` response fields: `YYYY-MM-DDTHH:mm:ssZ
 `

**Request parameters**

The following is a table of the request parameters for enterprise and X API v2:

| Enterprise            | Search Posts v2                    |
| :-------------------- | :--------------------------------- |
| query                 | query                              |
| maxResults            | max\_results                       |
| fromDate (YYMMDDHHmm) | start\_time (YYYY-MM-DDTHH:mm:ssZ) |
| toDate (YYMMDDHHmm)   | end\_time (YYYY-MM-DDTHH:mm:ssZ)   |
|                       | since\_id                          |
|                       | until\_id                          |
| next                  | next\_token or pagination\_token   |

**Filtering operators**

While the operators between enterprise and X API v2 are mostly the same, there are some differences in operator availability and some new operators that were introduced to just the X API v2 version.

To see a full table of the operators that are available for X API v2, enterprise, and even premium and standard, please visit the [Search Posts migration landing page](/x-api/posts/search/migrate/overview).

**Next steps**

[Check out our quick start guide for X API v2 full-archive search](/x-api/posts/search/quickstart/full-archive-search)

[Review the API reference for full-archive search](/x-api/posts/full-archive-search)

[Check out some sample code for these endpoints](https://github.com/xdevplatform/Twitter-API-v2-sample-code)
