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

# GetCountryProducts

> GetCountryProducts returns the seeded bilateral-HS4 import basket for a country. PRO-gated. Requires entitlement tier >= 1.



## OpenAPI

````yaml /api/SupplyChainService.openapi.yaml get /api/supply-chain/v1/get-country-products
openapi: 3.1.0
info:
  title: SupplyChainService API
  version: 1.0.0
servers:
  - url: https://api.worldmonitor.app
security:
  - WorldMonitorKey: []
  - ApiKeyHeader: []
paths:
  /api/supply-chain/v1/get-country-products:
    get:
      tags:
        - SupplyChainService
      summary: GetCountryProducts
      description: >-
        GetCountryProducts returns the seeded bilateral-HS4 import basket for a
        country. PRO-gated. Requires entitlement tier >= 1.
      operationId: GetCountryProducts
      parameters:
        - name: iso2
          in: query
          description: >-
            ISO 3166-1 alpha-2 country code whose strategic products should be
            returned.
          required: true
          example: US
          schema:
            type: string
            pattern: ^[A-Z]{2}$
        - name: hs4
          in: query
          description: >-
            Optional requested heading; permits bounded recovery of a missing
            product.
          required: false
          example: example
          schema:
            type: string
        - name: jmespath
          in: query
          description: >-
            Optional JMESPath expression applied server-side to project or
            reduce the JSON response before it is returned (mirrors the MCP
            jmespath argument). Invalid expressions, expressions larger than
            1024 UTF-8 bytes, or projections that exceed the 256 KB output cap
            return HTTP 400 with a {_jmespath_error, original_keys} envelope.
            Grammar and worked examples:
            https://www.worldmonitor.app/docs/mcp-jmespath.
          required: false
          example: keys(@)
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                evidence:
                  lastAttemptAt: '2026-01-15T12:00:00Z'
                  lastAttemptState: example
                  missingHs4s:
                    - example
                  requestedHs4s:
                    - example
                  source: example
                fetchedAt: '2026-01-15T12:00:00Z'
                iso2: US
                products:
                  - denominatorBasis: example
                    description: Example WorldMonitor observation.
                    hs4: example
                    topExporters:
                      - netWeightKg: 1.5
                        partnerCode: 1
                        partnerIso2: US
                        share: 1.5
                        value: 1.5
                    totalValue: 1
              schema:
                $ref: '#/components/schemas/GetCountryProductsResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ValidationError'
                  - $ref: '#/components/schemas/JmespathProjectionError'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: PRO entitlement access denied.
          headers:
            X-Billing-Verification:
              description: >-
                Present when the 403 is a billing-provider-confirmed
                subscription lapse (value subscription_lapsed, matching the body
                `code`).
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '429':
          description: Rate limit exceeded.
          headers:
            X-RateLimit-Limit:
              description: Maximum requests allowed in the active rate-limit window.
              schema:
                type: string
            X-RateLimit-Remaining:
              description: Requests remaining in the active rate-limit window.
              schema:
                type: string
            X-RateLimit-Reset:
              description: >-
                Unix epoch milliseconds when the active rate-limit window
                resets.
              schema:
                type: string
            Retry-After:
              description: Seconds to wait before retrying the request.
              schema:
                type: string
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Error'
                  - $ref: '#/components/schemas/RateLimitError'
        '503':
          description: >-
            Service unavailable. Billing-verification responses include code and
            X-Billing-Verification; other gateway infrastructure failures use
            the generic GatewayError shape.
          headers:
            Retry-After:
              description: Seconds to wait before retrying (1-60).
              schema:
                type: string
            X-Billing-Verification:
              description: >-
                Billing-verification state that produced this response (matches
                the body `code`).
              schema:
                type: string
            X-Validation-Mode:
              description: >-
                Present with value degraded when user API-key validation is
                temporarily unavailable.
              schema:
                type: string
            X-RateLimit-Mode:
              description: >-
                Present with value degraded when a fail-closed rate-limit
                dependency is unavailable.
              schema:
                type: string
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/BillingVerificationError'
                  - $ref: '#/components/schemas/GatewayError'
        default:
          description: Gateway or handler error response.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Error'
                  - $ref: '#/components/schemas/GatewayError'
      security:
        - WorldMonitorKey: []
        - ApiKeyHeader: []
        - BearerAuth: []
