# Relaystation GroupBy Aggregation

> Relaystation GroupBy Aggregation is a paid API for AI agents from api.relaystation.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Groups rows of tabular data and computes aggregations (count, sum, avg, min, max) in a single API call, billed per MB of input data.

## Facts

- Endpoint: POST https://api.relaystation.ai/v1/data/groupby
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/relaystation-groupby-aggregation-9f1e1b58
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_BjcGOcZf8A_gIe0Jj08go

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 relaystation-groupby-aggregation-9f1e1b58 -d '<json body>'
```

Example prompt: Group this sales dataset by region and product category, then give me the count, sum, and average of the revenue column for each group.

## When to prefer this

Choose this endpoint when you need server-side grouping and multi-aggregate computation in a single call without setting up a database or running local data processing code. It is ideal for agents that receive tabular data and need summarized statistics quickly, especially when the data is already in JSON/array form and you want count, sum, avg, min, and max computed together. Prefer it over general-purpose code execution when you want predictable per-MB pricing and don't want to manage compute infrastructure.

## Known failure modes

- Invalid or malformed input data returns a parsing error
- Referencing a column name that doesn't exist in the dataset causes a column-not-found error
- Unsupported aggregation function names return a validation error
- Extremely large payloads may timeout or exceed size limits
- Malformed JSON body returns a 400 bad request
- Missing required fields (data rows or grouping keys) returns a schema validation error

## How this service works

$0.0002/MB. Group rows and aggregate — count, sum, avg, min, max — in one call. 1¢ x402 min; remainder auto-credits — relaystation.ai/penny

## Output

Returns grouped result rows where each row represents a unique combination of the grouping columns, along with the requested aggregate values (count, sum, avg, min, max) for the specified numeric columns. Billed at $0.0002/MB of input data with a 1¢ minimum via x402 micropayment; any overpaid amount is auto-credited.

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "properties": {
      "file": {
       "type": "object",
       "description": "cputools input-source: { inline: <base64 ≤ 4 MiB> } or { inputKey: <scratch key from /v1/cputools/upload-url, ≤ 50 MB> }."
      },
      "by": {
       "type": "array",
       "items": {
        "type": "string"
       },
       "minItems": 1
      },
      "aggregate": {
       "type": "array",
       "minItems": 1,
       "items": {
        "type": "object",
        "required": [
         "fn"
        ],
        "properties": {
         "column": {
          "type": "string",
          "description": "Required for every fn except count."
         },
         "fn": {
          "type": "string",
          "enum": [
           "count",
           "sum",
           "avg",
           "min",
           "max",
           "first",
           "last"
          ]
         },
         "as": {
          "type": "string",
          "description": "Output column name."
         }
        }
       }
      },
      "from": {
       "type": "string",
       "enum": [
        "csv",
        "tsv",
        "json",
        "ndjson"
       ],
       "description": "A tabular file format: csv, tsv, json (array of objects), or ndjson."
      },
      "to": {
       "type": "string",
       "enum": [
        "csv",
        "tsv",
        "json",
        "ndjson"
       ],
       "description": "A tabular file format: csv, tsv, json (array of objects), or ndjson."
      }
     }
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   },
   "required": [
    "type"
   ]
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/relaystation-groupby-aggregation-9f1e1b58/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.relaystation.ai](https://www.zero.xyz/host/api.relaystation.ai/llms.txt)
