Usage API | Twitter API
Overview
Enterprise
It is the most important and best tool for helping to monitor and manage usage across the different APIs under your account.
Important Disclaimer:
The usage counts returned from the Usage API may not match those on a billing invoice due to trials and other billing adjustments. All numbers are based on deduped activities consumed within a given day (in UTC).
Features
- Programmatically retrieving usage data that is available in the console.gnip.com UI
- Stream level usage data - provides usage data at the stream level (e.g., dev and prod) in addition to the product level
- Granular and descriptive data - search “requests” are broken out by Full-Archive and 30-Day Search products
- Historical PowerTrack “days” and “jobs”
Supported APIs
Below is a list of the APIs currently supported by the Usage API:- PowerTrack API
enterprise - 30-Day Search API
enterprise - Full-Archive Search API
enterprise - Historical PowerTrack
enterprise
Limitations
- The Usage API allows you to access usage data since May 1, 2018. After July 1, 2019 Usage API allows you to access usage data for the trailing 13 calendar months
- You have the ability to access usage data in three month intervals defined with a fromDate and toDate
Sample Payload
Below is a sample of the payload:API reference
get-usage
Methods
Where:
- :account_name is the (case-sensitive) name associated with your account, as displayed at console.gnip.com
Authentication and Rate Limit
Authentication
All requests to the Usage API require HTTP Basic Authentication, using any of the email/password credentials enabled on your account to log into your account at console.gnip.com or connect to any Gnip stream.Rate Limit
The Usage API enforces a rate limit of two requests per minute.Best Practices & Limitations
Data Availability
Usage data is based on deduped activities consumed through the last full time period (UTC) that data was processed. Data is generally processed and updated up to the minute, except in cases where Gnip is deploying systems.- The Usage API allows you to access usage data since May 1, 2018. After July 1, 2019 Usage API allows you to access usage data for the trailing 13 calendar months.
- You have the ability to access usage data in three month intervals defined with a fromDate and toDate
Requesting and Receiving Data
The Usage API works by issuing an HTTP GET request with HTTP BASIC-AUTH credentials to the API endpoint for your account.GET Request:
Make a GET request to the following endpoint with your user credentials and account name: https://gnip-api.x.com/metrics/usage/accounts/:account\_name.json Additional Parameters
Example GET Request
This request will return data by month granularity from March 1, 2017 to March 5, 2017, not including any data from March 5, 2017.
curl -u “https://gnip-api.x.com/metrics/usage/accounts/:account\_name.json?bucket=month&fromdate=201403010000&toDate=201403150000”