components:
  schemas:
    GetCountryProductsResponse:
      type: object
      properties:
        iso2:
          type: string
        products:
          type: array
          items:
            $ref: '#/components/schemas/CountryProduct'
        fetchedAt:
          type: string
          description: >-
            ISO timestamp from the seeded payload (empty when no data is
            cached).
        evidence:
          $ref: '#/components/schemas/CountryProductEvidence'
    ValidationError:
      type: object
      properties:
        violations:
          type: array
          items:
            $ref: '#/components/schemas/FieldViolation'
          description: List of validation violations
      required:
        - violations
      description: >-
        ValidationError is returned when request validation fails. It contains a
        list of field violations describing what went wrong.
    JmespathProjectionError:
      description: >-
        Returned when a REST jmespath projection is invalid or exceeds the
        expression/output byte limits.
      properties:
        _jmespath_error:
          description: Projection error discriminator and details.
          type: string
        original_keys:
          description: Top-level keys or shape of the unprojected response.
          items:
            type: string
          type: array
      required:
        - _jmespath_error
        - original_keys
      type: object
    UnauthorizedError:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
      required:
        - error
      description: >-
        Returned when the API key is missing, malformed, or lacks current API
        access.
    ForbiddenError:
      type: object
      properties:
        error:
          type: string
          description: Human-readable entitlement failure reason.
        code:
          type: string
          enum:
            - subscription_lapsed
          description: >-
            Machine-readable denial code, present when the 403 is a
            billing-provider-confirmed subscription lapse (mirrored in the
            X-Billing-Verification response header).
        requiredTier:
          type: integer
          format: int32
          description: Minimum entitlement tier required for this endpoint.
        currentTier:
          type: integer
          format: int32
          description: Caller entitlement tier when known.
        planKey:
          type: string
          description: Caller plan key when known.
      required:
        - error
      description: >-
        Returned when a PRO-gated endpoint denies access because the caller has
        no resolved authenticated user, entitlements cannot be verified, or the
        caller lacks the required entitlement tier.
    Error:
      type: object
      properties:
        message:
          type: string
          description: Error message (e.g., 'user not found', 'database connection failed')
      description: >-
        Error is returned when a handler encounters an error. It contains a
        simple error message that the developer can customize.
    RateLimitError:
      type: object
      description: Returned when a gateway or handler rate limit rejects the request.
      properties:
        error:
          type: string
          description: Human-readable rate-limit failure reason.
      required:
        - error
    BillingVerificationError:
      type: object
      description: >-
        Returned with HTTP 503 when paid access cannot be confirmed right now:
        the billing provider is re-verifying a recently expired subscription, or
        the entitlement backend is unreachable. Retryable — honor Retry-After.
      properties:
        error:
          type: string
          description: Human-readable billing-verification failure reason.
        code:
          type: string
          enum:
            - renewal_verification_pending
            - renewal_verification_failed
            - entitlement_verification_unavailable
          description: >-
            Machine-readable billing-verification state, mirrored in the
            X-Billing-Verification response header.
        requiredTier:
          type: integer
          format: int32
          description: >-
            Minimum entitlement tier required for this endpoint, when the denial
            came from a tier gate.
      required:
        - error
        - code
    GatewayError:
      type: object
      description: >-
        Returned by gateway infrastructure errors before an RPC handler runs,
        such as origin, routing, method, authentication, or quota checks.
      properties:
        error:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
          description: Gateway error reason or structured gateway failure details.
      required:
        - error
    CountryProduct:
      type: object
      properties:
        hs4:
          type: string
        description:
          type: string
        totalValue:
          type: number
          format: double
        topExporters:
          type: array
          items:
            $ref: '#/components/schemas/ProductExporter'
        year:
          type: integer
          format: int32
        denominatorBasis:
          type: string
          description: >-
            Share denominator: "reported_world" (the provider's World import
            total for
             this heading and year) or "observed_partners" (the sum of observed partner
             values). Absent on legacy rows, whose denominator is unverified.
        fetchedAt:
          type: string
          description: >-
            ISO timestamp this heading alone was fetched at. Present only on a
            heading
             recovered on demand, whose fetch time differs from the payload's.
        partnerBasis:
          type: string
          description: >-
            How top_exporters was selected: "share_threshold" (every origin at
            or above
             1% of the denominator, padded to 5 and capped at 25; served only for the
             requested hs4) or "leading_5" (the canonical leading five). Always present
             on a served row.
        omittedPartnerCount:
          type: integer
          format: int32
          description: >-
            Origins ranked below the ones shown. Absent under "leading_5", where
            the
             omitted set is not measured.
        omittedPartnerShare:
          type: number
          format: double
          description: >-
            Combined share of the omitted origins, 0-1. Absent under
            "leading_5".
    CountryProductEvidence:
      type: object
      properties:
        state:
          type: string
          description: >-
            Reader state: "observed", "partial" (some catalogue headings absent,
            which
             includes a response holding only a heading recovered on demand),
             "stale_preserved" (older than 35 days; last-good data kept),
             "cache_unavailable", or, when no payload exists and nothing was recovered,
             the last attempt state (see last_attempt_state) or "missing".
        source:
          type: string
          description: >-
            Retrieval route of the cached payload; with no payload, the
            single-heading
             recovery route when a heading was recovered, else a legacy-cache label.
        requestedHs4s:
          type: array
          items:
            type: string
            description: >-
              HS4 headings the producing request asked for; empty when unknown
              (legacy cache).
        missingHs4s:
          type: array
          items:
            type: string
            description: Catalogue headings with no usable product row.
        lastAttemptAt:
          type: string
          description: ISO timestamp of the last refresh attempt; empty when unknown.
        lastAttemptState:
          type: string
          description: |-
            Result of the last refresh attempt: "observed", "no_records",
             "legacy_no_records", "unsupported_reporter", "rate_limited", "unavailable",
             "malformed", "incomplete", "regression_rejected", "cache_unavailable",
             "cache_write_failed", "busy", "not_attempted", "preserved_reason_unknown"
             or "unknown".
        recoveredHs4s:
          type: array
          items:
            type: string
            description: >-
              Headings served from an on-demand single-heading fetch rather than
              the
               stored payload. Empty when every row came from the stored payload.
        worldExportsFetchedAt:
          type: string
          description: >-
            ISO timestamp of the world-export snapshot the scale figures came
            from.
             Absent when no snapshot is cached or no hs4 was requested, in which case no
             row carries a scale.
      description: >-
        Cache evidence for the returned products. Missing data is not zero
        trade.
    FieldViolation:
      type: object
      properties:
        field:
          type: string
          description: >-
            The field path that failed validation (e.g., 'user.email' for nested
            fields). For header validation, this will be the header name (e.g.,
            'X-API-Key')
        description:
          type: string
          description: >-
            Human-readable description of the validation violation (e.g., 'must
            be a valid email address', 'required field missing')
      required:
        - field
        - description
      description: FieldViolation describes a single validation error for a specific field.
    ProductExporter:
      type: object
      properties:
        partnerCode:
          type: integer
          format: int32
        partnerIso2:
          type: string
        value:
          type: number
          format: double
        share:
          type: number
          format: double
        netWeightKg:
          type: number
          format: double
          description: |-
            Net weight of the shown flow in kilograms. Absent when the provider
             reported no weight; "not reported" is never rendered as 0 trade.
        netWeightEstimated:
          type: boolean
          description: True when the provider flagged the net weight as its own estimate.
        quantity:
          type: number
          format: double
          description: >-
            Reported quantity in the unit named by quantity_unit_code. Absent
            when no
             quantity was reported or its unit is outside the pinned unit registry.
        quantityUnitCode:
          type: integer
          format: int32
          description: >-
            UN Comtrade quantity unit code (8 = kg, 12 = m3, 5 = items, 7 =
            litres).
             Absent whenever quantity is absent.
        scale:
          $ref: '#/components/schemas/ExporterScale'
    ExporterScale:
      type: object
      properties:
        worldExportsUsd:
          type: number
          format: double
          description: Reported world exports of this heading by this origin, in USD.
        worldExportsKg:
          type: number
          format: double
          description: >-
            Reported world-export weight in kilograms. Absent when the origin
            reported
             no weight (the provider writes 0 for "not reported"), never 0 for absent.
        rank:
          type: integer
          format: int32
          description: >-
            1-based position by value among the reporters that filed this
            heading for
             `year` (see reporter_count), not among every world exporter.
        year:
          type: integer
          format: int32
          description: >-
            Trade observation year of the world-export figures, not the fetch
            year.
             Always equal to the row's year: a scale from another year is not attached.
        reporterCount:
          type: integer
          format: int32
          description: >-
            Reporters ranked for this heading and year: rank is out of this
            many.
        unrankedReporterCount:
          type: integer
          format: int32
          description: >-
            Reporters whose newest filing for this heading predates `year` (late
            filers
             or lapsed exporters). They are left out of the ranking, so one that files
             later can move every rank below it. Absent on a snapshot written before the
             count was recorded.
      description: >-
        An origin's reported world exports of the same heading, so a shown share
        can
         be read against the supplier's total capacity rather than this importer alone.
  securitySchemes:
    WorldMonitorKey:
      type: apiKey
      in: header
      name: X-WorldMonitor-Key
      description: User-issued WorldMonitor API key.
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Alias header for the WorldMonitor API key (X-WorldMonitor-Key).
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token: a Clerk-issued JWT for browser session flows, passed as
        Authorization: Bearer <token>.

````