# US SBA 7(a) & 504 Approved Loan Intelligence (`afkdigital/newapi12-sba-approved-loan-intelligence`) Actor

Filter official SBA FOIA approved loan records by program, borrower state, NAICS, date and approval amount. Approvals are not disbursements, balances or completed acquisitions.

- **URL**: https://apify.com/afkdigital/newapi12-sba-approved-loan-intelligence.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$8.00 / 1,000 approved 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.

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

## US SBA 7(a) & 504 Approved Loan Intelligence

**NEWAPI12 | Version 1.0.0 | Source: official SBA 7(a) & 504 FOIA CSV**

Filter U.S. Small Business Administration (SBA) loan-level approvals by program, borrower state, NAICS prefix, gross approval amount, and calendar approval date.

**Financial context:** SBA loan approval DOES NOT establish loan disbursement, current outstanding balance, acquisition of a business, ongoing loan activity, or borrower financial health. The SBA source has no reliable acquisition-purpose column; this Actor makes no claim that a borrower acquired another business. Not affiliated with SBA.

### Input and price

Small valid default input:

```json
{"program":"7a","state":"PA","approvalYear":2020,"maxResults":5,"maxCostUsd":0.04}
```

504 example:

```json
{"program":"504","state":"MI","approvalYear":2010,"maxResults":3,"maxCostUsd":0.024}
```

Arguments: program (7a or 504); state (two-letter borrower state); naicsCode (2 to 6 digit prefix); minGrossApprovalAmount (minimum USD gross amount); approvalYear (calendar year) OR startDate/endDate (inclusive, YYYY-MM-DD; date window overrides approvalYear); maxResults (1–50,000); maxCostUsd ($0.008–$400).

Target pricing: **$0.008 per deduplicated loan record**, $8 for 1,000 records, using the primary synthetic pay-per-event **apify-default-dataset-item** event. No additional custom result charge or paid start event; duplicate, invalid and excluded rows create no dataset-item charges. Input and Apify run price limits are both respected. Actual event monetization must be configured on the Actor Publishing tab; shipping source code does not itself set the Store price.

### SBA source semantics (critical)

| Field | 7(a) | 504 |
| --- | --- | --- |
| gross_approval_amount | GrossApproval: 7(a) loan total | GrossApproval: SBA/CDC loan amount, NOT full project or third-party portion |
| sba_guaranteed_amount | SBAGuaranteedApproval | null: field absent |
| lender_name | BankName: bank currently assigned | CDC_Name: CDC currently assigned, not ThirdPartyLender_Name |
| approval_date | ApprovalDate | ApprovalDate |
| business_type | BusinessType | BusinessType |
| loan_status_raw | LoanStatus unchanged | LoanStatus unchanged |

The official SBA dictionary describes LocationID as SBA's lender ID code, NOT a unique loan ID. Deduplication uses borrower name, address, approval date, amount, NAICS and assigned lending organization. In rare cases, different loans with identical values may collapse: no source-supplied unique loan ID is asserted.

Missing fields are null, not invented. For individual/sole proprietor borrower types, street addresses are suppressed to reduce disclosure of residential addresses. Dates are ISO 8601. NAICS stays a string. Observed time is the collection timestamp, not a financial event.

### Snapshot discovery and bounded-memory architecture

Dataset and source: https://data.sba.gov/dataset/7a-504-foia
License: U.S. Government Works; refer to SBA for original legal terms.

SBA states the 7(a) and 504 FOIA datasets are refreshed **quarterly**, usually approximately one month after quarter-end. On 2026-10-20, official resources were labeled **as of June 30, 2026** (filename asof_260630).

There are four 7(a) CSV files (FY1991-1999; FY2000-2009; FY2010-2019; FY2020-present) and two 504 files (FY1991-2009; FY2010-present). At each run, catalog HTML is read to discover resource URLs. This is NOT a CKAN per-loan API. Official HTTPS origin and filenames are validated.

CSV is streamed from HTTPS through Python's built-in CSV parser in bounded memory, with limited retry, snapshot header consistency checks, data validation, dedupe, record filtering and an output budget cap. A full scan of a very selective source may be slow despite few results; interruptions can require rereading and skipping already scanned rows. If SBA changes its columns, the Actor fails closed rather than mislabeling them.

### Output JSON and CSV

Each Dataset item has:
loan_program, borrower_name, borrower_address, gross_approval_amount, sba_guaranteed_amount, lender_name, naics_code, approval_date, business_type, loan_status_raw, source_file, source_url, observed_at.

Apify default Dataset is exportable as both JSON and CSV. Source details and run metrics are in default key-value records SOURCE_MANIFEST and RUN_SUMMARY, accessible through Actor Output.

### Tests

```bash
python3 -m unittest discover -s tests -v
python3 src/local_smoke.py
python3 src/local_smoke.py samples/504-input.json
docker build -t newapi12-sba-approved:1.0.0 .
```

No proxy, private API or SBA credential is required. The Apify API credential is kept outside code and logs.

# Actor input Schema

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

Choose one program; the 504 gross amount is the SBA/CDC portion.

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

Two-letter BorrState code; blank searches all borrower states.

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

Enter 2 to 6 NAICS digits; a prefix matches broader sectors.

## `minGrossApprovalAmount` (type: `number`):

Program-specific gross approval amount (7a total; 504 SBA/CDC loan).

## `approvalYear` (type: `integer`):

Calendar year of ApprovalDate. If startDate/endDate is set, date range takes precedence.

## `startDate` (type: `string`):

YYYY-MM-DD inclusive. Overrides approvalYear when supplied.

## `endDate` (type: `string`):

YYYY-MM-DD inclusive. Overrides approvalYear when supplied.

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

Only deduplicated visible loan records are billed.

## `maxCostUsd` (type: `number`):

Hard cap based on $0.008 per distinct output record; actual Apify PPE run charge cap also applies.

## Actor input object example

```json
{
  "program": "7a",
  "state": "PA",
  "minGrossApprovalAmount": 0,
  "approvalYear": 2020,
  "maxResults": 5,
  "maxCostUsd": 0.04
}
```

# Actor output Schema

## `loans` (type: `string`):

No description

## `csv` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `manifest` (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("afkdigital/newapi12-sba-approved-loan-intelligence").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("afkdigital/newapi12-sba-approved-loan-intelligence").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 afkdigital/newapi12-sba-approved-loan-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/newapi12-sba-approved-loan-intelligence"
        }
    }
}
```

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/lGdpvoVBtSGuDrcQH/builds/Pyf5bCSSkyGfC2JXo/openapi.json
