Provenance
Freshness & coverage
Methods (8)
searchExports
readUS exports by HS or NAICS code, country, month. Auto-routes to /exports/hs vs /exports/naics.
Required paramstimeUses ALL_VAL_MO + E_COMMODITY. Default COMM_LVL=HS4. Slice by time to cap.
searchImports
readUS imports by HS or NAICS code, country, month. Auto-routes to /imports/hs vs /imports/naics.
Required paramstimeUses GEN_VAL_MO + I_COMMODITY (NOT ALL_VAL_MO; that is exports-only).
searchTradeByPort
readHS commodity × US port × country (porths endpoints). Filter by port code.
Required paramsdirectionhsCodetimePort codes are Census 4-digit identifiers (e.g. 5301=Houston).
searchTradeByState
readHS commodity × US state × country (statehs endpoints). Filter by state postal code.
Required paramsdirectionhsCodetimeState filter is uppercase 2-letter (TX, CA, LA).
getTradeBalance
readConvenience: fetches both directions, returns {exportsValue, importsValue, balance}.
Required paramshsCodetimeHits 2 upstream endpoints in parallel. Sum is in dollars.
getCountryCodes
readBuilt-in Census Schedule C/D ↔ ISO lookup. Top 30 partners + USMCA/OECD/NATO/APEC.
Pass searchText to filter ("mex" → Mexico=2010). No upstream call.
lookupHsCode
readBuilt-in HS chapter index for petroleum, petrochem, steel, machinery, ores.
In-memory; covers chapters 26/27/28/29/39/72/73/84/85.
getServiceInfo
readEndpoints, common variables, country-code system, value-field asymmetry, time formats.
30-day cache. Use to discover the api before composing queries.
