# US Trade Flow by HS Code (Census Bureau via payai.agentstools.dev)

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

Returns US monthly import or export trade flow data for a commodity (by HS code), including monthly values, trend, and supplier-concentration index, optionally filtered by partner country.

## Facts

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

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-via-payai-agentstools-dev-d88f2cff
```

Example prompt: Pull me the US monthly import trade flow for HS code 8542 (integrated circuits) for 2023, and flag if China is a major supplier — include the supplier-concentration index.

## When to prefer this

Use this endpoint when you need structured, time-series US trade flow data for a specific commodity identified by HS/HTS code, including trend analysis and supply concentration metrics. Prefer this over raw Census Bureau APIs when you want normalized monthly values and a pre-computed concentration index without managing Census API credentials directly.

## Known failure modes

- Invalid or unrecognized HS code returns an error or empty result
- Census Bureau API key not configured — endpoint degrades cleanly but may return limited/no data
- Invalid direction value (not 'imports' or 'exports') returns a validation error
- Requested year outside available Census data range returns empty or error
- Invalid partner country code returns no filtered data or an error

## 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 trade values (in USD) for the requested commodity and direction, a computed trend indicator, a supplier-concentration index (e.g. HHI-style), and optionally data filtered by a specific partner country. Degrades gracefully if the Census API key is not configured.

## 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-via-payai-agentstools-dev-d88f2cff/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from payai.agentstools.dev](https://www.zero.xyz/host/payai.agentstools.dev/llms.txt)
