# New Jersey Agency Spending - Where the State Budget Goes (`j0401/nj-agency-spending`) Actor

Where New Jersey's state government spent its budget (public open data, 4.62M rows, FY2003-today): agency, organization, statewide program, expense description and category, funding source and payee, with obligated, expended and year-to-date amounts. Filter by agency, payee, program, fund or amount.

- **URL**: https://apify.com/j0401/nj-agency-spending.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 new jersey spending 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

## New Jersey Agency Spending - Where the State Budget Goes

Where the State of New Jersey spent its budget, straight from the State's own
accounting system. **4.69 million spending lines**, from fiscal 2003 through the
latest fiscal period (FY2027 included).

### Low cost

**From $0.00005 per record, down to $0.00003 at Gold.** Pay only for the
records you actually receive - the whole register stays queryable, you are
never billed for the scan behind it.

### What you get

One row per agency x organization x statewide program x expense description x
expense category x funding category x payee x fiscal year, with the money
attached to it:

- **Who spent** - the agency, the organization inside it, and the statewide
  program the spending belongs to
- **On what** - the expense description and the expenditure category, from the
  State's own chart
- **Out of what** - the funding category: Federal, Trust Fund, State Aid,
  Dedicated, Capital, Bond and more
- **To whom** - the payee
- **How much** - the amount expended and the year-to-date total, plus the
  amount obligated where the State records it

That is the full chain: agency -> organization -> program -> expense -> funding
source -> payee -> amount.

### Filter it

- **Payee** - `payee="Gannett"` finds that supplier's lines (up to 2,000 per run).
- **Agency, organization, program** - `agency="Treasury"`,
  `organization="State Police"`, `program="Judicial Services"`.
- **Expense** - `description="Travel"`, `description="Grants-in-Aid"`.
- **Funding category** - Federal, Trust Fund, State Aid, Dedicated, Capital,
  Bond Fund, Debt Service and more.
- **Fiscal year** - `fiscalYear=2025`. FY2003-FY2027 are present.
- **Amount** - `minAmount=1000000` for seven-figure lines.

### Example inputs

**Spending to one supplier** - `payee` is a substring match.

```json
{ "payee": "GANNETT", "maxResults": 25 }
```

**What one agency spends on one thing** - combine agency and expense.

```json
{ "agency": "TRANSPORTATION", "description": "CONSTRUCTION", "maxResults": 50 }
```

**The largest lines** - seven figures and up.

```json
{ "minAmount": 1000000, "maxResults": 50 }
```

**Where the money goes** - `mode=aggregate` returns one count row per agency;
every group comes back.

```json
{ "mode": "aggregate", "groupBy": "agency" }
```

### Or roll it up

Set `mode=aggregate` and get a rolled-up count by **agency**,
**organization**, **program**, **expense description**, **funding category**,
**expenditure category** or **fiscal year**. Every group comes back - this mode
is not cut off by `maxResults`.

### Then follow the money

- Spending-line counts by agency, program or funding source, over any window
  (aggregate returns counts, not dollar sums).
- Every line a supplier has been paid from the State, and for what.
- Federal vs. State Aid vs. Trust Fund line counts, side by side.
- The biggest line items, newest fiscal period first.

### Example output

**One spending line** - `payee=GANNETT`:

```json
{
 "platform": "nj-agency-spending",
 "source": "new-jersey-agency-spending",
 "mode": "rows",
 "groupKey": "",
 "groupCount": "",
 "groupBy": "",
 "fiscalYear": "2026",
 "fyThroughDate": "2026-06-30T00:00:00.000",
 "agency": "URBAN ENTERPRISE ZONE - UEZ",
 "organization": "DIV OF LOCAL GOVERNMENT SERVIC",
 "program": "ECONOMIC PLANNING AND DEVELOPMENT",
 "description": "ADVERTISING",
 "fundingCategory": "DEDICATED",
 "expenditureCategory": "SERVICES OTHER THAN PERSONAL",
 "payee": "GANNETT NEW YORK/NEW JERSEY LO",
 "obligationAmount": "0",
 "expendedAmount": "383.6",
 "ytdAmount": "383.6",
 "sourceUpdatedAt": "2026-10-07"
}
```

**`mode=aggregate`, `groupBy=agency`** - one count row per agency:

```
TREASURY                        1,408,372
HUMAN SERVICES                    457,429
LAW AND PUBLIC SAFETY             376,363
JUDICIARY                         372,768
ENVIRONMENTAL PROTECTION          246,505
LABOR                             208,302
```

