{
  "openapi": "3.0.1",
  "info": {
    "title": "UN Comtrade Trade Data Scraper API - Imports & Exports",
    "description": "Search UN Comtrade public preview data by annual/monthly period, reporter, partner, flow, HS commodity, customs procedure, and transport mode. Get normalized quantities, weights, trade values, labels, source links, and bounded-query evidence.",
    "version": "0.1",
    "x-build-id": "yYT18TIlyuLKDq21w"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pink_comic~un-comtrade-import-export-trade-data/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pink_comic-un-comtrade-import-export-trade-data",
        "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/pink_comic~un-comtrade-import-export-trade-data/runs": {
      "post": {
        "operationId": "runs-sync-pink_comic-un-comtrade-import-export-trade-data",
        "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/pink_comic~un-comtrade-import-export-trade-data/run-sync": {
      "post": {
        "operationId": "run-sync-pink_comic-un-comtrade-import-export-trade-data",
        "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": {
          "frequency": {
            "title": "Frequency",
            "enum": [
              "A",
              "M"
            ],
            "type": "string",
            "description": "Optional frequency filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": "A"
          },
          "periods": {
            "title": "Periods",
            "maxItems": 24,
            "type": "array",
            "description": "Annual YYYY or monthly YYYYMM values; maximum 24.",
            "items": {
              "type": "string"
            },
            "default": [
              "2023"
            ]
          },
          "reporterCode": {
            "title": "Reporter M49 Code",
            "pattern": "^[0-9]{1,6}$",
            "type": "string",
            "description": "UN M49 reporter code; 842 is USA.",
            "default": "842"
          },
          "partnerCode": {
            "title": "Partner M49 Code",
            "pattern": "^[0-9]{1,6}$",
            "type": "string",
            "description": "0 means World.",
            "default": "0"
          },
          "partner2Code": {
            "title": "Secondary Partner Code",
            "pattern": "^[0-9]{1,6}$",
            "type": "string",
            "description": "Usually 0 (World).",
            "default": "0"
          },
          "flowCode": {
            "title": "Trade Flow",
            "enum": [
              "M",
              "X",
              "RM",
              "RX"
            ],
            "type": "string",
            "description": "Optional trade flow filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": "M"
          },
          "hsCode": {
            "title": "HS Commodity Code",
            "pattern": "^(TOTAL|[0-9]{1,6})$",
            "type": "string",
            "description": "1-6 digit HS code or TOTAL; 1001 is wheat and meslin.",
            "default": "1001"
          },
          "customsCode": {
            "title": "Customs Procedure Code",
            "pattern": "^[A-Za-z][A-Za-z0-9]{2}$",
            "type": "string",
            "description": "Comtrade customs code; C00 is total CPC.",
            "default": "C00"
          },
          "transportModeCode": {
            "title": "Mode of Transport Code",
            "pattern": "^[0-9]{1,6}$",
            "type": "string",
            "description": "0 means total mode of transport.",
            "default": "0"
          },
          "maxRecordsPerPage": {
            "title": "Maximum Records per Period",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Bound sent to the public preview endpoint for each period.",
            "default": 1
          },
          "maxPages": {
            "title": "Maximum Period Pages",
            "minimum": 1,
            "maximum": 24,
            "type": "integer",
            "description": "Each requested period is one bounded source page.",
            "default": 1
          },
          "maxResults": {
            "title": "Maximum Total Results",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Total paid dataset-item cap across all periods. Default one item costs at most $0.002 plus the $0.0001 start event.",
            "default": 1
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}