$API_TOKEN=<YOUR_API_TOKEN>
$cat > input.json << 'EOF'
<{
< "data": [
< {
< "orderId": 1001,
< "region": "North",
< "product": "Widget",
< "amount": "$1,200.00",
< "orderedAt": "2026-07-03"
< },
< {
< "orderId": 1002,
< "region": "North",
< "product": "Gadget",
< "amount": 350,
< "orderedAt": "2026-07-18"
< },
< {
< "orderId": 1003,
< "region": "South",
< "product": "Widget",
< "amount": "890.50",
< "orderedAt": "2026-07-22"
< },
< {
< "orderId": 1004,
< "region": "south",
< "product": "Gizmo",
< "amount": 120,
< "orderedAt": "2026-08-02"
< },
< {
< "orderId": 1005,
< "region": "East",
< "product": "Widget",
< "amount": 2400,
< "orderedAt": "2026-08-05"
< },
< {
< "orderId": 1006,
< "region": "East",
< "product": "Gadget",
< "amount": "n/a",
< "orderedAt": "2026-08-09"
< },
< {
< "orderId": 1007,
< "region": "North",
< "product": "Gizmo",
< "amount": 75,
< "orderedAt": "2026-08-11"
< },
< {
< "orderId": 1008,
< "region": "",
< "product": "Widget",
< "amount": 410,
< "orderedAt": "2026-08-14"
< }
< ],
< "groupByFields": [
< "region"
< ],
< "aggregations": [
< {
< "function": "count",
< "alias": "orders"
< },
< {
< "field": "amount",
< "function": "sum",
< "alias": "total_amount"
< },
< {
< "field": "amount",
< "function": "avg",
< "alias": "avg_amount"
< }
< ],
< "exportFormats": [
< "csv",
< "xlsx"
< ]
<}
<EOF
$curl "https://api.apify.com/v2/actors/nerolabs~dataset-aggregate-pivot/runs?token=$API_TOKEN" \
< -X POST \
< -d @input.json \
< -H 'Content-Type: application/json'