{"uid":"cap_11IDE3z7NoEoY3r-4cSZr","slug":"relaystation-pivot-915f2147","name":"RelayStation Pivot","description":"$0.0002/MB. Reshape tables long↔wide — pivot and unpivot without a spreadsheet. 1¢ x402 min; remainder auto-credits — relaystation.ai/penny","url":"https://api.relaystation.ai/v1/data/pivot","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","properties":{"id":{"type":"array","items":{"type":"string"},"minItems":1,"description":"unpivot: the id columns kept on every output row."},"to":{"enum":["csv","tsv","json","ndjson"],"type":"string","description":"A tabular file format: csv, tsv, json (array of objects), or ndjson."},"agg":{"enum":["count","sum","avg","min","max"],"type":"string","description":"pivot: cell aggregate (default count behavior per route)."},"file":{"type":"object","description":"cputools input-source: { inline: <base64 ≤ 4 MiB> } or { inputKey: <scratch key from /v1/cputools/upload-url, ≤ 50 MB> }."},"from":{"enum":["csv","tsv","json","ndjson"],"type":"string","description":"A tabular file format: csv, tsv, json (array of objects), or ndjson."},"mode":{"enum":["pivot","unpivot"],"type":"string"},"index":{"type":"array","items":{"type":"string"},"minItems":1,"description":"pivot: the row-key columns."},"value":{"type":"array","items":{"type":"string"},"minItems":1,"description":"unpivot: the columns melted into variable/value rows (default: all non-id)."},"values":{"type":"string","description":"pivot: the column aggregated into the cells."},"columns":{"type":"string","description":"pivot: the column whose values become output columns."}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST","PUT","PATCH"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_wlAGpHtRmb2freCgfzTOs","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Reshapes tabular data between long and wide formats — pivot or unpivot a table without a spreadsheet.","exampleAgentPrompt":"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?","exampleUseCases":[{"title":"Survey results reshaping","prompt":"I have survey data in long format — one row per respondent per question — and I need to pivot it wide so each respondent is a single row with one column per question. Can you do that?"},{"title":"Sales data crosstab for reporting","prompt":"Turn this sales table into a crosstab — rows should be product names and columns should be months, with revenue as the values. It's currently stacked one row per product per month."},{"title":"Flatten time-series measurements","prompt":"I have sensor readings where each timestamp is its own row with a metric name and a value column. Pivot it so each sensor gets one row and each metric becomes its own column."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T06:43:47.070Z","isFirstParty":false}