# SBA 7(a) & 504 Loan Approval Data Scraper (`compute-edge/sba-loan-data-scraper`) Actor

Extract SBA 7(a) and 504 loan approval records from the SBA FOIA public data portal. Filter by state, NAICS code, loan amount, and fiscal year. Borrower name, address, lender, loan amount, and status for B2B lead generation.

- **URL**: https://apify.com/compute-edge/sba-loan-data-scraper.md
- **Developed by:** [Compute Edge](https://apify.com/compute-edge) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## SBA Loan Data Scraper — 7(a) & 504 FOIA Records

Extract **SBA 7(a) and SBA 504 loan approval records** from the U.S. Small Business Administration's public FOIA data portal ([data.sba.gov](https://data.sba.gov)). Each record is a **real business that received an SBA-guaranteed loan**, complete with borrower name, address, loan amount, lender, NAICS industry code, approval date, and loan status.

This dataset is a **B2B lead-generation goldmine**: every record is a verified small business that successfully secured financing. Perfect for business lenders, equipment financiers, insurance providers, and any B2B sales team targeting recently-funded companies.

### Features

- **Both loan programs**: Extract SBA 7(a) general business loans or SBA 504 fixed-asset loans
- **Filter by state**: Target borrowers in a specific state (e.g., only California or Texas businesses)
- **Filter by NAICS industry code**: Narrow to construction (23), food service (72), healthcare (62), or any specific industry sector
- **Filter by minimum loan amount**: Find larger deals — e.g., only loans above $500,000
- **Filter by fiscal year**: Focus on recently approved loans (SBA fiscal years run Oct 1 – Sep 30)
- **Stream-parsed for large files**: Handles SBA's multi-hundred-thousand-row CSV files without memory issues
- **Respects result caps**: Stops streaming once `maxResults` is reached — no wasted compute

### Extracted Data Fields

| Field | Description |
|-------|-------------|
| `borrowerName` | Legal business name of the borrower |
| `borrowerStreet` | Street address of the borrower |
| `borrowerCity` | City of the borrower |
| `borrowerState` | 2-letter state abbreviation |
| `borrowerZip` | ZIP code |
| `lenderName` | Name of the approving bank/lender |
| `lenderState` | State of the lender |
| `grossApproval` | Total approved loan amount in dollars |
| `sbaGuaranteedApproval` | SBA-guaranteed portion of the loan |
| `approvalDate` | Date the loan was approved |
| `approvalFiscalYear` | SBA fiscal year of approval |
| `naicsCode` | 6-digit NAICS industry code |
| `naicsDescription` | Industry description (e.g., "Restaurants and Other Eating Places") |
| `businessType` | Business entity type (LLC, Corporation, Sole Proprietorship, etc.) |
| `businessAge` | Age of business at time of application |
| `loanStatus` | Current status (Paid In Full, Charged Off, Exempt, etc.) |
| `termMonths` | Loan term in months |
| `jobsSupported` | Number of jobs supported by the loan |
| `projectState` | State where the project is located |
| `sbaDistrictOffice` | SBA district office that processed the loan |
| `program` | Loan program (7AGENERAL, 7ASMALL, 504, etc.) |
| `firstDisbursementDate` | Date of first disbursement |
| `paidInFullDate` | Date loan was paid in full (if applicable) |

### How to Scrape SBA Loan Data

#### Step 1: Open the Actor Input

In the Apify Console, navigate to the Actor's **Input** tab. You'll see a form with the following options:

- **Loan Program**: Choose `7a` (general business loans) or `504` (fixed-asset loans for major equipment and real estate)
- **Borrower State**: Enter a 2-letter state code to filter geographically (e.g., `TX` for Texas)
- **NAICS Code Prefix**: Enter industry digits, e.g., `72` for Food Service, `23` for Construction, `62` for Healthcare
- **Minimum Loan Amount**: Set a dollar floor, e.g., `250000` for loans over $250K
- **Approval Fiscal Year (on or after)**: Default is `2023` — recent loans only
- **Max Results**: Default `500` — increase for bulk exports up to 1,000,000

#### Step 2: Run the Actor

Click **Start**. The Actor will:
1. Query the SBA CKAN API to discover the current CSV file URL (filenames change quarterly as SBA updates the "as-of" date)
2. Stream-download the CSV directly to disk
3. Filter rows in real time according to your inputs
4. Push matched records to the Apify dataset

#### Step 3: Download Your Data

When the run completes, click **Export** to download results as JSON, CSV, or Excel. You can also integrate via the [Apify API](https://docs.apify.com/api) to pull data into your CRM, data warehouse, or marketing automation platform.

### Input Example

```json
{
    "program": "7a",
    "state": "TX",
    "naicsPrefix": "72",
    "minLoanAmount": 100000,
    "approvalFyAfter": 2024,
    "maxResults": 1000
}
````

### Output Example

```json
{
    "borrowerName": "SUNSHINE HOSPITALITY LLC",
    "borrowerStreet": "1234 MAIN ST",
    "borrowerCity": "HOUSTON",
    "borrowerState": "TX",
    "borrowerZip": "77001",
    "lenderName": "JPMORGAN CHASE BANK, NATIONAL ASSOCIATION",
    "lenderState": "OH",
    "grossApproval": 350000,
    "sbaGuaranteedApproval": 297500,
    "approvalDate": "2024-02-15",
    "approvalFiscalYear": 2024,
    "naicsCode": "722511",
    "naicsDescription": "Full-Service Restaurants",
    "businessType": "Limited Liability Company(LLC)",
    "businessAge": "Existing or more than 2 years old",
    "loanStatus": "Disbursed Current",
    "termMonths": 120,
    "jobsSupported": 12,
    "program": "7AGENERAL",
    "projectState": "TX",
    "sbaDistrictOffice": "Houston",
    "asofDate": "2026-03-31"
}
```

### Pricing

This Actor uses **per-result pricing** at **$0.003 per record** extracted. You also pay standard Apify compute costs (approximately $0.004–0.008 per run for typical 500-record extracts).

**Estimated cost examples:**

- 500 records (default): ~$0.0015 in actor fees + ~$0.005 compute = ~$0.007 total
- 5,000 records: ~$0.015 in actor fees + ~$0.01 compute = ~$0.025 total
- 50,000 records: ~$0.15 in actor fees + ~$0.02 compute = ~$0.17 total

### FAQ

**How often is the data updated?**
SBA updates the FOIA CSVs quarterly (the "as-of" date in the filename changes). This Actor automatically discovers the current file URL at runtime — no need to update the Actor between quarterly releases.

**What is the SBA 7(a) vs. 504 program?**
7(a) is the SBA's flagship general-purpose loan program for working capital, equipment, and real estate. 504 loans are for major fixed assets like commercial real estate and large equipment purchases. Both programs report detailed borrower and lender data.

**Can I get historical data going back to the 1990s?**
Yes — the SBA publishes CSVs for each decade. Set `approvalFyAfter` to `0` (or a low year) and the Actor will process earlier records. Note that historical files are large; increase `maxResults` and expect longer runtimes.

**Why default to FY2023?**
The default fiscal year filter keeps empty-input test runs fast (a few hundred thousand rows vs. millions). For bulk historical pulls, lower the threshold.

**Is this data public?**
Yes. This dataset is released by the SBA under FOIA (Freedom of Information Act) as government open data. It contains business-loan records for verified commercial borrowers, not personal consumer data.

### Legal Disclaimer

This Actor extracts publicly available data from the U.S. Small Business Administration's FOIA data portal (data.sba.gov), a U.S. federal government open data resource. The data is released under the federal government's open data policy and contains business-loan records (not personal consumer information).

Users are responsible for ensuring their use of the extracted data complies with applicable laws, including but not limited to anti-spam regulations (CAN-SPAM, CASL, GDPR) when using data for outreach. Contact <support@apify.com> with questions about compliance.

This tool is provided for research, business intelligence, and lead-generation purposes. It does not circumvent any authentication, CAPTCHA, or security measures — the SBA FOIA portal is fully public and provides direct CSV downloads.

# Actor input Schema

## `program` (type: `string`):

Which SBA loan program to extract: '7a' (SBA 7(a) General Business Loans) or '504' (SBA 504 Fixed-Asset Loans).

## `state` (type: `string`):

Filter by borrower state (2-letter abbreviation, case-insensitive). Leave blank for all states. Examples: 'CA', 'TX', 'FL', 'NY'.

## `naicsPrefix` (type: `string`):

Filter by NAICS industry code prefix (case-sensitive digits). Examples: '23' for Construction, '72' for Accommodation & Food Services, '54' for Professional Services, '62' for Health Care.

## `minLoanAmount` (type: `integer`):

Filter by minimum gross loan approval amount in dollars. Default 0 returns all amounts.

## `approvalFyAfter` (type: `integer`):

Only include loans approved in this SBA fiscal year or later. SBA fiscal years run Oct 1 – Sep 30 (e.g., FY2024 = Oct 2023–Sep 2024). Default 2023 keeps results recent and fast.

## `maxResults` (type: `integer`):

Maximum number of loan records to return. Streaming stops once this cap is hit. Default 500.

## Actor input object example

```json
{
  "program": "7a",
  "state": "",
  "naicsPrefix": "",
  "minLoanAmount": 0,
  "approvalFyAfter": 2023,
  "maxResults": 500
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("compute-edge/sba-loan-data-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("compute-edge/sba-loan-data-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call compute-edge/sba-loan-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=compute-edge/sba-loan-data-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SBA 7(a) & 504 Loan Approval Data Scraper",
        "description": "Extract SBA 7(a) and 504 loan approval records from the SBA FOIA public data portal. Filter by state, NAICS code, loan amount, and fiscal year. Borrower name, address, lender, loan amount, and status for B2B lead generation.",
        "version": "0.1",
        "x-build-id": "OFl5F1MPeMGBkzh9j"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/compute-edge~sba-loan-data-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-compute-edge-sba-loan-data-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/compute-edge~sba-loan-data-scraper/runs": {
            "post": {
                "operationId": "runs-sync-compute-edge-sba-loan-data-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/compute-edge~sba-loan-data-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-compute-edge-sba-loan-data-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": {
                    "program": {
                        "title": "Loan Program",
                        "enum": [
                            "7a",
                            "504"
                        ],
                        "type": "string",
                        "description": "Which SBA loan program to extract: '7a' (SBA 7(a) General Business Loans) or '504' (SBA 504 Fixed-Asset Loans).",
                        "default": "7a"
                    },
                    "state": {
                        "title": "Borrower State",
                        "type": "string",
                        "description": "Filter by borrower state (2-letter abbreviation, case-insensitive). Leave blank for all states. Examples: 'CA', 'TX', 'FL', 'NY'.",
                        "default": ""
                    },
                    "naicsPrefix": {
                        "title": "NAICS Code Prefix",
                        "type": "string",
                        "description": "Filter by NAICS industry code prefix (case-sensitive digits). Examples: '23' for Construction, '72' for Accommodation & Food Services, '54' for Professional Services, '62' for Health Care.",
                        "default": ""
                    },
                    "minLoanAmount": {
                        "title": "Minimum Loan Amount ($)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Filter by minimum gross loan approval amount in dollars. Default 0 returns all amounts.",
                        "default": 0
                    },
                    "approvalFyAfter": {
                        "title": "Approval Fiscal Year (on or after)",
                        "minimum": 1991,
                        "type": "integer",
                        "description": "Only include loans approved in this SBA fiscal year or later. SBA fiscal years run Oct 1 – Sep 30 (e.g., FY2024 = Oct 2023–Sep 2024). Default 2023 keeps results recent and fast.",
                        "default": 2023
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Maximum number of loan records to return. Streaming stops once this cap is hit. Default 500.",
                        "default": 500
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