### Notes on the data, from the source

- **Three money columns.** Each line carries the amount *expended* and the
  *year-to-date* total (`ytdAmount` = `expendedAmount` + `obligationAmount`), both
  fully populated, plus the amount *obligated* - which the State records on only
  \~5% of lines (the rest are 0). Filter on the expended amount:
  `minAmount`/`maxAmount`, and do not sum both `ytdAmount` and `expendedAmount`.
- **`'*'` is not a vendor.** 235,932 rows carry `*` as the payee - the State's
  marker for a bucket it does not attribute to a single payee. They are real
  and are returned as the source writes them.
- **Reversals are in here.** 110,827 rows are negative - real accounting
  entries, returned as they stand. Set `minAmount=0.01` for spending only.
- **The register follows the State's fiscal cycle**, not a daily feed, so the
  newest data lags the refresh. `sourceUpdatedAt` carries the dataset's own
  refresh date.
- **Payee and organization names are free text as typed into the system**, so a
  substring match is the right way to search them.
- **One run returns up to 2,000 lines.** Narrow the filters (payee, agency,
  program, amount or fiscal period) to reach a specific slice.

# Actor input Schema

## `payee` (type: `string`):

Substring match on the payee name, e.g. 'GANNETT', 'MICROSOFT', 'MEDICAL'. Payee names are free text as typed into the accounting system. Note that '\*' marks a bucket not attributed to a single payee (230,965 rows). Blank = any.

## `agency` (type: `string`):

Substring match on the spending agency, e.g. 'TREASURY', 'HUMAN SERVICES', 'TRANSPORTATION'. 58 agencies in total. Blank = any.

## `organization` (type: `string`):

Substring match on the organization within the agency, e.g. 'STATE POLICE', 'CHILD PROTECTION'. 475 organizations in total. Blank = any.

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

Substring match on the statewide program the spending belongs to, e.g. 'JUDICIAL SERVICES', 'SOCIAL SERVICES'. 57 programs in total. Blank = any.

## `description` (type: `string`):

Substring match on the expense description, e.g. 'TRAVEL', 'MILEAGE', 'GRANTS-IN-AID', 'PROF SERV'. 226 descriptions in total. Blank = any.

## `fundingCategory` (type: `string`):

Exact funding source, e.g. 'FEDERAL', 'TRUST FUND', 'STATE AID'. 'Undefined' is a value the State itself publishes. Blank = any.

## `expenditureCategory` (type: `string`):

Exact expenditure category from the State's own chart. Blank = any.

## `fiscalYear` (type: `integer`):

Exact state fiscal year (July-June), e.g. 2025. Blank = any. FY2003-FY2027 are present.

## `fyFrom` (type: `string`):

Earliest fiscal period-end snapshot date, YYYY-MM-DD. Blank = any.

## `fyTo` (type: `string`):

Latest fiscal period-end snapshot date, YYYY-MM-DD. Blank = any.

## `minAmount` (type: `number`):

Smallest amount expended in dollars. Leave blank to include reversals, which are negative (110,827 rows). Set 0.01 for spending only.

## `maxAmount` (type: `number`):

Largest amount expended in dollars. Blank = no upper bound.

## `recentDays` (type: `integer`):

Only rows whose fiscal period end falls within the last N days. Cannot be combined with 'Fiscal period end on or after' (the run fails if both are set). 0 = off.

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

rows = spending rows matching your filters (default). aggregate = one count row per group (see groupBy).

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

Which dimension to aggregate over (mode=aggregate). Blank = agency. Every group is returned - aggregate mode is not cut off by maxResults.

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

Cap the number of records pushed in rows mode (0 = default 50; up to 2,000 per run). Each record is metered individually, so there is no per-run charge cap. Aggregate mode returns every group.

## Actor input object example

```json
{
  "payee": "",
  "agency": "",
  "organization": "",
  "program": "",
  "description": "",
  "fundingCategory": "",
  "expenditureCategory": "",
  "fyFrom": "",
  "fyTo": "",
  "recentDays": 0,
  "mode": "rows",
  "groupBy": "",
  "maxResults": 50
}
```

# Actor output Schema

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

New Jersey agency spending 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/nj-agency-spending").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/nj-agency-spending").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/nj-agency-spending --silent --output-dataset

```

## MCP server setup

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

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/U5UFApKrcgOZoCWtF/builds/0OJ0hhYcJGVRoTTr3/openapi.json
