# Create and execute batch workflow Creates a batch workflow execution that discovers content across multiple dataspaces using the provided filters, then executes the specified workflow on each matching content item. The system automatically selects the first available agent for the user's account to execute the workflow tasks. The workflow execution reuses the existing single-content workflow logic. Returns immediately with a batch execution record while processing continues in the background. File Format Filters: The API supports both user-friendly file types and MIME types for filtering: - User-friendly: { "in": ["pdf", "docx", "xlsx"] } - MIME types: { "in": ["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] } Supported user-friendly file types: pdf, docx, xlsx, pptx, txt, doc, xls, ppt, json, xml, csv, html, css, js, jpg, jpeg, png, gif, bmp, svg, webp, tiff, mp4, avi, mov, wmv, flv, webm, mkv, mp3, wav, flac, aac, ogg, m4a, zip, rar, 7z, tar, gz, bz2. Endpoint: POST /batch-workflow-executions Version: 1.0.0 Security: bearerAuth ## Request fields (application/json): - `query` (object) Content search filters to find matching content items Example: {"categoryId":{"exists":false},"fileFormat":{"in":["pdf","docx"]},"metadata":{"author":{"exists":true},"status":{"in":["pending","draft"]}}} - `query.contentId` (any) Filter by content ID - `query.categoryId` (any) Filter by category ID Example: {"exists":false} - `query.fileName` (any) Filter by file name - `query.fileFormat` (any) Filter by file format/MIME type Example: {"in":["pdf","docx"]} - `query.createdAt` (any) Filter by creation date - `query.updatedAt` (any) Filter by last update date - `query.metadata` (object) Filter by metadata fields - key-value pairs where values can use advanced operators Example: {"author":{"exists":true},"status":{"in":["pending","draft"]}} - `workflowId` (string, required) UUID of the workflow to execute on matching content Example: "987fcdeb-51a2-43d1-9c4e-5f6e7d8c9a0b" - `workspaceId` (string, required) Workspace ID where the batch execution should run Example: "sws-abc12345" - `scheduledAt` (string) Optional scheduled execution time (ISO datetime string) - not implemented yet Example: "2025-01-20T15:30:00Z" - `dataspaceIds` (array, required) Array of dataspace IDs where the workflow should run Example: ["sds-abc12345","sds-def67890"] ## Response 201 fields (application/json): - `id` (string, required) UUID of the batch workflow execution Example: "123e4567-e89b-12d3-a456-426614174000" - `query` (object) Original query used to fetch the content Example: {"categoryId":{"exists":false},"fileFormat":{"in":["application/pdf"]}} - `query.contentId` (any) Filter by content ID - `query.categoryId` (any) Filter by category ID Example: {"exists":false} - `query.fileName` (any) Filter by file name - `query.fileFormat` (any) Filter by file format/MIME type Example: {"in":["application/pdf"]} - `query.createdAt` (any) Filter by creation date - `query.updatedAt` (any) Filter by last update date - `query.metadata` (object) Filter by metadata fields - key-value pairs where values can use advanced operators - `workflowId` (string, required) UUID of the workflow used Example: "987fcdeb-51a2-43d1-9c4e-5f6e7d8c9a0b" - `workspaceId` (string, required) Workspace ID where the batch execution ran Example: "sws-abc12345" - `dataspaceIds` (array, required) Array of dataspace IDs where the workflow ran Example: ["sds-abc12345","sds-def67890"] - `workflowExecutionIds` (array, required) Array of individual workflow execution IDs (one for each content based on the filters) Example: ["789e0123-e89b-12d3-a456-426614174002","abc1234d-e89b-12d3-a456-426614174003","def5678e-e89b-12d3-a456-426614174004"] - `status` (string, required) Status of the batch execution Enum: "started", "completed", "failed" - `errorMessage` (string,null, required) Error message if the batch execution failed Example: "Workflow validation failed: Invalid agent ID" - `createdAt` (string, required) When the batch execution was created Example: "2025-01-15T10:30:00Z" - `completedAt` (string,null) When the batch execution completed Example: "2025-01-15T10:45:00Z" ## Response 400 fields (application/json): - `error` (string, required) Example: "Bad Request" - `message` (string, required) Example: "Invalid request parameters" ## Response 401 fields (application/json): - `error` (string, required) Example: "Unauthorized" - `message` (string, required) Example: "Authentication required" ## Response 500 fields (application/json): - `error` (string, required) Example: "Internal Server Error" - `message` (string, required) Example: "An unexpected error occurred during batch execution"