Q: I want to download all the data from the UN Comtrade database at once, can this only be done using the APIs, or is there another way of downloading all data simultaneously?
A: Owing to the data size, it’s no longer feasible to maintain a single file encompassing data for all countries (reporter=ALL) by period and classification in the new UN Comtrade as in the previous Comtrade (Legacy). New UN Comtrade disseminates new data items for IMTS 2010 (MoT, CPC, 2ndPartner, etc) when they are reported by the country. Including these new data items results in significantly larger files due to the increased volume of records.
Our Premium subscribers can download pre-packaged files by reporter-period-classification, referred to as bulk files, from the user interface or the bulk API (https://comtradeapi.un.org/bulk).
Users can also use the Data APIs (https://comtradeapi.un.org/data/v1/get) to download the data, but it may not be possible to get ALL the data on a single API call. Please keep in mind that a single time period can contain over 300 million records, and it’s not feasible to deliver all these results in a single response. Our API has a constraint allowing a maximum of 250,000 records per call, as detailed on our website under Premium Subscribers – UN Comtrade – UN Statistics Wiki.
For our premium users, we recommend opting for bulk file downloads when they require the entire dataset. Nevertheless, if the preference is to use the Data API, users can optimize their calls by applying filters for reporters, partners, commodity codes, or any other necessary parameters.