{
  "openapi": "3.0.1",
  "info": {
    "title": "Batch Geocoder: Address to Lat/Lng (US Census + OpenStreetMap)",
    "description": "Geocode address lists in bulk: US addresses with the free US Census Geocoder (with census tract and block) and worldwide addresses with OpenStreetMap Nominatim; reverse geocoding too. Lat/lng, normalized address, components and precision. CSV, dataset or list.",
    "version": "0.1",
    "x-build-id": "XtvhYJl7VyUGGkwLD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/latamdatatools~batch-geocoder/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-latamdatatools-batch-geocoder",
        "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/latamdatatools~batch-geocoder/runs": {
      "post": {
        "operationId": "runs-sync-latamdatatools-batch-geocoder",
        "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/latamdatatools~batch-geocoder/run-sync": {
      "post": {
        "operationId": "run-sync-latamdatatools-batch-geocoder",
        "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": {
          "addresses": {
            "title": "Addresses",
            "type": "array",
            "description": "One full address per line, e.g. \"350 5th Ave, New York, NY 10118\" or \"Av. Santa Fe 3253, Buenos Aires, Argentina\". Duplicates are geocoded (and charged) once.",
            "items": {
              "type": "string"
            }
          },
          "coordinates": {
            "title": "Coordinates for reverse geocoding",
            "type": "array",
            "description": "\"lat,lon\" per line, e.g. -34.5875,-58.4108 -> nearest address (Nominatim).",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset with addresses",
            "type": "string",
            "description": "ID of an Apify dataset (for example from another Actor)."
          },
          "csvUrl": {
            "title": "CSV URL",
            "type": "string",
            "description": "Public CSV link or Google Sheets link shared as \"Anyone with the link\" (max 50 MB)."
          },
          "addressField": {
            "title": "Address field / column",
            "type": "string",
            "description": "Field with the full address.",
            "default": "address"
          },
          "addressFields": {
            "title": "Or several fields to join",
            "type": "array",
            "description": "Use when the address is split in columns, e.g. street, city, state, zip, country. They are joined with commas.",
            "items": {
              "type": "string"
            }
          },
          "latField": {
            "title": "Latitude field (reverse)",
            "type": "string",
            "description": "With the longitude field: reverse-geocode every record of the dataset/CSV."
          },
          "lonField": {
            "title": "Longitude field (reverse)",
            "type": "string",
            "description": "See above."
          },
          "keepFields": {
            "title": "Fields to keep",
            "type": "array",
            "description": "Copy these fields of each input record into the output (e.g. id, name) to join the results back.",
            "items": {
              "type": "string"
            }
          },
          "provider": {
            "title": "Geocoder",
            "enum": [
              "auto",
              "census",
              "nominatim"
            ],
            "type": "string",
            "description": "Auto = US addresses with the US Census Geocoder (fast batch, no per-run limit) and everything else with Nominatim; Census addresses that do not match are retried with Nominatim.",
            "default": "auto"
          },
          "countryCodes": {
            "title": "Limit to countries",
            "type": "string",
            "description": "Optional ISO codes for Nominatim, comma separated (e.g. ar,uy,cl). \"us\" sends everything to the Census Geocoder in auto mode."
          },
          "censusGeographies": {
            "title": "Census tract and block (US)",
            "type": "boolean",
            "description": "Adds state/county FIPS, census tract and block to US results.",
            "default": true
          },
          "maxNominatimRequests": {
            "title": "Max Nominatim lookups per run",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "The public Nominatim server allows at most 1 request per second and no heavy bulk use, so each run is capped (max 1,000, about 17 minutes). Census (US) lookups have no cap. For bigger non-US jobs, run again later or use your own Nominatim instance.",
            "default": 300
          },
          "nominatimUrl": {
            "title": "Own Nominatim instance (optional)",
            "type": "string",
            "description": "Base URL of your own Nominatim server (e.g. https://nominatim.example.com). Removes the per-run cap."
          },
          "useCache": {
            "title": "Cache results",
            "type": "boolean",
            "description": "Keeps results for 90 days (not-found addresses for 7 days) in a key-value store of your account, so repeated addresses are answered without asking the free services again, as their policies require.",
            "default": true
          },
          "maxRows": {
            "title": "Max input rows",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Cap of input rows read.",
            "default": 100000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}