{
  "openapi": "3.1.0",
  "info": {
    "title": "ImportExportAPI",
    "description": "ImportExportAPI is a free API and MCP server for global trade data: yearly bilateral trade flows (who exports what to whom, and for how much) for 200+ countries and 5,000+ products, from 2010 until now.\n\n## Authentication\n\nAll requests require a Bearer API key from your dashboard.\n\n```http\nAuthorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxx\n```\n\n## Rate limits\n\nPer-key sliding window. Exceeding it returns `429`.",
    "version": "1.0.0",
    "contact": {
      "email": "hello@importexportapi.com"
    }
  },
  "servers": [
    {
      "url": "https://api.importexportapi.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [],
  "paths": {
    "/trade": {
      "get": {
        "tags": [
          "Bilateral trade"
        ],
        "summary": "Raw trade observations",
        "description": "Individual exporter→importer→product→year flows, filtered by reporter, partner, product, flow direction and period.",
        "operationId": "getTrade",
        "parameters": [
          {
            "name": "reporter",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Reporter"
            }
          },
          {
            "name": "partner",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Partner"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product"
            }
          },
          {
            "name": "flow",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Flow"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 10000,
              "minimum": 1,
              "default": 1000,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_TradeObservation__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trade/summary": {
      "get": {
        "tags": [
          "Bilateral trade"
        ],
        "summary": "Aggregated trade metrics",
        "description": "Total value, quantity, growth, unit value, top partners and partner concentration (HHI) for any reporter/partner/product/period selection.",
        "operationId": "getTradeSummary",
        "parameters": [
          {
            "name": "reporter",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Reporter"
            }
          },
          {
            "name": "partner",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Partner"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product"
            }
          },
          {
            "name": "flow",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Flow"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_TradeSummary_"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/products": {
      "get": {
        "tags": [
          "Product trade"
        ],
        "summary": "Search products",
        "description": "Search the HS6 product catalog by code prefix or name.",
        "operationId": "searchProducts",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "title": "Q"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_ProductRow__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/products/{pid}": {
      "get": {
        "tags": [
          "Product trade"
        ],
        "summary": "Product metadata",
        "description": "Metadata for an HS6 code ('390210', 'hs:390210') or a 2-4 digit chapter prefix.",
        "operationId": "getProduct",
        "parameters": [
          {
            "name": "pid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_ProductDetail_"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/products/{pid}/trade": {
      "get": {
        "tags": [
          "Product trade"
        ],
        "summary": "Product trade series",
        "description": "Annual trade series for one product, optionally filtered by reporter/partner and flow direction.",
        "operationId": "getProductTrade",
        "parameters": [
          {
            "name": "pid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pid"
            }
          },
          {
            "name": "reporter",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Reporter"
            }
          },
          {
            "name": "partner",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Partner"
            }
          },
          {
            "name": "flow",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Flow"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_GroupedPoint__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/products/{pid}/markets": {
      "get": {
        "tags": [
          "Product trade"
        ],
        "summary": "Top markets for a product",
        "description": "Top exporting and importing countries for a product over a period.",
        "operationId": "getProductMarkets",
        "parameters": [
          {
            "name": "pid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 20,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_Markets_"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/countries": {
      "get": {
        "tags": [
          "Country trade"
        ],
        "summary": "Search countries",
        "description": "Search countries by name, ISO alpha-2 or alpha-3 code.",
        "operationId": "searchCountries",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "title": "Q"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_CountryRow__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/countries/{cid}": {
      "get": {
        "tags": [
          "Country trade"
        ],
        "summary": "Country metadata",
        "description": "Metadata for one country (id = ISO alpha-2).",
        "operationId": "getCountry",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_CountryDetail_"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/countries/{cid}/imports": {
      "get": {
        "tags": [
          "Country trade"
        ],
        "summary": "Country import series",
        "description": "Annual import value/quantity series for one country, optionally filtered by partner and product.",
        "operationId": "getCountryImports",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          },
          {
            "name": "partner",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Partner"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_GroupedPoint__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/countries/{cid}/exports": {
      "get": {
        "tags": [
          "Country trade"
        ],
        "summary": "Country export series",
        "description": "Annual export value/quantity series for one country, optionally filtered by partner and product.",
        "operationId": "getCountryExports",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          },
          {
            "name": "partner",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Partner"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_GroupedPoint__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/countries/{cid}/partners": {
      "get": {
        "tags": [
          "Country trade"
        ],
        "summary": "Country trading partners",
        "description": "A country's partners ranked by trade value, for either flow direction, optionally per product.",
        "operationId": "getCountryPartners",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          },
          {
            "name": "flow",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Flow"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_GroupedPoint__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/countries/{cid}/products": {
      "get": {
        "tags": [
          "Country trade"
        ],
        "summary": "Country product mix",
        "description": "What a country trades, grouped by HS6 product and ranked by value, for either flow direction.",
        "operationId": "getCountryProducts",
        "parameters": [
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Cid"
            }
          },
          {
            "name": "flow",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Flow"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope_list_GroupedPoint__"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sk_live_xxxxxxxxxxxxxxxxxxxx",
        "description": "API key from your importexportapi dashboard"
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "invalid_key",
              "message": "Invalid or missing API key"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "rate_limit_exceeded",
              "message": "Rate limit exceeded"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "CountryDetail": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "iso3": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iso3"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "is_group": {
            "type": "boolean",
            "title": "Is Group"
          },
          "region": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Region"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "is_group"
        ],
        "title": "CountryDetail"
      },
      "CountryRow": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "iso3": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iso3"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "is_group": {
            "type": "boolean",
            "title": "Is Group"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "is_group"
        ],
        "title": "CountryRow"
      },
      "Envelope_CountryDetail_": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CountryDetail"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[CountryDetail]"
      },
      "Envelope_Markets_": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Markets"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[Markets]"
      },
      "Envelope_ProductDetail_": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ProductDetail"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[ProductDetail]"
      },
      "Envelope_TradeSummary_": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/TradeSummary"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[TradeSummary]"
      },
      "Envelope_list_CountryRow__": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/CountryRow"
            },
            "type": "array",
            "title": "Data"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[list[CountryRow]]"
      },
      "Envelope_list_GroupedPoint__": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/GroupedPoint"
            },
            "type": "array",
            "title": "Data"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[list[GroupedPoint]]"
      },
      "Envelope_list_ProductRow__": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/ProductRow"
            },
            "type": "array",
            "title": "Data"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[list[ProductRow]]"
      },
      "Envelope_list_TradeObservation__": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/TradeObservation"
            },
            "type": "array",
            "title": "Data"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id",
            "default": ""
          },
          "duration_ms": {
            "type": "integer",
            "title": "Duration Ms",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Envelope[list[TradeObservation]]"
      },
      "GroupedPoint": {
        "properties": {
          "period": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period"
          },
          "partner": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Partner"
          },
          "exporter": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exporter"
          },
          "importer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Importer"
          },
          "hs6": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hs6"
          },
          "value_usd": {
            "type": "number",
            "title": "Value Usd"
          },
          "quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "flow_count": {
            "type": "integer",
            "title": "Flow Count"
          }
        },
        "type": "object",
        "required": [
          "value_usd",
          "quantity",
          "flow_count"
        ],
        "title": "GroupedPoint",
        "description": "One row of a grouped query; exactly one of the key fields is set."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "Markets": {
        "properties": {
          "top_exporters": {
            "items": {
              "$ref": "#/components/schemas/GroupedPoint"
            },
            "type": "array",
            "title": "Top Exporters"
          },
          "top_importers": {
            "items": {
              "$ref": "#/components/schemas/GroupedPoint"
            },
            "type": "array",
            "title": "Top Importers"
          }
        },
        "type": "object",
        "required": [
          "top_exporters",
          "top_importers"
        ],
        "title": "Markets"
      },
      "PeriodPoint": {
        "properties": {
          "period": {
            "type": "string",
            "title": "Period"
          },
          "value_usd": {
            "type": "number",
            "title": "Value Usd"
          }
        },
        "type": "object",
        "required": [
          "period",
          "value_usd"
        ],
        "title": "PeriodPoint"
      },
      "ProductDetail": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "matches": {
            "items": {
              "$ref": "#/components/schemas/ProductMatch"
            },
            "type": "array",
            "title": "Matches"
          }
        },
        "type": "object",
        "required": [
          "id",
          "matches"
        ],
        "title": "ProductDetail"
      },
      "ProductMatch": {
        "properties": {
          "hs6": {
            "type": "string",
            "title": "Hs6"
          },
          "hs_version": {
            "type": "integer",
            "title": "Hs Version"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "parent_hs4": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Hs4"
          }
        },
        "type": "object",
        "required": [
          "hs6",
          "hs_version",
          "name"
        ],
        "title": "ProductMatch"
      },
      "ProductRow": {
        "properties": {
          "hs6": {
            "type": "string",
            "title": "Hs6"
          },
          "hs_version": {
            "type": "integer",
            "title": "Hs Version"
          },
          "name": {
            "type": "string",
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "hs6",
          "hs_version",
          "name"
        ],
        "title": "ProductRow"
      },
      "TopPartner": {
        "properties": {
          "partner": {
            "type": "string",
            "title": "Partner"
          },
          "value_usd": {
            "type": "number",
            "title": "Value Usd"
          },
          "share": {
            "type": "number",
            "title": "Share"
          }
        },
        "type": "object",
        "required": [
          "partner",
          "value_usd",
          "share"
        ],
        "title": "TopPartner"
      },
      "TradeObservation": {
        "properties": {
          "exporter": {
            "type": "string",
            "title": "Exporter"
          },
          "importer": {
            "type": "string",
            "title": "Importer"
          },
          "hs6": {
            "type": "string",
            "title": "Hs6"
          },
          "hs_version": {
            "type": "integer",
            "title": "Hs Version"
          },
          "period": {
            "type": "string",
            "format": "date",
            "title": "Period"
          },
          "granularity": {
            "type": "string",
            "title": "Granularity"
          },
          "value_usd": {
            "type": "number",
            "title": "Value Usd"
          },
          "quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "quantity_unit": {
            "type": "string",
            "title": "Quantity Unit"
          }
        },
        "type": "object",
        "required": [
          "exporter",
          "importer",
          "hs6",
          "hs_version",
          "period",
          "granularity",
          "value_usd",
          "quantity",
          "quantity_unit"
        ],
        "title": "TradeObservation"
      },
      "TradeSummary": {
        "properties": {
          "trade_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trade Value"
          },
          "quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "growth": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Growth"
          },
          "unit_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Unit Value"
          },
          "top_partners": {
            "items": {
              "$ref": "#/components/schemas/TopPartner"
            },
            "type": "array",
            "title": "Top Partners"
          },
          "partner_concentration": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Partner Concentration"
          },
          "periods": {
            "items": {
              "$ref": "#/components/schemas/PeriodPoint"
            },
            "type": "array",
            "title": "Periods"
          }
        },
        "type": "object",
        "required": [
          "trade_value",
          "quantity",
          "growth",
          "unit_value",
          "top_partners",
          "partner_concentration",
          "periods"
        ],
        "title": "TradeSummary"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}