Enterprise compared to X API v2
Similarities- Granularity
- Pagination
- Timezone
- Endpoint URLs
- App and Project requirement
- Available time periods
- Response data format
- HTTP methods
- Request time formats
- Request parameters
- Filtering operators
Similarities
Granularity While the parameter for selecting granularity of the returned data is different (bucket for the enterprise version, granularity for the v2 version), the values that you can pass with that parameter are the same, as well as the default behavior:
dayhour(default)minute
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).
If you are using the enterprise version, you will use the next parameter to paginate, the next token field will be called next, and it will be located at the root in the response.
If you are using v2, you can use either the next_token or pagination_token parameter to paginate, and your next token will be located at meta.next_token in the response.
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.
Differences
Endpoint URLs- Enterprise endpoints:
- 30 day -
http://gnip-api.x.com/search/30day/accounts/:account_name/:label/counts.json - Full-archive -
http://gnip-api.x.com/search/fullarchive/accounts/:account_name/:label/counts.json
- 30 day -
- X API v2 endpoints
- Recent (7 day) -
https://api.x.com/2/tweets/counts/recent - Full-archive -
https://api.x.com/2/tweets/counts/all
- Recent (7 day) -
- Enterprise’s counts data is located within a
resultsobject, while the v2 counts data is located within a data object. - Enterprise’s counts fields are called
timePeriod(start time) andcount, while v2 breaks out the time period into astartandendfield (which use a different date/time format from enterprise explained in request time formats), and renamed the count field totweet_count. - The enterprise metadata includes
totalCount,next, and therequestParametersobject at the root level. Instead,v2 doesn’t include the requestParameters object, and moves/renames the following into ametaobject that lives at the root level:total_tweet_count&next_token.
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 |
| bucket | granularity |
| 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 and pagination_token |
API reference index
For a complete API reference, please select an endpoint from below.Recent Post counts
| Receive a count of Posts that match a query in the last 7 days | [GET /2/tweets/counts/recent](/x-api/posts/tweet-counts#api-reference-index/get-tweets-counts-recent) |
Full-archive Post counts
Only available to those with Pro and Enterprise access| Receive a count of Posts that match a query | [GET /2/tweets/counts/all](/x-api/posts/tweet-counts#api-reference-index/get-tweets-counts-all) |