{
  "openapi": "3.0.1",
  "info": {
    "title": "SBA 7(a) and 504 Small Business Loan Data",
    "description": "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.",
    "version": "0.0",
    "x-build-id": "3tgPZ8bI8fxfeyH7P"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/j0401~sba-loans/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-j0401-sba-loans",
        "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/j0401~sba-loans/runs": {
      "post": {
        "operationId": "runs-sync-j0401-sba-loans",
        "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/j0401~sba-loans/run-sync": {
      "post": {
        "operationId": "run-sync-j0401-sba-loans",
        "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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "",
              "search",
              "lookup",
              "aggregate"
            ],
            "type": "string",
            "description": "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": {
            "title": "Program",
            "enum": [
              "7a",
              "504"
            ],
            "type": "string",
            "description": "7a = the 7(a) loan program (1.96M loans). 504 = the 504/CDC program (229k loans).",
            "default": "7a"
          },
          "borrName": {
            "title": "Borrower name",
            "type": "string",
            "description": "Borrower name substring, case-insensitive (e.g. \"PHOTOGRAPHY\"). In lookup mode this is an exact match."
          },
          "lender": {
            "title": "Lender",
            "type": "string",
            "description": "Originating lender substring, case-insensitive - the 7(a) bank (e.g. \"WELLS FARGO\") or the 504 CDC (e.g. \"CDC SMALL BUSINESS FINANCE\")."
          },
          "borrState": {
            "title": "Borrower state",
            "type": "string",
            "description": "Two-letter borrower state code, exact (e.g. \"CA\")."
          },
          "borrZip": {
            "title": "Borrower ZIP prefix",
            "type": "string",
            "description": "Borrower ZIP prefix, digits (e.g. \"9410\")."
          },
          "projectState": {
            "title": "Project state",
            "type": "string",
            "description": "Two-letter state of the project being financed, exact (e.g. \"TX\")."
          },
          "projectCounty": {
            "title": "Project county",
            "type": "string",
            "description": "Project county substring, case-insensitive."
          },
          "naicsCode": {
            "title": "NAICS code",
            "type": "string",
            "description": "NAICS industry code prefix, digits (e.g. \"722\" restaurants, \"44\" retail). Empty on early-year 7(a) loans."
          },
          "franchiseCode": {
            "title": "Franchise code",
            "type": "string",
            "description": "SBA franchise code, exact (e.g. \"5812\"). Use to find loans to franchised businesses."
          },
          "businessType": {
            "title": "Business type",
            "enum": [
              "",
              "CORPORATION",
              "INDIVIDUAL",
              "PARTNERSHIP"
            ],
            "type": "string",
            "description": "Borrower legal form, exact."
          },
          "loanStatus": {
            "title": "Loan status",
            "enum": [
              "",
              "PIF",
              "CHGOFF",
              "CANCLD",
              "EXEMPT",
              "COMMIT",
              "NOT FUNDED",
              "CLOSED"
            ],
            "type": "string",
            "description": "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": {
            "title": "Approval fiscal year",
            "type": "integer",
            "description": "Exact SBA approval fiscal year (e.g. 2021). Narrows which shards are read."
          },
          "fyMin": {
            "title": "Approval FY from",
            "type": "integer",
            "description": "Earliest approval fiscal year (inclusive)."
          },
          "fyMax": {
            "title": "Approval FY to",
            "type": "integer",
            "description": "Latest approval fiscal year (inclusive)."
          },
          "amountMin": {
            "title": "Approved amount from",
            "type": "number",
            "description": "Lowest gross approved amount (USD). An amount filter only returns loans that record an amount."
          },
          "amountMax": {
            "title": "Approved amount to",
            "type": "number",
            "description": "Highest gross approved amount (USD)."
          },
          "approvalFrom": {
            "title": "Approval date from",
            "type": "string",
            "description": "Earliest approval date (inclusive). Accepts \"YYYY\", \"YYYY-MM\" or \"YYYY-MM-DD\"."
          },
          "approvalTo": {
            "title": "Approval date to",
            "type": "string",
            "description": "Latest approval date (inclusive). Accepts \"YYYY\", \"YYYY-MM\" or \"YYYY-MM-DD\"."
          },
          "locationId": {
            "title": "Location ID",
            "type": "string",
            "description": "The SBA extract's internal LocationID, exact match (not a loan number)."
          },
          "aggregate": {
            "title": "Aggregate instead of records",
            "type": "boolean",
            "description": "When on, returns one summary record per group (with a count) instead of individual loan records.",
            "default": false
          },
          "groupBy": {
            "title": "Aggregate by",
            "enum": [
              "borrState",
              "projectState",
              "naicsCode",
              "approvalFY",
              "lenderName",
              "loanStatus",
              "businessType"
            ],
            "type": "string",
            "description": "borrState -> loans by borrower state; lenderName -> by 7(a) bank / 504 CDC; naicsCode -> by industry; approvalFY -> by year; loanStatus -> the outcome mix.",
            "default": "borrState"
          },
          "maxResults": {
            "title": "Max records",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of records pushed. The aggregate mode returns every group in full and is not cut by this cap.",
            "default": 200
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}