# SBA 7(a) and 504 Small Business Loan Data (`j0401/sba-loans`) Actor

Every U.S. SBA 7(a) and 504 small-business loan since 1991 (SBA FOIA, free public data): 2.19M loans with the borrower, the lender (bank or CDC), the approved amount, loan status, NAICS industry, jobs supported and the outcome. Search by borrower, lender, state, industry, year or amount.

- **URL**: https://apify.com/j0401/sba-loans.md
- **Developed by:** [Wenhao Yang](https://apify.com/j0401) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.03 / 1,000 sba loan records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SBA 7(a) and 504 Small Business Loans

The U.S. Small Business Administration publishes its full FOIA loan extracts - **every 7(a) and 504 loan the agency has approved** - as free public data on data.sba.gov. This actor turns that register into a **charged-per-record lookup, screening and analysis tool** over **2,190,504 loans** back to 1991.

**Built for:** small-business and commercial lenders, credit and market research, franchise and industry analysis, government-contracting research, SBA-lender due diligence, and borrower screening.

### What it covers

Two programs, one actor. Pick a `corpus`:

| Program | Loans | FY range | Lenders |
|---|---|---|---|
| **7(a)** | 1,961,455 | 1991-2026 | banks: 5,655 distinct |
| **504** | 229,049 | 1991-2026 | CDCs: 249 distinct |

Each record carries the **borrower** (name, street, city, state, ZIP), the **lender** - the originating bank (7(a): name, FDIC/NCUA number, address) or the Certified Development Company (504: name and address) - the **third-party lender** on 504 loans, the **gross approved amount** and the SBA-guaranteed amount (7(a)), the **approval date and fiscal year**, the **NAICS code and industry description**, the **franchise** code and name, the **project county and state**, the **business type and age**, the **term**, the **jobs supported**, and the **loan status and outcome** - the date paid in full, the charge-off date and the charge-off amount.

**Where the money went, and how it ended.** 7(a) approvals by borrower state: **CA 254,619 / TX 155,470 / NY 129,267 / FL 103,265**. 504 by state: **CA 45,049 / FL 16,584 / TX 10,666**. Loan-status mixes are a genuine risk signal:

| Status | 7(a) | 504 |
|---|---|---|
| Paid in full (PIF) | 1,179,360 | 114,445 |
| Exempt | 297,494 | 61,266 |
| Cancelled | 242,790 | 32,314 |
| **Charged off** | **220,688** | **12,169** |
| Committed | 21,123 | - |
| Not funded | - | 8,516 |
| Closed | - | 339 |

> **Two things worth knowing.** The extract carries **no unique loan number**, so `lookup` resolves a borrower by exact name plus location. And the "paid in full" status ships spelled two ways in the source - `PIF` on the 504 side and `P I F` on the 7(a) side - so the actor normalizes both to `PIF` (`loanStatusNormalized`) before filtering or grouping, and a facet can never silently split.

### Typical questions

- "Show every SBA 7(a) loan to a **restaurant (NAICS 722)** in California that **charged off**."
- "How much 7(a) lending has **Wells Fargo** done since 2015?"
- "Which **504 CDCs** are most active in Florida?"
- "Find SBA loans to **this borrower**."
- "How did 7(a) approvals **trend by fiscal year**, and how do they break down **by state and industry**?"
- "Which franchises took the most SBA money?"

### Inputs

| Input | What it does |
|---|---|
| `corpus` | `7a` (default) or `504` |
| `borrName` / `lender` | borrower or originating-lender name substring, case-insensitive |
| `borrState` / `projectState` / `projectCounty` / `borrZip` | location of the borrower or the financed project |
| `naicsCode` / `franchiseCode` | industry code prefix / SBA franchise code |
| `businessType` / `loanStatus` | legal form / loan status (`PIF`, `CHGOFF`, `CANCLD`, `EXEMPT`, `COMMIT`) |
| `approvalFY` or `fyMin` / `fyMax` | SBA approval fiscal year (exact or range) - narrows which shards are read |
| `amountMin` / `amountMax` | gross approved amount range |
| `approvalFrom` / `approvalTo` | approval date window (`YYYY`, `YYYY-MM` or `YYYY-MM-DD`) |
| `locationId` | the extract's internal LocationID, exact |
| `aggregate` / `groupBy` | one summary row per group with a count - borrower state / project state / NAICS / approval FY / lender / loan status / business type |
| `maxResults` | cap records. The `aggregate` mode returns every group in full and is **not** cut by this cap. |

**Default run = a tiny aggregate** (loans by borrower state) - fast and safe for the daily auto-test, never a surprise full dump. For records, add a `borrName` / `lender` / `loanStatus` / `projectState` filter or a `locationId`.

### Example inputs

**A borrower's loans** - a bare name in `lookup` mode returns that borrower's SBA loans.

```json
{ "mode": "lookup", "corpus": "7a", "borrName": "Anytime Fitness" }
```

**Charged-off restaurant loans in California** -

```json
{ "corpus": "7a", "projectState": "CA", "naicsCode": "722", "loanStatus": "CHGOFF", "maxResults": 20 }
```

**Large 504 projects in California** -

```json
{ "corpus": "504", "projectState": "CA", "amountMin": 2000000, "maxResults": 20 }
```

**7(a) lending by state, FY2020 and later** -

```json
{ "corpus": "7a", "fyMin": 2020, "aggregate": true, "groupBy": "borrState", "maxResults": 50 }
```

### Low cost

**From $0.00005 per record, down to $0.00003 at Gold.** Billed only for the rows you use, and each record is metered individually.

The SBA register is **~1 GB of flat CSV across six files** with no query server behind it - there is no way to ask the SBA for "just charged-off restaurant loans in California". Rather than make every lookup pay for a full-register download, the register is **mirrored into fiscal-year shards**, and each run streams only the shards its filter needs - memory stays flat, so a query scales with the rows returned. Every refresh is integrity-checked against the register's known shape (per-segment row floors, the expected columns, the loan-status vocabulary and key-column coverage), so a degraded or schema-changed source **fails loudly** at refresh instead of publishing bad rows.

### Example output

**`mode=lookup`, a 504 borrower** (abridged):

```json
{
 "platform": "sba-loans",
 "source": "sba-foia-loans",
 "state": "US",
 "corpus": "504",
 "borrName": "Turning Brook",
 "borrCity": "Alpena",
 "borrState": "MI",
 "borrZip": "49707",
 "lenderName": "Michigan Certified Development Corporation",
 "cdcName": "Michigan Certified Development Corporation",
 "thirdPartyLenderName": "Mercantile Bank",
 "thirdPartyDollars": "1767115",
 "grossApproval": "1248000",
 "approvalDate": "2009-10-02",
 "approvalFY": "2010",
 "termInMonths": "240",
 "naicsCode": "623312",
 "naicsDescription": "Homes for the Elderly",
 "projectCounty": "ALPENA",
 "projectState": "MI",
 "businessType": "CORPORATION",
 "loanStatus": "PIF",
 "loanStatusNormalized": "PIF",
 "paidInFullDate": "2012-12-31",
 "jobsSupported": "14",
 "refreshed": "2026-10-13",
 "mode": "record"
}
```

**`aggregate=true`, `corpus=7a`, `groupBy=borrState`** - 7(a) loans by borrower state (top):

```
CA   254,619
TX   155,470
NY   129,267
FL   103,265
OH    87,900
```

### Source

- [SBA - 7(a) & 504 FOIA data (data.sba.gov)](https://data.sba.gov/dataset/7a-504-foia) - the official free public dataset this actor reads.
- Loan data is the SBA's own published FOIA extract; it reflects the agency's record as of the extract's as-of date.

# Actor input Schema

## `mode` (type: `string`):

lookup = one borrower (exact name + location). aggregate = one row per group. Leave blank to auto-route: nothing set -> aggregate; a locationId -> lookup; otherwise search.

## `corpus` (type: `string`):

7a = the 7(a) loan program (1.96M loans). 504 = the 504/CDC program (229k loans).

## `borrName` (type: `string`):

Borrower name substring, case-insensitive (e.g. "PHOTOGRAPHY"). In lookup mode this is an exact match.

## `lender` (type: `string`):

Originating lender substring, case-insensitive - the 7(a) bank (e.g. "WELLS FARGO") or the 504 CDC (e.g. "CDC SMALL BUSINESS FINANCE").

## `borrState` (type: `string`):

Two-letter borrower state code, exact (e.g. "CA").

## `borrZip` (type: `string`):

Borrower ZIP prefix, digits (e.g. "9410").

## `projectState` (type: `string`):

Two-letter state of the project being financed, exact (e.g. "TX").

## `projectCounty` (type: `string`):

Project county substring, case-insensitive.

## `naicsCode` (type: `string`):

NAICS industry code prefix, digits (e.g. "722" restaurants, "44" retail). Empty on early-year 7(a) loans.

## `franchiseCode` (type: `string`):

SBA franchise code, exact (e.g. "5812"). Use to find loans to franchised businesses.

## `businessType` (type: `string`):

Borrower legal form, exact.

## `loanStatus` (type: `string`):

PIF paid in full / CHGOFF charged off / CANCLD cancelled / EXEMPT exempt / COMMIT committed / NOT FUNDED / CLOSED. (The source stores "PIF" and "P I F" for the same status; both map to PIF.)

## `approvalFY` (type: `integer`):

Exact SBA approval fiscal year (e.g. 2021). Narrows which shards are read.

## `fyMin` (type: `integer`):

Earliest approval fiscal year (inclusive).

## `fyMax` (type: `integer`):

Latest approval fiscal year (inclusive).

## `amountMin` (type: `number`):

Lowest gross approved amount (USD). An amount filter only returns loans that record an amount.

## `amountMax` (type: `number`):

Highest gross approved amount (USD).

## `approvalFrom` (type: `string`):

Earliest approval date (inclusive). Accepts "YYYY", "YYYY-MM" or "YYYY-MM-DD".

## `approvalTo` (type: `string`):

Latest approval date (inclusive). Accepts "YYYY", "YYYY-MM" or "YYYY-MM-DD".

## `locationId` (type: `string`):

The SBA extract's internal LocationID, exact match (not a loan number).

## `aggregate` (type: `boolean`):

When on, returns one summary record per group (with a count) instead of individual loan records.

## `groupBy` (type: `string`):

borrState -> loans by borrower state; lenderName -> by 7(a) bank / 504 CDC; naicsCode -> by industry; approvalFY -> by year; loanStatus -> the outcome mix.

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

Cap the number of records pushed. The aggregate mode returns every group in full and is not cut by this cap.

## Actor input object example

```json
{
  "corpus": "7a",
  "aggregate": false,
  "groupBy": "borrState",
  "maxResults": 200
}
```

# Actor output Schema

## `recordsUrl` (type: `string`):

SBA 7(a) and 504 small-business loan records - as JSON

## `datasetUrl` (type: `string`):

No description

## `runUrl` (type: `string`):

No description

# 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("j0401/sba-loans").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("j0401/sba-loans").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).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 j0401/sba-loans --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,j0401/sba-loans"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pmnnA3Lp0IcKSZYXn/builds/3tgPZ8bI8fxfeyH7P/openapi.json
