PrompteryxBeta
    ⌘K
    PlatformSupport
    Menu
    IntroductionInstall Desktop & extensionQuick StartPlatform Overview
    OverviewWhat you can makeAI Browser Agent in the chatModels and AutoConnectorsSchedulesProjectsExplore and publishingShare linksMemory and SkillsPersonal agent (beta)Welcome, settings and skinsPlans, credits and top-upsPrompteryx DesktopGroups (pilot)Phone app (early access)
    OverviewCreating WorkflowsTesting & DebuggingScheduling
    OverviewGetting StartedCommandsRecordingSettingsStructured OutputParallel AgentsTips & Best Practices
    OverviewInstallationSidebar AgentUsing Attached FilesExecute on Current TabExporting to Visual Studio
    Overview
    OverviewOpen PageClickClick CoordinatesFillExtract TextScreenshotWaitPress KeyFocus ElementBlur ElementSelect TextHighlight ElementSet ViewportGet Bounding BoxScrollHoverSelect OptionAssertionsCookiesEvaluate JavaScriptExample Workflows
    OverviewPrompteryx Browser AgentOpenAI
    OverviewSchedule TriggerWebhook Trigger
    OverviewGoogle SheetsGoogle CalendarConnect Hub (3,000+ apps)Example Workflows
    AI Vision SettingsChrome Automation ProfilesCloud BrowserBrowser Profiles & Persistent ContextVideo RecordingExecution LogsSharing & CollaborationEdit History
    Selectors GuideVariables
    Start hereGet an API keyRun the AI browser agentDrive a cloud browserRun workflows from anywhereUse connected apps (Connect Hub)SDK (TypeScript)CLIMCP for AI assistants
    REST APIWebhooksMCP toolsCloud Browser APICloud Browser quickstartMigrate from Browserbasen8nZapierMake.com

    Need help? Contact Support

    1. Documentation
    2. Nodes
    3. Control Flow
    4. For Each

    For Each (Apply to Each)

    Control Flow

    Loop through arrays and execute actions for each item

    Overview

    The For Each node (shown as "Apply to Each" in the Node Library) iterates through an array and executes a set of actions for each item. Drag nodes inside the loop container to define what runs for each item. This is similar to Power Automate's "Apply to Each" action and is essential for batch processing and handling lists of data.

    Sequential Execution
    Items are processed one at a time, in order, and the steps inside the loop run one after another for each item. For parallel processing, use the Parallel Split node instead.
    The Apply to Each node's config panel: array input selector, current item variable, delay between items and max items
    The Apply to Each config panel — pick the array to loop over and name the per-item variable.
    Parameters
    Configuration options for this node
    inputArray
    Array
    Required

    "Select an output from previous steps": the array to iterate over — a variable name or a {{...}} reference.

    Example: records, {{webhook.body.items}}
    currentItem
    String

    Current Item Variable: the name of the variable that holds the current item. The 0-based position is available as the same name plus "Index" (e.g. {{itemIndex}}).

    Default: item
    delayBetweenItems
    Number

    Delay Between Items (ms): pause between iterations (never before the first) — useful for rate limits. Max 60000.

    Default: 0
    maxItems
    Number

    Max Items: process only the first N items (0 = no limit). Skipped items are logged.

    Default: 0
    continueOnItemError
    Boolean

    Continue On Item Error: if a step fails for one item, log the error and move on to the next item instead of stopping the run.

    Default: false

    How It Works

    1. Input: The node receives an array (e.g., a list of URLs, products, or records)
    2. Iteration: For each item in the array, the nodes inside the loop execute
    3. Variables: During each iteration:
      • {{item}} - The current item being processed (or whatever you named the Current Item Variable)
      • {{itemIndex}} - The index (0, 1, 2, ...)
    4. Completion: After all items are processed, execution continues to the next node

    Usage Examples

    Example 1: Process Multiple URLs
    Scrape data from a list of web pages

    Workflow structure:

    1. HTTP Request: Get list of product URLs from API
    2. For Each: {{urls}}
    3. ↳ Open Page: {{item}}
    4. ↳ Extract Text: Product name → productName
    5. ↳ Extract Text: Price → price
    6. ↳ Add to Google Sheet
    7. Send summary email
    Example 2: Send Personalized Emails
    Email each recipient from a list

    Workflow structure:

    1. Google Sheets: Read recipients list
    2. For Each: {{recipients}}
    3. ↳ Send Email:
    4. To: {{item.email}}
    5. Subject: Hello {{item.name}}
    6. Log completion
    Example 3: Fill Multiple Forms
    Submit form data for each record

    Workflow structure:

    1. Open Page: Form page
    2. For Each: {{formData}}
    3. ↳ Fill: Name field → {{item.name}}
    4. ↳ Fill: Email field → {{item.email}}
    5. ↳ Click: Submit button
    6. ↳ Wait: For success message
    7. ↳ Click: "Add Another" button

    Accessing Current Item Properties

    If your array contains objects, access their properties with dot notation:

    // Array: [{ name: "John", email: "john@example.com" }, ...] // Access in loop: {{item.name}} // "John" {{item.email}} // "john@example.com"

    For simple arrays (e.g., ["url1", "url2"]), just use {{item}}

    Best Practices

    Add Delays for Stability
    When iterating through browser actions or API calls, set Delay Between Items to pause between iterations and avoid rate limiting.
    Handle Errors Gracefully
    Turn on Continue On Item Error so one failed item doesn't stop the entire batch — the error is logged and the loop moves on to the next item.
    Test with Small Arrays First
    When developing, set Max Items to 2 or 3. Once working, set it back to 0 to run the full array. This speeds up development and debugging.
    Use Index for Progress Tracking
    Use the index variable to track progress: "Processing item {{itemIndex}}". Each iteration's status and output also appear on the loop node in Execution Results.

    Related Documentation

    If Condition Node

    Add logic inside loops

    Parallel Split

    Process items in parallel

    Google Sheets

    Read/write list data

    Variables Guide

    Work with array data