Basic rate limit restrictions listed below. For details on how to
register a valid token, see ct_register_token
. For API docs
on rate limits, see https://comtrade.un.org/data/doc/api/#Limits
Without authentication token: 1 request per second, 100 requests
per hour (each per IP address).
With valid authentication token: 1 request per second, 10,000
requests per hour (each per IP address or authenticated user).
In addition to these rate limits, the API imposes some limits on
parameter combinations, they are listed below:
Between params "reporters", "partners", and the query date range (as
dictated by the two params "start_date" and "end_date"), only one of
these three may use the catch-all input "All".
For the same group of three ("reporters", "partners", date range),
if the input is not "All", then the maximum number of input values
for each is five. For date range, if not using "All", then the
"start_date" and "end_date" must not span more than five months or five
years. There is one exception to this rule, if arg "freq" is "monthly",
then a single year can be passed to "start_date" and "end_date" and the
API will return all of the monthly data for that year.
For param "commod_codes", if not using input "All", then the maximum
number of input values is 20 (although "All" is always a valid input).
This function returns objects with metadata related to the API call that
can be accessed via attributes
. The metadata accessible is:
url: url of the API call.
time_stamp: date-time of the API call.
req_duration: total duration of the API call, in seconds.
For args start_date
and end_date
, if inputting a date (as
opposed to the catch-all input "all"), valid input format is dependent on
the input passed to arg freq
. If freq
is "annual",
start_date
and end_date
must be either a string w/ format
"yyyy" or "yyyy-mm-dd", or a year as an integer (so "2016", "2016-01-01",
and 2016 would all be valid). If freq
is "monhtly",
start_date
and end_date
must be a string with format
"yyyy-mm" or "yyyy-mm-dd" (so "2016-02" and "2016-02-01" would both be
valid).