# RelayStation Pivot

> RelayStation Pivot 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).

Reshapes tabular data between long and wide formats — pivot or unpivot a table without a spreadsheet.

## Facts

- Endpoint: POST https://api.relaystation.ai/v1/data/pivot
- 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-pivot-915f2147
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_11IDE3z7NoEoY3r-4cSZr

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-pivot-915f2147 -d '<json body>'
```

Example prompt: I have a table where each row is one measurement per person per date, and I want to pivot it so each person gets one row with dates as columns — can you reshape it long-to-wide for me?

## When to prefer this

Choose this endpoint when you need a fast, serverless way to reshape tabular data between long and wide formats without spinning up pandas, Excel, or a database. Ideal for agents that receive CSVs or JSON tables and need to reformat them for downstream analysis or reporting, especially when the operation is one-off and not part of a larger data pipeline.

## Known failure modes

- Ambiguous pivot key or value field causes malformed output
- Input data too large for per-call pricing tier, may require chunking
- Non-unique index values during pivot result in aggregation errors or rejection
- Malformed or inconsistent input table structure returns a 400 error
- Insufficient USDC balance causes x402 payment failure

## How this service works

$0.0002/MB. Reshape tables long↔wide — pivot and unpivot without a spreadsheet. 1¢ x402 min; remainder auto-credits — relaystation.ai/penny

## Output

Returns a reshaped version of the input table — either pivoted from long to wide format (multiple rows per entity collapsed into columns) or unpivoted from wide to long format (columns expanded into rows). Output is structured tabular data reflecting the new shape.

## 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> }."
      },
      "mode": {
       "type": "string",
       "enum": [
        "pivot",
        "unpivot"
       ]
      },
      "index": {
       "type": "array",
       "items": {
        "type": "string"
       },
       "minItems": 1,
       "description": "pivot: the row-key columns."
      },
      "columns": {
       "type": "string",
       "description": "pivot: the column whose values become output columns."
      },
      "values": {
       "type": "string",
       "description": "pivot: the column aggregated into the cells."
      },
      "agg": {
       "type": "string",
       "enum": [
        "count",
        "sum",
        "avg",
        "min",
        "max"
       ],
       "description": "pivot: cell aggregate (default count behavior per route)."
      },
      "id": {
       "type": "array",
       "items": {
        "type": "string"
       },
       "minItems": 1,
       "description": "unpivot: the id columns kept on every output row."
      },
      "value": {
       "type": "array",
       "items": {
        "type": "string"
       },
       "minItems": 1,
       "description": "unpivot: the columns melted into variable/value rows (default: all non-id)."
      },
      "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": {

… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/relaystation-pivot-915f2147/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)
