| period | Yes | Reference period to query. Annual: 4-digit year (e.g. "2022"). Monthly: YYYYMM (e.g. "202209" for Sep 2022). Comma-separated for multiple periods (e.g. "2020,2021,2022"). | |
| cmd_code | No | Commodity code filter. Use HS codes (e.g. "84" for machinery, "27" for petroleum, "TOTAL" for aggregate totals, "AG2" for all 2-digit chapters). Omit to return all commodities (may be large). Default: TOTAL. | |
| flow_code | Yes | Trade flow direction. M=Imports, X=Exports, MX=Both imports and exports, RM=Re-imports, RX=Re-exports. | |
| freq_code | No | Frequency. A=Annual (default), M=Monthly. | |
| type_code | No | Trade data type. C=Commodities (default), S=Services. | |
| max_records | No | Maximum number of records to return (1–500). Default 100. The public preview API is capped at 500 records per request. | |
| aggregate_by | No | Aggregate results by a dimension. Valid values: "cmdCode", "flowCode", "partnerCode", "reporterCode", "period". Omit to return unaggregated records. | |
| customs_code | No | Customs procedure code filter (e.g. "C00"=all procedures, "C03"=outright export, "C04"=warehousing). Omit for all procedures. | |
| partner_code | No | UN numeric code for the partner country. 0=World aggregate (all partners combined). Omit to return all individual partners. | |
| partner2_code | No | Secondary partner code for extended trade flow tracking (consignment country). 0=World aggregate. Omit to use the default world aggregate. | |
| reporter_code | Yes | UN numeric code for the reporting country (e.g. 276=Germany, 840=USA, 156=China, 826=UK). Use comtrade.reporters to look up codes. | |
| classification | No | Commodity classification system. HS=Harmonized System (default, most common). B4/B5=BEC, EB=EBOPS services, S1-S4/SS=SITC revisions. | |