# Nero Labs Data Aggregate & Pivot

> Nero Labs Data Aggregate & Pivot is a paid API for AI agents from x402-agent-tools.nerolabs.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-22).

Groups up to 500 JSON rows and computes per-group statistics (count, sum, avg, min, max, median, distinct count, first, last) with date bucketing, pivot tables, sorting, and top-N filtering.

## Facts

- Endpoint: POST https://x402-agent-tools.nerolabs.workers.dev/data/aggregate?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/nero-labs-data-aggregate-pivot-4d0b1fe9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_iOP0ZLKWdyPo22TCZgcWx

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability nero-labs-data-aggregate-pivot-4d0b1fe9 -d '<json body>'
```

Example prompt: Take these 300 sales records and group them by region and product category, then give me the total revenue, order count, and average order value per group — sort by total revenue descending and only show the top 20 groups.

## When to prefer this

Choose this endpoint when you have a batch of raw JSON records (up to 500) and need grouped summary statistics, pivot tables, or ranked top-N results without setting up a database or writing SQL. Ideal for ad-hoc reporting, enriching agent pipelines with aggregated signals, or preprocessing data before display. It handles mixed-schema rows and supports date bucketing natively, making it more flexible than a SQL query against a rigid schema. Prefer alternatives if your dataset exceeds 500 rows or if you need joins across multiple tables.

## Known failure modes

- More than 500 rows submitted — endpoint enforces a hard cap
- More than 20 aggregation functions specified — rejected
- pivotField has more than 50 distinct values — rejected
- Invalid dot-path in groupByFields — field not found in rows
- Aggregation function other than count used without specifying a field — error
- Malformed JSON rows array — parse error
- Payment not included or insufficient — 402 response

## How this service works

Pay-per-call tools for AI agents, 31 in all: read web pages and RSS feeds, OCR, PDF text, transcription; email, phone and domain checks; UK, Irish and Polish company lookups and UK risk reports; website contacts, tech stack and SEO audits; PageSpeed; AI review, job post and row enrichment; data cleaning, joins, dedupe and diffs; US and EU compliance rules. No account or API key: pay each call in USDC on Base over x402.

## Output

Returns one row per distinct group combination containing the requested aggregation columns (e.g. sum_sales, count, avg_price), plus a summary object with groupCount, inputRowCount, outputRowCount, column names, warnings, pivot schema, and how many rows were dropped by topN filtering. Optionally includes a totals row covering all input rows.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "rows": {
   "type": "array",
   "items": {
    "type": "object"
   },
   "description": "The records to aggregate, up to 500. Each row is a JSON object; keys may differ between rows."
  },
  "topN": {
   "type": "integer",
   "minimum": 1,
   "description": "After sorting, keep only the first N groups. The totals row still covers every input row."
  },
  "sortBy": {
   "type": "string",
   "description": "An output column to sort by: a group field, an aggregation alias such as \"total_amount\", or a pivot column. Omitted sorts by the group fields."
  },
  "pivotField": {
   "type": "string",
   "description": "Turns this field's distinct values into columns, pivot-table style: group by \"region\" and pivot on \"product\" for one row per region with a column per product. Must not also be a group-by field. At most 50 distinct values."
  },
  "aggregations": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "function"
    ],
    "properties": {
     "alias": {
      "type": "string",
      "description": "Output column name."
     },
     "field": {
      "type": "string",
      "description": "The field to aggregate. Optional for count, which then counts rows."
     },
     "function": {
      "enum": [
       "count",
       "countDistinct",
       "sum",
       "avg",
       "min",
       "max",
       "median",
       "first",
       "last",
       "list",
       "listDistinct"
      ],
      "type": "string"
     }
    }
   },
   "description": "What to compute per group, for example [{\"function\":\"count\",\"alias\":\"orders\"}, {\"field\":\"amount\",\"function\":\"sum\",\"alias\":\"total_amount\"}]. Every function except count needs a field. alias is the output column name (defaults to function_field, or \"count\"). Omitted gives a plain row count per group. Up to 20."
  },
  "groupByFields": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "description": "One output row per distinct combination of these field values, like SQL GROUP BY, for example [\"region\"] or [\"city\", \"category\"]. Dot paths like \"address.city\" work. Empty or omitted aggregates every row into a single row."
  },
  "groupMatching": {
   "enum": [
    "normalized",
    "exact"
   ],
   "type": "string",
   "description": "normalized (default) ignores letter case and extra whitespace when grouping, so \"South\" and \"south \" are one group. exact requires identical values."
  },
  "pivotFun
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "rows": [
   {
    "count": 2,
    "region": "North",
    "sum_sales": 180
   },
   {
    "count": 1,
    "region": "South",
    "sum_sales": 80
   }
  ],
  "summary": {
   "pivot": null,
   "columns": [
    "region",
    "sum_sales",
    "count"
   ],
   "warnings": [],
   "groupCount": 2,
   "aggregations": [
    {
     "alias": "sum_sales",
     "field": "sales",
     "function": "sum"
    },
    {
     "alias": "count",
     "function": "count"
    }
   ],
   "droppedByTopN": 0,
   "groupByFields": [
    "region"
   ],
   "inputRowCount": 3,
   "skippedValues": {},
   "outputRowCount": 2,
   "totalsRowIncluded": false
  },
  "_example_note": "Real output, trimmed: long lists cut to their first items and long text shortened."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/nero-labs-data-aggregate-pivot-4d0b1fe9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-agent-tools.nerolabs.workers.dev](https://www.zero.xyz/host/x402-agent-tools.nerolabs.workers.dev/llms.txt)
