{
  "openapi": "3.0.1",
  "info": {
    "title": "Construction Subcontractor Leads (SERP + IA)",
    "description": "Busca oportunidades de subcontratación de construcción en Google (vía apify/google-search-scraper), las estructura con IA y guarda leads limpios en el dataset.",
    "version": "0.1",
    "x-build-id": "fxea9az4dAVIM2MNU"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/deep_zinc~leads-construccion-wa/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-deep_zinc-leads-construccion-wa",
        "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/deep_zinc~leads-construccion-wa/runs": {
      "post": {
        "operationId": "runs-sync-deep_zinc-leads-construccion-wa",
        "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/deep_zinc~leads-construccion-wa/run-sync": {
      "post": {
        "operationId": "run-sync-deep_zinc-leads-construccion-wa",
        "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",
        "required": [
          "openaiApiKey"
        ],
        "properties": {
          "baseUrl": {
            "title": "① Proveedor de IA",
            "type": "string",
            "description": "Escribe un atajo: gemini, groq, deepseek, openrouter u openai. (También acepta una URL completa de cualquier API compatible con OpenAI). Déjalo vacío para usar OpenAI. RECOMENDADO: gemini — tiene capa gratis de 1,500 peticiones al día.",
            "default": "gemini"
          },
          "model": {
            "title": "② Modelo",
            "type": "string",
            "description": "Debe existir en el proveedor que elegiste arriba. Con gemini: gemini-2.5-flash. Con openai: gpt-4o-mini. Con groq: llama-3.3-70b-versatile. Con deepseek: deepseek-chat.",
            "default": "gemini-2.5-flash"
          },
          "openaiApiKey": {
            "title": "③ API Key del proveedor",
            "type": "string",
            "description": "La llave del proveedor que pusiste arriba, NO necesariamente de OpenAI. Si elegiste gemini, va tu llave de Google AI Studio (aistudio.google.com/apikey)."
          },
          "serpDatasetId": {
            "title": "④ Dataset ID del google-search-scraper (opcional)",
            "type": "string",
            "description": "Si ya corriste apify/google-search-scraper por separado, pega aquí el ID de su dataset y se reprocesa sin volver a pagar el SERP. Puedes pegar el ID o la URL completa. Si lo llenas, las queries de abajo se ignoran."
          },
          "queries": {
            "title": "⑤ Búsquedas de Google (si no usas Dataset ID)",
            "type": "string",
            "description": "Una búsqueda por línea. Cada línea se envía como término a apify/google-search-scraper."
          },
          "maxPagesPerQuery": {
            "title": "Páginas por query",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Cuántas páginas de resultados de Google traer por búsqueda. Más páginas = más leads pero más costo de SERP.",
            "default": 2
          },
          "minRelevancia": {
            "title": "Relevancia mínima",
            "enum": [
              "baja",
              "media",
              "alta"
            ],
            "type": "string",
            "description": "Filtra los leads por el nivel de relevancia que les asigna la IA. 'Todas' no descarta nada.",
            "default": "baja"
          },
          "soloWashington": {
            "title": "Solo estado de Washington",
            "type": "boolean",
            "description": "Descarta leads fuera del estado de WA (Washington DC, UK, otros estados).",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}