Enterprise compared to X API v2
Similarities- Pagination
- Timezone
- Support for Post edit history and metadata.
- 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 withsince_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 and thePost edits fundamentals page 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
- 30 day -
- 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
- Recent (7 day) -
id
and text
fields by default. To request any additional fields or objects, you will need to use the fields and 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.
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 and user objects.
- At the JSON root level, the standard endpoints return Post objects in a
statuses
array, while X API v2 returns adata
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
anduser.translator_type
are being removed. - Instead of using both
favorites
(in Post object) andfavourites
(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.
- A conversation_id field
- Two new annotations fields, including context and entities
- Several new metrics fields
- A new
reply_setting
field, which shows you who can reply to a given Post
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 |