{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Importers & Exporters Finder: HMRC Traders by HS Code",
    "description": "Find UK companies that import or export a product, by HS / CN8 commodity code or keyword, from HMRC's official uktradeinfo traders data (monthly, OGL). Post town, postcode district, trade profile, new-importer signal. Organisations only, no API key.",
    "version": "0.1",
    "x-build-id": "CcauPoWL34vMTevOR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/moment-data~uk-importers-exporters-finder/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-moment-data-uk-importers-exporters-finder",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/moment-data~uk-importers-exporters-finder/runs": {
      "post": {
        "operationId": "runs-sync-moment-data-uk-importers-exporters-finder",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/moment-data~uk-importers-exporters-finder/run-sync": {
      "post": {
        "operationId": "run-sync-moment-data-uk-importers-exporters-finder",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "commodityCodes": {
            "title": "HS / CN8 commodity codes",
            "type": "array",
            "description": "2-8 digit codes or prefixes: chapter (84), HS4 heading (8471), HS6 (847130) or CN8 (84713000). Examples: 2204 wine, 8471 computers, 3304 cosmetics, 9403 furniture, 6109 T-shirts, 8712 bicycles, 8703 cars. Leave empty (and no keywords) for a sample across six popular headings.",
            "items": {
              "type": "string"
            }
          },
          "productKeywords": {
            "title": "Product keywords",
            "type": "array",
            "description": "Words matched against official CN8 commodity descriptions (English), e.g. 'bicycle', 'coffee', 'solar'. Matching codes are added to the search (listed in the run OUTPUT). Codes are more precise than keywords.",
            "items": {
              "type": "string"
            }
          },
          "flow": {
            "title": "Trade flow",
            "enum": [
              "import",
              "export",
              "both"
            ],
            "type": "string",
            "description": "Find importers, exporters or both.",
            "default": "import"
          },
          "monthsBack": {
            "title": "Months back",
            "minimum": 1,
            "maximum": 24,
            "type": "integer",
            "description": "Number of most recent published months to search (HMRC publishes trader data monthly, about 6-7 weeks after month end). Ignored if fromMonth is set.",
            "default": 1
          },
          "fromMonth": {
            "title": "From month (YYYY-MM)",
            "type": "string",
            "description": "Optional start month, e.g. 2026-01."
          },
          "toMonth": {
            "title": "To month (YYYY-MM)",
            "type": "string",
            "description": "Optional end month (default: latest published month)."
          },
          "newTradersOnly": {
            "title": "New importers / exporters only",
            "type": "boolean",
            "description": "Only companies that traded these codes in the window but NOT in the previous lookbackMonths months - a 'just started importing X' signal.",
            "default": false
          },
          "lookbackMonths": {
            "title": "Lookback months (new traders)",
            "minimum": 1,
            "maximum": 36,
            "type": "integer",
            "description": "How far back to check for previous trade when newTradersOnly is on.",
            "default": 12
          },
          "postcodeAreas": {
            "title": "Postcode areas",
            "type": "array",
            "description": "1-2 letter UK postcode areas, e.g. M (Manchester), LS (Leeds), B (Birmingham), EC, G (Glasgow), BT (Northern Ireland).",
            "items": {
              "type": "string"
            }
          },
          "postcodeDistricts": {
            "title": "Postcode districts",
            "type": "array",
            "description": "Outward codes, e.g. M1, LS11, EC1V.",
            "items": {
              "type": "string"
            }
          },
          "nameKeywords": {
            "title": "Company name contains",
            "type": "array",
            "description": "Keep only companies whose name contains one of these words, e.g. 'wine', 'cycles'.",
            "items": {
              "type": "string"
            }
          },
          "excludeNameKeywords": {
            "title": "Exclude company names containing",
            "type": "array",
            "description": "Drop names containing these words, e.g. 'logistics', 'freight', 'customs' (to skip forwarders).",
            "items": {
              "type": "string"
            }
          },
          "includeTradeProfile": {
            "title": "Include trade profile",
            "type": "boolean",
            "description": "Adds each company's full import/export profile for the window (number of CN8 codes, HS chapters). Costs a few extra API calls per 15 companies.",
            "default": true
          },
          "maxItems": {
            "title": "Max companies",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Maximum companies to return. You pay per company record.",
            "default": 30
          },
          "maxRowsToScan": {
            "title": "Max trade rows to scan",
            "minimum": 1000,
            "maximum": 1000000,
            "type": "integer",
            "description": "Safety cap on trader x commodity x month rows read from HMRC (the API allows 60 requests/minute; 1,000 rows per request).",
            "default": 30000
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "window",
              "sinceLastRun"
            ],
            "type": "string",
            "description": "window = every matching company. sinceLastRun = skip companies already delivered for this stateKey (stored in a named key-value store), ideal for a monthly schedule.",
            "default": "window"
          },
          "stateKey": {
            "title": "State key",
            "type": "string",
            "description": "Separate delta memory per saved search (sinceLastRun mode only).",
            "default": "default"
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}