# US Trade Flow by HS Code (Census Bureau)

> US Trade Flow by HS Code (Census Bureau) is a paid API for AI agents from api.agentstools.dev, paid per call via x402, $0.015/call, status unknown (last checked 2026-09-14).

Returns monthly US import or export trade values, trend, and supplier-concentration index for a given HS commodity code, with optional partner-country filtering.

## Facts

- Endpoint: GET https://api.agentstools.dev/trade/flow
- Price: $0.015/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/us-trade-flow-by-hs-code-census-bureau-21454125
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_CjI_mPEZOm8zbqzVuQX6J

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability us-trade-flow-by-hs-code-census-bureau-21454125
```

Example prompt: Can you pull the US import trade flow for HS code 847130 (laptops) for 2023, filtered to China as the partner country, and tell me the monthly values and how concentrated the supplier base is?

## When to prefer this

Use this endpoint when you need structured, monthly-level US import or export trade data for a specific commodity (by HS/HTS code) sourced directly from the Census Bureau, especially when you also want a pre-computed trend and supplier-concentration metric rather than raw data. Prefer this over general web searches or custom Census API queries when you need a clean, agent-ready JSON response with analytical enrichment.

## Known failure modes

- Invalid or unrecognized HS code returns an error or empty dataset
- Census Bureau API key not configured causes graceful degradation with a clear error message
- Partner country code not found in Census data returns empty results
- Year requested is outside available Census data range
- Rate limit or upstream Census API outage causes timeout or 5xx response

## How this service works

US monthly import or export trade flow for a commodity from the Census Bureau. Give an HS code, a direction and an optional partner country and get monthly values, a trend and a supplier-concentration index. Degrades cleanly when the Census key is not configured.

## Output

Returns monthly import or export trade values for the specified HS commodity code and year, along with a computed trend direction and a supplier-concentration index indicating how reliant US trade is on a small number of partners. Optionally filtered to a single Census partner country.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "hs6"
     ],
     "properties": {
      "hs6": {
       "type": "string",
       "description": "HS or HTS code, 2 to 10 digits, dots optional"
      },
      "year": {
       "type": "integer",
       "description": "Calendar year, defaults to recent"
      },
      "partner": {
       "type": "string",
       "description": "Optional Census partner country code to filter by"
      },
      "direction": {
       "enum": [
        "imports",
        "exports"
       ],
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/us-trade-flow-by-hs-code-census-bureau-21454125/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.agentstools.dev](https://www.zero.xyz/host/api.agentstools.dev/llms.txt)
