{
  "openapi": "3.0.1",
  "info": {
    "title": "Urbania Peru Scraper",
    "description": "Extract property listings (rentals and sale) from Urbania.pe, Peru's largest real-estate portal. Includes keyword search, optional detail enrichment (full description, exact posting date, seller contact, gallery), and structured fields: price, currency, rooms, bathrooms, area, address, publisher.",
    "version": "0.5",
    "x-build-id": "axeOsv5NXMT64koq3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/barefoot_grade~urbania-peru-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-barefoot_grade-urbania-peru-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/barefoot_grade~urbania-peru-scraper/runs": {
      "post": {
        "operationId": "runs-sync-barefoot_grade-urbania-peru-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/barefoot_grade~urbania-peru-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-barefoot_grade-urbania-peru-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": {
          "operation": {
            "title": "Operation",
            "enum": [
              "rentals",
              "sale"
            ],
            "type": "string",
            "description": "Listing operation to search for.",
            "default": "rentals"
          },
          "city": {
            "title": "City",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "type": "string",
            "description": "City slug as used in the Urbania URL, e.g. 'lima' or 'arequipa'.",
            "default": "lima"
          },
          "search": {
            "title": "Search keyword",
            "type": "string",
            "description": "Optional free-text keyword filter appended as ?keyword=<term> to the operation+city search URL (it composes; neither is dropped). URL-encoded automatically. Records carry the applied term in source_query; null on non-search runs. Blank means no filter."
          },
          "maxPages": {
            "title": "Maximum pages",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "Pages to fetch (1-3; the site is Cloudflare-flagged, stay polite).",
            "default": 1
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Stop after this many listings.",
            "default": 50
          },
          "requestDelaySecs": {
            "title": "Delay between page requests",
            "minimum": 1,
            "maximum": 30,
            "type": "number",
            "description": "Seconds to wait between page fetches (Cloudflare-flagged site, be polite). At least 3s is enforced when the residential proxy is enabled.",
            "default": 4
          },
          "client": {
            "title": "HTTP client profile",
            "enum": [
              "chrome",
              "plain"
            ],
            "type": "string",
            "description": "TLS/HTTP2 fingerprint of the fetch client. 'chrome' uses a browser-grade Chrome profile that passes the site's anti-bot checks; 'plain' is the legacy profile kept as a fallback.",
            "default": "chrome"
          },
          "proxy": {
            "title": "Proxy",
            "enum": [
              "residential",
              "external",
              "none"
            ],
            "type": "string",
            "description": "Egress lane. Datacenter egress is Cloudflare-blocked; the Apify residential proxy is the verified lane on the FREE plan (docs/PROXY-VERDICT.md). 'external' routes through your own residential gateway set under proxyUrl. Falls back to no proxy when platform proxy env vars are absent (local runs).",
            "default": "residential"
          },
          "proxyCountry": {
            "title": "Proxy country",
            "pattern": "^[A-Za-z]{2}$",
            "type": "string",
            "description": "Two-letter country code for the residential proxy session.",
            "default": "PE"
          },
          "proxyUrl": {
            "title": "External proxy URL",
            "type": "string",
            "description": "External residential proxy for proxy=external, e.g. http://gw.dataimpulse.com:823 (DataImpulse; the username automatically gains __cr.<proxyCountry> for country-pinned residential exits). Either a full URL with embedded credentials (http://user:pass@host:port) or a bare host:port together with proxyUsername/proxyPassword. Ignored unless proxy=external."
          },
          "proxyUsername": {
            "title": "External proxy username",
            "type": "string",
            "description": "Username for proxyUrl when the URL does not embed credentials."
          },
          "proxyPassword": {
            "title": "External proxy password",
            "type": "string",
            "description": "Password for proxyUrl when the URL does not embed credentials."
          },
          "includeDetails": {
            "title": "Include listing details",
            "type": "boolean",
            "description": "When true, fetch each collected listing's detail page (same proxy lane and delay) and add the full description, exact postedAt timestamp, seller contact when plainly public, and extra gallery image URLs. Missing fields are null; failed detail fetches are logged as warnings and never fail the run.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}