# Batch-run a waterfall (/docs/api/waterfalls/waterfall_batch_run)

Run a waterfall over up to 1,000 inputs (JSON rows or CSV) in the background through gr-rows, paced per vendor. Returns the batch (a list) to poll.

`POST /v1/waterfalls/batch-run`

```json
{
  "operationId": "waterfall_batch_run",
  "summary": "Batch-run a waterfall",
  "description": "Run a waterfall over up to 1,000 inputs (JSON rows or CSV) in the background through gr-rows, paced per vendor. Returns the batch (a list) to poll.",
  "tags": [
    "waterfalls"
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "waterfall_id": {
              "type": "string",
              "pattern": "^wf_[a-z0-9]{8,40}$"
            },
            "version": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "published",
                    "draft"
                  ]
                },
                {
                  "type": "string",
                  "pattern": "^\\d{1,4}\\.\\d{1,4}\\.\\d{1,4}$"
                }
              ],
              "default": "published"
            },
            "inputs": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": {}
              },
              "minItems": 1,
              "maxItems": 1000
            },
            "max_cost_micro_per_run": {
              "type": "integer",
              "minimum": 0
            },
            "webhook_url": {
              "type": "string",
              "format": "uri"
            },
            "fields": {
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 80,
                "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*$"
              },
              "maxItems": 50
            },
            "csv": {
              "type": "string",
              "maxLength": 1000000,
              "description": "CSV with a header row, instead of inputs"
            }
          },
          "required": [
            "waterfall_id"
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "enum": [
                  "waterfall_batch"
                ]
              },
              "id": {
                "type": "string",
                "pattern": "^wfb_[a-z0-9]{8,40}$"
              },
              "waterfall_id": {
                "type": "string"
              },
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "runs": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^wfr_[a-z0-9]{8,64}$"
                }
              },
              "status_url": {
                "type": "string"
              }
            },
            "required": [
              "object",
              "id",
              "waterfall_id",
              "total",
              "runs",
              "status_url"
            ]
          }
        }
      }
    },
    "default": {
      "description": "Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "invalid_request",
                      "unauthorized",
                      "insufficient_balance",
                      "max_cost_exceeded",
                      "scope_denied",
                      "budget_blocked",
                      "not_found",
                      "idempotency_mismatch",
                      "invalid_meta",
                      "rate_limited",
                      "upstream_error",
                      "response_buffer_limit",
                      "provider_capacity_unavailable",
                      "grid_saturated",
                      "upstream_timeout",
                      "conflict",
                      "internal_error",
                      "account_frozen",
                      "strict_filters",
                      "plan_limit_reached",
                      "validation_failed",
                      "deadline_exceeded",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "retry_after_ms": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "details": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
