{
  "openapi": "3.0.1",
  "info": {
    "title": "Foundation Grants Scraper - Grantmaker & Funder Leads",
    "description": "Extract US foundation grants & grantmaker leads from official IRS Form 990-PF & 990 Schedule I e-file data: funder, recipient, grant amount & purpose, assets, payout, trustees & contact phone. Grant prospecting + B2B lead-gen + monitoring. No browser, no key.",
    "version": "0.1",
    "x-build-id": "WaEkr7zqBVj6pKTke"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~foundation-grants-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-foundation-grants-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~foundation-grants-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-foundation-grants-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~foundation-grants-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-foundation-grants-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": {
          "years": {
            "title": "Filing years",
            "type": "array",
            "description": "IRS processing years to pull, e.g. [\"2024\",\"2023\"]. Each year is a separate official dataset of returns the IRS processed that year (a 990-PF for fiscal year 2022 is usually processed in 2023–2024). Leave empty to use the latest available year.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "formTypes": {
            "title": "Form types",
            "type": "array",
            "description": "990-PF = private foundations (the classic grantmakers; Part XV grants paid). 990 = public charities that make grants (community foundations, donor-advised funds, United Ways — Schedule I). Adding 990 finds more grantmakers but scans more filings.",
            "items": {
              "type": "string",
              "enum": [
                "990PF",
                "990"
              ],
              "enumTitles": [
                "990-PF (private foundations)",
                "990 Schedule I (public-charity grantmakers)"
              ]
            },
            "default": [
              "990PF"
            ]
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "grants",
              "funders",
              "both"
            ],
            "type": "string",
            "description": "grants = one record per grant (funder → recipient, amount, purpose). funders = one profile per foundation (assets, total giving, payout, trustees). both = emit both record types.",
            "default": "grants"
          },
          "funderEins": {
            "title": "Funder EINs (targeted lookup)",
            "type": "array",
            "description": "Look up specific foundations by EIN (9 digits, dashes optional), e.g. [\"13-1684331\"]. When set, only these foundations are extracted (fast, targeted).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "funderNameQuery": {
            "title": "Funder name contains",
            "type": "string",
            "description": "Keep only foundations whose name contains this text (case-insensitive), e.g. \"family foundation\"."
          },
          "funderStates": {
            "title": "Funder states (filter)",
            "type": "array",
            "description": "Two-letter state codes of the foundation, e.g. [\"CA\",\"NY\"]. Empty = all states.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "funderCities": {
            "title": "Funder cities (filter)",
            "type": "array",
            "description": "Foundation city names (case-insensitive), e.g. [\"NEW YORK\"]. Empty = all cities.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "recipientStates": {
            "title": "Recipient states (filter)",
            "type": "array",
            "description": "Keep only grants to recipients in these two-letter states, e.g. [\"TX\"]. (Grants output only.)",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "recipientNameQuery": {
            "title": "Recipient name contains",
            "type": "string",
            "description": "Reverse lookup — keep only grants whose recipient name contains this text (case-insensitive), e.g. \"university\" or a specific nonprofit name. Find who funds an organization."
          },
          "minGrantAmount": {
            "title": "Min grant amount (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only grants of at least this amount."
          },
          "maxGrantAmount": {
            "title": "Max grant amount (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only grants of at most this amount."
          },
          "minFunderAssets": {
            "title": "Min foundation assets (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only foundations whose end-of-year fair-market-value assets are at least this amount (targets larger, higher-capacity funders)."
          },
          "withFunderPhoneOnly": {
            "title": "Only records with a funder phone",
            "type": "boolean",
            "description": "Drop records whose foundation has no phone number on the filing.",
            "default": false
          },
          "includeTrustees": {
            "title": "Include trustees / officers",
            "type": "boolean",
            "description": "Attach the foundation's trustees, directors and key employees (name, title, compensation) — the decision-makers. Applies to funder profiles.",
            "default": true
          },
          "minLeadScore": {
            "title": "Minimum lead score",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Keep only records with a derived lead score (0–100) at or above this value."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "none",
              "amount"
            ],
            "type": "string",
            "description": "none = fastest (recommended): emit results in file order and stop as soon as maxResults is reached. amount = largest grants / wealthiest funders first — this must scan the ENTIRE year, so it is much slower; on very large years or short run timeouts the run stops early and returns the largest found so far (never times out). When using amount, narrow with filters (funderStates, minGrantAmount, funderEins) or raise the run timeout.",
            "default": "none"
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Maximum number of records to return.",
            "default": 1000
          },
          "maxZipParts": {
            "title": "Max ZIP parts to scan (advanced)",
            "minimum": 0,
            "type": "integer",
            "description": "Each IRS year is split into ~100 MB ZIP parts. Limit how many are downloaded for a quick sample (e.g. 1). 0 = scan all parts (complete results). Ignored for targeted EIN lookups that finish early.",
            "default": 0
          },
          "monitorMode": {
            "title": "Monitor mode (only new records)",
            "type": "boolean",
            "description": "Remember records already returned (by funder/recipient/amount/year signature) and emit ONLY new ones on the next run of the same monitor key — ideal for a scheduled fresh-grants feed. Works alongside Apify Schedules.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Namespace for monitor-mode memory. Use a distinct key per saved configuration so their 'seen' lists don't collide.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The IRS public 990 datasets are downloaded directly and need no proxy; leave disabled unless your network requires one.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}