NewBizBot
|Docs

Data API Overview

Programmatic access to public government datasets via a clean REST API.

The NewBizBot Data API provides access to public government datasets through a standards-based REST interface powered by PostgREST.

Available Datasets

DatasetTableRecordsDescription
PPP Loansppp_loans~11.5MSBA Paycheck Protection Program loan records (FOIA)
FMCSA Censusfmcsa_census~1.96MFMCSA Motor Carrier Census — active motor carrier records

Key Features

  • PostgREST query language — filter, sort, paginate, and search using URL query parameters
  • Full-text search — search by name with PostgreSQL tsvector
  • Aggregate RPCs — pre-built aggregate functions for stats by state or industry
  • API key authentication — Clerk-powered API keys for machine-to-machine access
  • Rate limiting — 100 requests/minute per API key
  • CORS enabled — use directly from browser-based applications

Quick Examples

# Find restaurants (NAICS 7225*) in Texas with loan amount > $50K
curl "https://newbizbot.ai/api/data/ppp_loans?borrower_state=eq.TX&naics_code=like.7225*&initial_approval_amount=gt.50000&limit=5" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Find motor carriers in California with 50+ power units
curl "https://newbizbot.ai/api/data/fmcsa_census?phy_state=eq.CA&power_units=gte.50&limit=5" \
  -H "Authorization: Bearer YOUR_API_KEY"

Getting Started

  1. Create an API key from the dashboard
  2. Read the Authentication guide to learn how to authenticate requests
  3. Browse the query syntax reference below for filtering, sorting, and pagination
  4. Browse the NAICS Code Reference to understand industry codes (PPP Loans)
  5. See the PPP Loans or FMCSA Census dataset pages for schemas, querying examples, and aggregate functions

Query Syntax Reference

The Data API uses PostgREST query syntax. All filtering, sorting, and pagination is done via URL query parameters.

Base URL

https://newbizbot.ai/api/data/{table}

Replace {table} with ppp_loans or fmcsa_census. See each dataset's page for available columns and indexes.

Filtering

Add filters as query parameters using the format column=operator.value:

# Exact match
?borrower_state=eq.TX

# Greater than
?initial_approval_amount=gt.100000

# Pattern matching (wildcards)
?naics_code=like.7225*

# Multiple filters (AND)
?borrower_state=eq.TX&naics_code=like.7225*&initial_approval_amount=gt.50000

Available Operators

OperatorDescriptionExample
eqEquals?borrower_state=eq.TX
neqNot equals?loan_status=neq.Exemption 4
gtGreater than?initial_approval_amount=gt.100000
gteGreater than or equal?jobs_reported=gte.10
ltLess than?initial_approval_amount=lt.50000
lteLess than or equal?term=lte.24
likePattern match (case-sensitive)?naics_code=like.7225*
ilikePattern match (case-insensitive)?borrower_name=ilike.*restaurant*
isNull check?forgiveness_amount=is.null
inIn list?borrower_state=in.(TX,CA,NY)
csArray contains (for array columns)?cargo_types=cs.{"General Freight"}

Search by name using PostgreSQL full-text search:

# PPP Loans — search borrower name
?borrower_name_search=fts.mcdonalds

# FMCSA Census — search carrier name
?legal_name_search=fts.werner

Full-text search columns use GIN indexes and are optimized for fast lookups across millions of records.

Selecting Columns

By default, a core subset of columns is returned. Request specific columns with select:

?select=borrower_name,borrower_city,initial_approval_amount,naics_code

Use select=* to get all columns.

Sorting

# Sort by a column descending
?order=initial_approval_amount.desc

# Sort by multiple columns
?order=borrower_state.asc,initial_approval_amount.desc

Only indexed columns can be used for sorting. See each dataset page for the list of sortable columns.

Pagination

Limit & Offset

# First 50 results
?limit=50

# Next 50 results
?limit=50&offset=50

Limits:

  • Maximum limit: 1,000 (default if omitted)
  • Maximum offset: 10,000

For deeper pagination, use keyset pagination:

# First page
?order=id&limit=1000

# Next page (use last id from previous response)
?id=gt.12345&order=id&limit=1000

Range Header

Alternatively, use the Range header:

curl "https://newbizbot.ai/api/data/ppp_loans?borrower_state=eq.FL" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Range: 0-49"

Counting

To get a count of matching rows without fetching data:

curl -I "https://newbizbot.ai/api/data/ppp_loans?borrower_state=eq.CA&limit=0" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Prefer: count=exact"

The total count appears in the Content-Range response header: Content-Range: */48523

Aggregate RPCs

Both datasets provide pre-built RPC endpoints for aggregate queries. Call them at:

https://newbizbot.ai/api/data/rpc/{function_name}

See each dataset page for available RPC functions, parameters, and examples:

Query Guardrails

To ensure fast responses, these guardrails are enforced:

RuleDetails
Filter requiredAt least one filter must use an indexed column (see each dataset's Fast-Lookup Columns)
Sortable columnsORDER BY is restricted to indexed columns
Limit capMaximum 1,000 rows per request
Offset capMaximum 10,000 offset (use keyset pagination beyond this)
OR clause limitMaximum 3 clauses in an or expression

Guardrail violations return a 400 response with an error and message explaining what to fix.

On this page

Data API Overview | NewBizBot Documentation | NewBizBot Documentation