{
  "openapi": "3.0.1",
  "info": {
    "title": "DENUE Mexico Business Directory Scraper (INEGI)",
    "description": "Extract Mexican businesses from INEGI's official DENUE directory (6.1M establishments): name, legal name, SCIAN activity, employee size, full address, GPS, phone, e-mail and website. Filter by keyword, state, municipality, SCIAN code, size or radius. No key needed. From US$3 per 1,000 businesses.",
    "version": "0.1",
    "x-build-id": "gv4Omtt7CqmJcGFIq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fabrikit~denue-mexico-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fabrikit-denue-mexico-scraper",
        "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/fabrikit~denue-mexico-scraper/runs": {
      "post": {
        "operationId": "runs-sync-fabrikit-denue-mexico-scraper",
        "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/fabrikit~denue-mexico-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-fabrikit-denue-mexico-scraper",
        "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": {
          "keyword": {
            "title": "Keyword (activity or name)",
            "type": "string",
            "description": "Words to find in the business name, legal name (razón social), activity description or address, accents optional (e.g. `hotel`, `dentista`, `farmacia`, `taller mecánico`). All words of a phrase must appear; separate alternatives with commas (`motel,hostal`). Leave empty to list every establishment that matches the other filters."
          },
          "state": {
            "title": "State (entidad federativa)",
            "enum": [
              "00",
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10",
              "11",
              "12",
              "13",
              "14",
              "15",
              "16",
              "17",
              "18",
              "19",
              "20",
              "21",
              "22",
              "23",
              "24",
              "25",
              "26",
              "27",
              "28",
              "29",
              "30",
              "31",
              "32"
            ],
            "type": "string",
            "description": "Limit to one of Mexico's 32 states. `All of Mexico` scans the whole country (slower without a token unless you also set a SCIAN code, a municipality or a radius).",
            "default": "00"
          },
          "municipalities": {
            "title": "Municipalities (municipios / alcaldías)",
            "type": "array",
            "description": "Optional. Official INEGI municipality names (accents optional: `Manzanillo`, `Benito Juarez`, `Cuauhtémoc`) or 5-digit codes (state + municipality, e.g. `09015` = Cuauhtémoc, CDMX). Names that exist in several states match all of them unless you also pick a state.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "scianCodes": {
            "title": "SCIAN activity codes (prefixes)",
            "type": "array",
            "description": "Optional. SCIAN 2018 codes of 2 to 6 digits; each one matches every activity class starting with it. Examples: `72` accommodation & food services, `7225` restaurants, `621211` dentists, `4611` grocery stores, `31-33` all manufacturing. Several codes = any of them.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "employeeSizes": {
            "title": "Employee size brackets (estrato)",
            "type": "array",
            "description": "Optional. Keep only establishments in these personal-ocupado brackets, as published by INEGI. Empty = all sizes.",
            "items": {
              "type": "string",
              "enum": [
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
              ],
              "enumTitles": [
                "0–5 employees",
                "6–10 employees",
                "11–30 employees",
                "31–50 employees",
                "51–100 employees",
                "101–250 employees",
                "251+ employees"
              ]
            },
            "default": []
          },
          "contactFilter": {
            "title": "Only establishments with",
            "enum": [
              "any",
              "phone",
              "email",
              "website",
              "any_contact"
            ],
            "type": "string",
            "description": "Optional. Keep only establishments for which INEGI publishes this contact field. Many micro-businesses publish none.",
            "default": "any"
          },
          "registeredFrom": {
            "title": "Added to DENUE since (YYYY or YYYY-MM)",
            "pattern": "^(\\d{4}(-\\d{1,2})?)?$",
            "type": "string",
            "description": "Optional. Keep only establishments whose DENUE registration date (`fecha_alta`, the month INEGI added the record) is this month or later, e.g. `2024` or `2025-11`. Useful to find recently registered businesses."
          },
          "coordinates": {
            "title": "Center point (latitude,longitude)",
            "type": "string",
            "description": "Optional. Return establishments within `radiusMeters` of this point, nearest first, e.g. `19.4326,-99.1332` (Zócalo, Mexico City). Copy it from Google Maps (right-click on the map)."
          },
          "radiusMeters": {
            "title": "Radius (meters)",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Search radius around the center point. The INEGI API allows up to 5,000 m; larger radii automatically use the bulk files.",
            "default": 1000
          },
          "maxItems": {
            "title": "Max establishments",
            "minimum": 1,
            "maximum": 7000000,
            "type": "integer",
            "description": "Stop after this many establishments. DENUE lists ~6.1 million in total (Ciudad de México ~463k, Jalisco ~402k, Colima ~42k).",
            "default": 50
          },
          "inegiToken": {
            "title": "INEGI API token (optional, free)",
            "type": "string",
            "description": "Optional. With a token the Actor queries INEGI's official DENUE API (fast for narrow searches, no big downloads). Get one free in 1 minute: open https://www.inegi.org.mx/app/desarrolladores/generaToken/Usuarios/token_Verify, enter your e-mail, and INEGI sends the token. Without a token the Actor streams INEGI's official bulk CSV files instead — same records, it just downloads more."
          },
          "source": {
            "title": "Data source",
            "enum": [
              "auto",
              "api",
              "bulk"
            ],
            "type": "string",
            "description": "`auto` uses the API when a token is present (and the query fits the API: radius up to 5 km) and the bulk CSV files otherwise. `bulk` always uses the CSV files; `api` requires a token.",
            "default": "auto"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "INEGI serves its open data to plain requests, so no proxy is needed. If INEGI ever refuses the connection, the Actor automatically retries once through Apify RESIDENTIAL proxies in Mexico.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}