> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Query trade market statistics and monthly trends

> Global Trade & Customs API (trade.stats.query)

## 请求规范

* **方法与路径:** POST /apis/v1/trade/stats/query
* **可用状态:** enabled
* **请求 URL 模板:** `https://api.aisa.one/apis/v1/trade/stats/query`

[完整 OpenAPI 定义](https://aisa.one/docs/openapi/zh/trade.json)

有效请求声明（包括认证和引用的 schema）：

```json theme={null}
{
  "operationId": "trade.stats.query",
  "method": "POST",
  "path": "/apis/v1/trade/stats/query",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "examples": {
          "default": {
            "value": {
              "basis": [
                "records",
                "official"
              ],
              "hs_code": "847130",
              "importer_country": "US",
              "top": 10
            }
          },
          "minimal": {
            "value": {
              "basis": [
                "records",
                "official"
              ],
              "hs_code": "847130",
              "importer_country": "US",
              "top": 10
            }
          }
        },
        "schema": {
          "additionalProperties": false,
          "allOf": [
            {
              "anyOf": [
                {
                  "properties": {
                    "company": {}
                  },
                  "required": [
                    "company"
                  ]
                },
                {
                  "properties": {
                    "hs_code": {}
                  },
                  "required": [
                    "hs_code"
                  ]
                },
                {
                  "properties": {
                    "product": {}
                  },
                  "required": [
                    "product"
                  ]
                }
              ]
            }
          ],
          "properties": {
            "basis": {
              "default": [
                "records",
                "official"
              ],
              "items": {
                "enum": [
                  "official",
                  "records"
                ],
                "type": "string"
              },
              "maxItems": 2,
              "minItems": 1,
              "type": "array"
            },
            "company": {
              "maxLength": 200,
              "minLength": 2,
              "type": "string"
            },
            "exporter_country": {
              "maxLength": 80,
              "minLength": 2,
              "type": "string"
            },
            "hs_code": {
              "maxLength": 10,
              "minLength": 2,
              "pattern": "^[0-9]{2,10}$",
              "type": "string"
            },
            "importer_country": {
              "maxLength": 80,
              "minLength": 2,
              "type": "string"
            },
            "product": {
              "maxLength": 100,
              "minLength": 2,
              "type": "string"
            },
            "role": {
              "enum": [
                "exporter",
                "importer"
              ],
              "type": "string"
            },
            "since": {
              "maxLength": 10,
              "minLength": 10,
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
              "type": "string"
            },
            "top": {
              "default": 20,
              "maximum": 50,
              "minimum": 1,
              "type": "integer"
            },
            "until": {
              "maxLength": 10,
              "minLength": 10,
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
              "type": "string"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "x-aisa-status": "enabled",
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## 费用与请求规则

公开参考价格：每次成功请求 \$0.1 USD。 账户适用价格可能不同；支持报价的接口可按实际请求获取报价。


## OpenAPI

````yaml openapi/zh/trade.json POST /apis/v1/trade/stats/query
openapi: 3.1.0
info:
  description: ''
  title: Global Trade & Customs
  version: '1'
  x-aisa-capabilities:
    idempotency: Idempotency-Key
    max_price: X-AISA-Max-Price-USD
    quote:
      header: X-AISA-Cost-Mode
      value: quote
  x-aisa-catalogs:
    trade:
      description: ''
      title: Global Trade & Customs
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
      x-aisa-document:
        facts_hash: 04609443cc30a0604ea1e6aabafe6ce20e6610145902fdad90731566707b2b23
        generator_version: '3'
        protocol_version: '1'
        schema_version: '1'
      x-aisa-plans:
        builder: 1
        display_plan: payg
        payg: 1
        similarweb_payg: 1
        team: 1
        version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-configured-paths:
    - /apis/v1/trade/companies/lookup
    - /apis/v1/trade/companies/search
    - /apis/v1/trade/companies/{id}
    - /apis/v1/trade/companies/{id}/contacts
    - /apis/v1/trade/companies/{id}/partners
    - /apis/v1/trade/companies/{id}/shipments
    - /apis/v1/trade/coverage
    - /apis/v1/trade/hs-codes
    - /apis/v1/trade/leads/find
    - /apis/v1/trade/markets/brief
    - /apis/v1/trade/shipments/search
    - /apis/v1/trade/stats/query
  x-aisa-document:
    composer_version: '31'
    document_hash: sha256:2701c7a014a31cae225348fbb39fce0f5996d7cf9e0f2480b35662ee4f9b1b6a
    facts_hash: 04609443cc30a0604ea1e6aabafe6ce20e6610145902fdad90731566707b2b23
    generator_version: '3'
    protocol_version: '1'
    response_pending: []
    schema_version: '1'
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: trade
servers:
  - url: https://api.aisa.one
security:
  - bearerAuth: []
paths:
  /apis/v1/trade/stats/query:
    post:
      tags:
        - Global Trade & Customs
      summary: Query trade market statistics and monthly trends
      description: Global Trade & Customs API (trade.stats.query)
      operationId: trade.stats.query
      requestBody:
        content:
          application/json:
            examples:
              default:
                value:
                  basis:
                    - records
                    - official
                  hs_code: '847130'
                  importer_country: US
                  top: 10
              minimal:
                value:
                  basis:
                    - records
                    - official
                  hs_code: '847130'
                  importer_country: US
                  top: 10
            schema:
              additionalProperties: false
              allOf:
                - anyOf:
                    - properties:
                        company: {}
                      required:
                        - company
                    - properties:
                        hs_code: {}
                      required:
                        - hs_code
                    - properties:
                        product: {}
                      required:
                        - product
              properties:
                basis:
                  default:
                    - records
                    - official
                  items:
                    enum:
                      - official
                      - records
                    type: string
                  maxItems: 2
                  minItems: 1
                  type: array
                company:
                  maxLength: 200
                  minLength: 2
                  type: string
                exporter_country:
                  maxLength: 80
                  minLength: 2
                  type: string
                hs_code:
                  maxLength: 10
                  minLength: 2
                  pattern: ^[0-9]{2,10}$
                  type: string
                importer_country:
                  maxLength: 80
                  minLength: 2
                  type: string
                product:
                  maxLength: 100
                  minLength: 2
                  type: string
                role:
                  enum:
                    - exporter
                    - importer
                  type: string
                since:
                  maxLength: 10
                  minLength: 10
                  pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}$
                  type: string
                top:
                  default: 20
                  maximum: 50
                  minimum: 1
                  type: integer
                until:
                  maxLength: 10
                  minLength: 10
                  pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}$
                  type: string
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  data:
                    additionalProperties: false
                    description: The statistics, one part for each kind of number.
                    properties:
                      coverage:
                        additionalProperties: false
                        description: How the two kinds of numbers compare.
                        properties:
                          recorded_value_share:
                            description: >-
                              Recorded value divided by the official value for
                              the same months. Shows how much of real trade the
                              recorded values stand for.
                            type:
                              - number
                              - 'null'
                        required:
                          - recorded_value_share
                        type: object
                      official:
                        anyOf:
                          - additionalProperties: false
                            properties:
                              by_month:
                                description: >-
                                  One entry for each published month, oldest
                                  first.
                                items:
                                  additionalProperties: false
                                  properties:
                                    month:
                                      description: '`YYYY-MM`'
                                      type: string
                                    partial:
                                      description: >-
                                        True while more partners can still add
                                        their numbers for the month. Do not read
                                        it as a drop.
                                      type: boolean
                                    value_usd:
                                      description: Trade value of the month, in US dollars.
                                      type: number
                                  required:
                                    - month
                                    - value_usd
                                  type: object
                                type: array
                              by_partner_country:
                                description: The partner countries, largest first.
                                items:
                                  additionalProperties: false
                                  properties:
                                    country:
                                      description: >-
                                        ISO 3166-1 alpha-2 country code, such as
                                        `US`.
                                      type: string
                                    share:
                                      description: >-
                                        This country's part of everything the
                                        reporter imports or exports of the
                                        product in the period, from 0 to 1.
                                      type: number
                                    value_usd:
                                      description: >-
                                        Trade value with this country, in US
                                        dollars.
                                      type: number
                                  required:
                                    - country
                                    - value_usd
                                    - share
                                  type: object
                                type: array
                              cif_value_usd:
                                description: >-
                                  For US imports: the value including insurance
                                  and freight.
                                type:
                                  - number
                                  - 'null'
                              flow:
                                description: >-
                                  Whether these are the reporter's imports or
                                  its exports.
                                enum:
                                  - import
                                  - export
                                type: string
                              mirror:
                                description: >-
                                  True when the reporter publishes no recent
                                  statistics of its own and these numbers add up
                                  what its partners report about their trade
                                  with it: their imports from it at CIF for its
                                  exports, their exports to it at FOB for its
                                  imports. Partners that publish nothing are
                                  missing, so it is a lower bound.
                                type: boolean
                              missing_months:
                                description: >-
                                  Months inside `period` the office published
                                  nothing for, of any product: they are missing
                                  from `by_month` and from `value_usd`, not
                                  months without trade. Left out when none are.
                                items:
                                  type: string
                                type: array
                              period:
                                additionalProperties: false
                                description: >-
                                  The first and the last month the numbers
                                  cover.
                                properties:
                                  since:
                                    description: '`YYYY-MM`'
                                    type: string
                                  until:
                                    description: '`YYYY-MM`'
                                    type: string
                                required:
                                  - since
                                  - until
                                type: object
                              quantity:
                                description: >-
                                  Quantity of the period, where the office
                                  measures one in a single unit for every
                                  partner and month. Left out otherwise.
                                type:
                                  - number
                                  - 'null'
                              quantity_unit:
                                description: >-
                                  Unit of `quantity`: `u` items, `kg`, `l`,
                                  `m2`, `pairs` and so on.
                                type:
                                  - string
                                  - 'null'
                              reporter:
                                description: Country whose statistics these are, or `EU`.
                                type: string
                              source:
                                const: official_statistics
                                description: Marks these numbers as official statistics.
                                type: string
                              stopped_reporting:
                                description: >-
                                  With `mirror`: partners whose numbers stop for
                                  six months or more while the others go on,
                                  most likely because they have published
                                  nothing since, or publish late. The months
                                  after their `last_month` look lower than the
                                  trade was. Left out when none did.
                                items:
                                  additionalProperties: false
                                  properties:
                                    country:
                                      description: >-
                                        ISO 3166-1 alpha-2 country code, such as
                                        `US`.
                                      type: string
                                    last_month:
                                      description: >-
                                        The last month with its numbers,
                                        `YYYY-MM`.
                                      type: string
                                    share:
                                      description: >-
                                        Its part of `value_usd`, from 0 to 1,
                                        all of it from before it stopped.
                                      type: number
                                  required:
                                    - country
                                    - last_month
                                    - share
                                  type: object
                                type: array
                              unit_value_usd:
                                description: >-
                                  `value_usd` divided by `quantity`: the average
                                  price of one unit.
                                type:
                                  - number
                                  - 'null'
                              value_basis:
                                description: >-
                                  How `value_usd` is valued: customs value,
                                  cost-insurance-freight or free on board.
                                enum:
                                  - customs
                                  - cif
                                  - fob
                                type: string
                              value_usd:
                                description: Trade value of the period, in US dollars.
                                type: number
                            required:
                              - reporter
                              - flow
                              - period
                              - value_usd
                              - value_basis
                              - by_partner_country
                              - by_month
                              - source
                            type: object
                          - type: 'null'
                        description: >-
                          Official trade statistics. Use these for market size
                          and country shares.
                      records:
                        anyOf:
                          - additionalProperties: false
                            properties:
                              by_exporter_country:
                                anyOf:
                                  - items:
                                      additionalProperties: false
                                      properties:
                                        country:
                                          description: >-
                                            ISO 3166-1 alpha-2 country code, such as
                                            `US`.
                                          type: string
                                        shipments:
                                          description: >-
                                            Number of shipment records. A count of
                                            records, not a market share: countries
                                            that publish every declaration are
                                            over-represented.
                                          type: integer
                                      required:
                                        - country
                                        - shipments
                                      type: object
                                    type: array
                                  - type: 'null'
                                description: >-
                                  Records by exporting country, largest first.
                                  Null when it could not be loaded.
                              by_importer_country:
                                anyOf:
                                  - items:
                                      additionalProperties: false
                                      properties:
                                        country:
                                          description: >-
                                            ISO 3166-1 alpha-2 country code, such as
                                            `US`.
                                          type: string
                                        shipments:
                                          description: >-
                                            Number of shipment records. A count of
                                            records, not a market share: countries
                                            that publish every declaration are
                                            over-represented.
                                          type: integer
                                      required:
                                        - country
                                        - shipments
                                      type: object
                                    type: array
                                  - type: 'null'
                                description: >-
                                  Records by importing country, largest first.
                                  Null when it could not be loaded.
                              by_month:
                                description: >-
                                  One entry for each month of the range, oldest
                                  first.
                                items:
                                  additionalProperties: false
                                  properties:
                                    month:
                                      description: '`YYYY-MM`'
                                      type: string
                                    partial:
                                      description: >-
                                        True when the month is not complete yet.
                                        Do not read it as a drop.
                                      type: boolean
                                    recorded_value_usd:
                                      description: >-
                                        Declared value of the month's records
                                        that have one, in US dollars.
                                      type:
                                        - number
                                        - 'null'
                                    shipments:
                                      description: Shipment records of the month.
                                      type: integer
                                  required:
                                    - month
                                    - shipments
                                    - recorded_value_usd
                                    - partial
                                  type: object
                                type: array
                              company_match:
                                description: >-
                                  With `company`: how its records were found.
                                  `id` counts the company itself, by its ID,
                                  over the last 12 months. `name` matches its
                                  name as it stands in the records, so companies
                                  that share the name count together.
                                enum:
                                  - id
                                  - name
                                type: string
                              recorded_value_usd:
                                description: >-
                                  Sum of the declared values of the records that
                                  have one, in US dollars. A lower bound: US
                                  bills of lading carry no value.
                                type:
                                  - number
                                  - 'null'
                              shipments:
                                description: >-
                                  Number of shipment records. A count of
                                  records, not a market share: countries that
                                  publish every declaration are
                                  over-represented.
                                type: integer
                            required:
                              - shipments
                              - recorded_value_usd
                              - by_importer_country
                              - by_exporter_country
                              - by_month
                            type: object
                          - type: 'null'
                        description: >-
                          Counts and declared values of our shipment records.
                          Not official trade totals.
                    required:
                      - records
                      - official
                      - coverage
                    type: object
                  notice:
                    description: >-
                      A plain sentence when there is something to know about
                      this result: why a part is missing, or what to try next.
                      Null otherwise.
                    type:
                      - string
                      - 'null'
                  query:
                    additionalProperties: {}
                    description: >-
                      The request as it was understood: country names as codes,
                      the default dates filled in. `data_through` says how
                      recent the records behind the answer are.
                    properties:
                      data_through:
                        description: >-
                          Date of the latest record this query can see,
                          `YYYY-MM-DD`. Records arrive weeks after a shipment,
                          so recent months are incomplete.
                        type:
                          - string
                          - 'null'
                    required:
                      - data_through
                    type: object
                required:
                  - data
                  - query
                  - notice
                type: object
          description: Normalized successful response
        default:
          content:
            application/json:
              schema: {}
          description: >-
            Error response; upstream passthrough responses may use provider
            formats
      x-codeSamples:
        - label: Reference example
          lang: text
          source: >-
            # Fixed reference example. Playground inputs do not update this
            sample.

            curl --request POST \
              --url https://api.aisa.one/apis/v1/trade/stats/query \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
              "basis": [
                "records",
                "official"
              ],
              "hs_code": "847130",
              "importer_country": "US",
              "top": 10
            }'
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.