{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil CNPJ → Company Markdown DD Card",
    "description": "Batch Brazilian CNPJ lookups via BrasilAPI (keyless) with CNPJ.ws / ReceitaWS fallback or your own key. Markdown due-diligence cards: identity, status, CNAE, address, QSA partners, source. RAG chunks. No email/phone output. Failed rows free. 256 MB.",
    "version": "0.1",
    "x-build-id": "ccUfMh5UOsLTtk24f"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ingenious_quip_bxq~brazil-cnpj-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ingenious_quip_bxq-brazil-cnpj-markdown",
        "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/ingenious_quip_bxq~brazil-cnpj-markdown/runs": {
      "post": {
        "operationId": "runs-sync-ingenious_quip_bxq-brazil-cnpj-markdown",
        "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/ingenious_quip_bxq~brazil-cnpj-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-ingenious_quip_bxq-brazil-cnpj-markdown",
        "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": {
          "cnpjs": {
            "title": "CNPJs",
            "type": "array",
            "description": "One CNPJ per line, e.g. 33.000.167/0001-01 or 33000167000101. Punctuation and spaces are stripped, numbers shorter than 14 digits are left-padded with zeros, check digits are validated (invalid rows are free). Duplicates dropped.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset ID (CNPJ list)",
            "type": "string",
            "description": "Optional. Read CNPJs from another run's dataset (field from 'CNPJ field', else cnpj / CNPJ / taxId / documento)."
          },
          "keyValueStoreId": {
            "title": "Key-value store ID (CNPJ list)",
            "type": "string",
            "description": "Optional. Read CNPJs from a key-value record: JSON array, {\"cnpjs\": [...]}, or plain text with one CNPJ per line."
          },
          "keyValueRecordKey": {
            "title": "Key-value record key",
            "type": "string",
            "description": "Record key inside the key-value store.",
            "default": "INPUT_CNPJS"
          },
          "cnpjField": {
            "title": "CNPJ field (dataset / JSON objects)",
            "type": "string",
            "description": "Optional. Name of the field holding the CNPJ in dataset items or JSON objects."
          },
          "provider": {
            "title": "Provider",
            "enum": [
              "auto",
              "brasilapi",
              "cnpjws",
              "receitaws"
            ],
            "type": "string",
            "description": "auto = BrasilAPI first, then (with apiKey) your keyed provider, then the remaining keyless public endpoint. brasilapi / cnpjws / receitaws = that provider only (cnpjws and receitaws use your apiKey when given, else their rate-limited public endpoints).",
            "default": "auto"
          },
          "apiKey": {
            "title": "Provider API key (optional)",
            "type": "string",
            "description": "Optional ReceitaWS token (sent as Authorization: Bearer) or CNPJ.ws commercial token (sent as x_api_token to comercial.cnpj.ws). Not needed for BrasilAPI. Stored encrypted, never logged or output. Placeholders like YOUR_KEY are ignored."
          },
          "keyProvider": {
            "title": "Key belongs to (auto mode)",
            "enum": [
              "receitaws",
              "cnpjws"
            ],
            "type": "string",
            "description": "Which provider your apiKey is for when provider=auto.",
            "default": "receitaws"
          },
          "stopOnAuthError": {
            "title": "Stop using key after auth error",
            "type": "boolean",
            "description": "After the keyed provider returns 401/403 once, skip it for the remaining CNPJs (auto mode keeps using keyless providers). Failed rows are free.",
            "default": true
          },
          "includeQsa": {
            "title": "Include QSA (partners / administrators)",
            "type": "boolean",
            "description": "Add a QSA summary: names, roles and entry date only. No CPF fragments, ages or contact details.",
            "default": true
          },
          "includeRagChunks": {
            "title": "Write RAG chunks (CHUNKS.jsonl)",
            "type": "boolean",
            "description": "Write one self-describing chunk per card section to the key-value store record CHUNKS.jsonl.",
            "default": true
          },
          "maxItems": {
            "title": "Max CNPJs",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many unique valid CNPJs (0 = no limit).",
            "default": 100
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Parallel lookups. Public endpoints are rate-limited; 2 is a safe default.",
            "default": 2
          },
          "maxRetries": {
            "title": "Max retries",
            "minimum": 0,
            "maximum": 6,
            "type": "integer",
            "description": "Retries per provider for HTTP 429 (honours Retry-After, capped at 30 s), 5xx, timeouts and network errors. 400/401/403/404 are not retried.",
            "default": 3
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout for each provider HTTP call.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}