{
  "openapi": "3.0.1",
  "info": {
    "title": "USDA Local Food & Farmers Market Leads Scraper",
    "description": "Scrape USDA Local Food Directories — farmers markets, CSAs, food hubs, on-farm markets & agritourism. Get name, address, geo, email, phone, website & socials plus products, payments, SNAP/WIC/FMNP, organic status & season. Filter by state, ZIP, product or program. Export JSON, CSV, Excel.",
    "version": "0.1",
    "x-build-id": "4LNdZNNIL5bgsXPln"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~usda-local-food-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-usda-local-food-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/scrapesage~usda-local-food-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-usda-local-food-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/scrapesage~usda-local-food-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-usda-local-food-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": {
          "directories": {
            "title": "Directories",
            "type": "array",
            "description": "Which USDA Local Food directories to scrape. Default: all five.",
            "items": {
              "type": "string",
              "enum": [
                "farmersmarket",
                "csa",
                "foodhub",
                "onfarmmarket",
                "agritourism"
              ],
              "enumTitles": [
                "Farmers Markets",
                "CSAs (Community Supported Agriculture)",
                "Food Hubs",
                "On-Farm Markets",
                "Agritourism"
              ]
            },
            "default": [
              "farmersmarket",
              "csa",
              "foodhub",
              "onfarmmarket",
              "agritourism"
            ]
          },
          "states": {
            "title": "States",
            "type": "array",
            "description": "Filter by US state — 2-letter codes (<code>CA</code>, <code>TX</code>) or full names (<code>California</code>). Leave empty for all states.",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "Filter by city name (case-insensitive, exact match on the directory's city field).",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "Filter by 5-digit ZIP code.",
            "items": {
              "type": "string"
            }
          },
          "latitude": {
            "title": "Latitude (point search)",
            "type": "string",
            "description": "Center latitude for a radius search (use with Longitude + Radius). Overrides state/city/zip targeting."
          },
          "longitude": {
            "title": "Longitude (point search)",
            "type": "string",
            "description": "Center longitude for a radius search."
          },
          "radiusMiles": {
            "title": "Radius (miles)",
            "minimum": 1,
            "type": "integer",
            "description": "Radius in miles for the point search above.",
            "default": 50
          },
          "searchTerm": {
            "title": "Search term",
            "type": "string",
            "description": "Optional keyword passed to the USDA search (matches listing name / description), e.g. <code>organic</code>, <code>honey</code>."
          },
          "productKeywords": {
            "title": "Product keywords",
            "type": "array",
            "description": "Keep only listings whose products / name / description / facilities mention any of these keywords (e.g. <code>eggs</code>, <code>grass-fed</code>, <code>honey</code>, <code>flowers</code>).",
            "items": {
              "type": "string"
            }
          },
          "acceptedPaymentContains": {
            "title": "Accepted payment contains",
            "type": "string",
            "description": "Keep only listings whose accepted-payment list contains this text (e.g. <code>credit</code>, <code>check</code>)."
          },
          "acceptsSnap": {
            "title": "Accepts SNAP / EBT only",
            "type": "boolean",
            "description": "Only listings that accept SNAP / EBT.",
            "default": false
          },
          "acceptsWic": {
            "title": "Accepts WIC only",
            "type": "boolean",
            "description": "Only listings that accept WIC (incl. WIC Farmers' Market Nutrition Program).",
            "default": false
          },
          "acceptsFmnp": {
            "title": "Accepts FMNP only",
            "type": "boolean",
            "description": "Only listings that accept the Farmers' Market Nutrition Program (FMNP / SFMNP).",
            "default": false
          },
          "organicOnly": {
            "title": "Organic only",
            "type": "boolean",
            "description": "Only listings that report any organic production method.",
            "default": false
          },
          "certifiedOrganicOnly": {
            "title": "USDA-certified organic only",
            "type": "boolean",
            "description": "Only listings that report USDA-certified organic production.",
            "default": false
          },
          "nameContains": {
            "title": "Name contains",
            "type": "string",
            "description": "Keep only listings whose name contains this text."
          },
          "hasEmail": {
            "title": "Has email only",
            "type": "boolean",
            "description": "Only output listings with a contact email.",
            "default": false
          },
          "hasPhone": {
            "title": "Has phone only",
            "type": "boolean",
            "description": "Only output listings with a contact phone.",
            "default": false
          },
          "hasWebsite": {
            "title": "Has website only",
            "type": "boolean",
            "description": "Only output listings with a website.",
            "default": false
          },
          "hasAnyContact": {
            "title": "Has any contact only",
            "type": "boolean",
            "description": "Only output listings with at least one of email / phone / website / social link.",
            "default": false
          },
          "updatedAfter": {
            "title": "Updated after",
            "type": "string",
            "description": "Only listings last updated on or after this date (YYYY-MM-DD). Great for freshness / monitoring."
          },
          "includeContacts": {
            "title": "Include contact enrichment",
            "type": "boolean",
            "description": "Resolve email, phone, website and social links per listing (recommended — this is what turns a listing into a lead). Turn off for a faster firmographic-only run.",
            "default": true
          },
          "includeFirmographics": {
            "title": "Include firmographic detail",
            "type": "boolean",
            "description": "Include the rich directory fields: products, accepted payments, nutrition programs (SNAP/WIC/FMNP), production methods, season, CSA share details, facilities, etc.",
            "default": true
          },
          "includeRawFields": {
            "title": "Include raw source fields",
            "type": "boolean",
            "description": "Attach the full raw USDA record under <code>sourceFields</code> for each listing.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "leadScore",
              "recent",
              "name",
              "state"
            ],
            "type": "string",
            "description": "Order of the output records.",
            "default": "leadScore"
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of lead records to output.",
            "default": 1000
          },
          "maxSearchCalls": {
            "title": "Max contact-search calls",
            "minimum": 1,
            "type": "integer",
            "description": "Safety cap on the number of geo searches used for contact enrichment. Higher = more complete contacts on very large (nationwide) runs.",
            "default": 90
          },
          "monitorMode": {
            "title": "Monitor mode (only new / changed)",
            "type": "boolean",
            "description": "Remember listings seen in previous runs (by ID + last-updated date) and output only new or changed ones. Independent of Apify Schedules — schedule this actor and each run returns just the fresh leads.",
            "default": false
          },
          "monitorStateKey": {
            "title": "Monitor state key",
            "type": "string",
            "description": "Namespace for monitor memory. Use different keys for independent monitors (e.g. one per state or per directory).",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The USDA portal is reachable directly from Apify; add a proxy only if you hit blocks.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}