{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil Import/Export Data by NCM (Importação por NCM)",
    "description": "Importações e exportações oficiais do Brasil por NCM, mês e país, UF ou via, direto da API pública Comex Stat (MDIC). FOB, CIF, frete, seguro, kg líquido e US$/kg, com link e hash da fonte. Você paga só pelas linhas válidas.",
    "version": "1.1",
    "x-build-id": "EmfSgbwsweVvqAMbz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kman-br~importacao-ncm/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kman-br-importacao-ncm",
        "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/kman-br~importacao-ncm/runs": {
      "post": {
        "operationId": "runs-sync-kman-br-importacao-ncm",
        "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/kman-br~importacao-ncm/run-sync": {
      "post": {
        "operationId": "run-sync-kman-br-importacao-ncm",
        "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": {
          "flow": {
            "title": "Fluxo",
            "enum": [
              "import",
              "export"
            ],
            "type": "string",
            "description": "Selecione importação (import) ou exportação (export). CIF, frete e seguro estão disponíveis apenas para importação.",
            "default": "import"
          },
          "ncms": {
            "title": "NCMs ou prefixos",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "type": "array",
            "description": "Códigos de 8 dígitos ou prefixos de 2 a 7 dígitos, expandidos pela tabela oficial.",
            "items": {
              "type": "string",
              "pattern": "^\\d{2,8}$"
            },
            "default": [
              "10019900",
              "27090010"
            ]
          },
          "periodoDe": {
            "title": "Período inicial",
            "pattern": "^(199[7-9]|20[0-9]{2})-(0[1-9]|1[0-2])$",
            "type": "string",
            "description": "Primeiro mês da consulta, inclusive, no formato AAAA-MM, desde 1997-01. O intervalo pode ter no máximo 120 meses.",
            "default": "2025-01"
          },
          "periodoAte": {
            "title": "Período final",
            "pattern": "^(199[7-9]|20[0-9]{2})-(0[1-9]|1[0-2])$",
            "type": "string",
            "description": "Último mês da consulta, inclusive, no formato AAAA-MM. Deve ser igual ou posterior ao início e não superar o último mês publicado pelo MDIC.",
            "default": "2025-01"
          },
          "paises": {
            "title": "Países (códigos MDIC)",
            "maxItems": 100,
            "uniqueItems": true,
            "type": "array",
            "description": "Códigos da API, não ISO. Vazio inclui todos.",
            "items": {
              "type": "string",
              "pattern": "^\\d{1,3}$"
            },
            "default": []
          },
          "ufs": {
            "title": "UFs",
            "maxItems": 27,
            "uniqueItems": true,
            "type": "array",
            "description": "Selecione uma ou mais UFs para filtrar pela UF do produto. Vazio inclui todas. As siglas são convertidas pela tabela oficial MDIC, cujos códigos diferem dos códigos IBGE.",
            "items": {
              "type": "string",
              "enum": [
                "AC",
                "AL",
                "AP",
                "AM",
                "BA",
                "CE",
                "DF",
                "ES",
                "GO",
                "MA",
                "MT",
                "MS",
                "MG",
                "PA",
                "PB",
                "PR",
                "PE",
                "PI",
                "RJ",
                "RN",
                "RS",
                "RO",
                "RR",
                "SC",
                "SP",
                "SE",
                "TO"
              ]
            },
            "default": []
          },
          "detalhar": {
            "title": "Detalhamento",
            "enum": [
              "pais",
              "uf",
              "via"
            ],
            "type": "string",
            "description": "Agrupe por país, UF do produto ou via de transporte, além de NCM e mês sempre presentes. As outras dimensões ficam null com aviso na saída.",
            "default": "pais"
          },
          "metricas": {
            "title": "Métricas",
            "minItems": 1,
            "maxItems": 6,
            "uniqueItems": true,
            "type": "array",
            "description": "Selecione uma ou mais métricas oficiais. FOB (US$) e KG (peso líquido) são sempre solicitados para US$/kg; quantidade estatística depende da unidade do NCM. CIF, frete e seguro são exclusivos de importação: desmarque essas opções ao selecionar exportação.",
            "items": {
              "type": "string",
              "enum": [
                "metricFOB",
                "metricKG",
                "metricStatistic",
                "metricFreight",
                "metricInsurance",
                "metricCIF"
              ]
            },
            "default": [
              "metricFOB",
              "metricKG",
              "metricStatistic",
              "metricFreight",
              "metricInsurance",
              "metricCIF"
            ]
          },
          "incremental": {
            "title": "Checagem incremental",
            "type": "boolean",
            "description": "false repete resultados em cada execução. true reutiliza estado por filtro e consulta atualização uma vez/dia.",
            "default": false
          },
          "maxItems": {
            "title": "Máximo de linhas de dados",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Máximo de linhas de dados por execução, de 1 a 100.000. Diagnósticos não contam neste limite. Uma entrega interrompida pelo limite não avança o estado incremental.",
            "default": 1000
          },
          "timeoutSecs": {
            "title": "Timeout por requisição (s)",
            "minimum": 1,
            "maximum": 120,
            "type": "integer",
            "description": "Tempo máximo, de 1 a 120 segundos, para cada requisição e leitura da resposta. As esperas de retentativa por HTTP 429/5xx são separadas deste timeout.",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}