AI Product Creative Image Generator using Defapi - n8n Workflow

Generate stunning AI product creative images automatically using this powerful n8n workflow. Integrate Defapi and the Nano-Banana model for rapid visual content creation. Download this n8n template now.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

This n8n template is ideal for:

E-commerce Marketers: Quickly needing high-quality product advertisements.
Content Creators: Automating the generation of visual assets using AI.
Product Designers: Testing different creative scenes without manual graphic design.
Automation Specialists: Looking for a complex polling mechanism example within an n8n workflow.

Overview

Generating marketing-ready product creatives often involves complex design work. This robust n8n workflow solves this by leveraging the Defapi API and the powerful Google Nano-Banana model to transform a simple product image and text prompt into a sophisticated creative scene.

The system utilizes an interactive form submission (the initial n8n trigger) and manages the entire asynchronous AI generation process, including real-time status polling and final retrieval of the image. This complete automation package makes it easy to deploy advanced image generation capabilities directly through your self-hosted or cloud n8n instance, proving the flexibility of a modern n8n setup.

How it Works

This automation operates through a seamless, multi-step process, starting with a user submission via an n8n trigger.


  1. Trigger Activation: The n8n workflow begins when a user submits the required fields (prompt, image URL, and Defapi API key) through the dedicated Submit Image for Creative Generation form trigger.

  2. Initial API Request: The data is sent to the Send Image Generation Request to Defapi.org API n8n node, initiating the image generation task using the google/nano-banana model.

  3. Waiting Period: The workflow pauses for 10 seconds using the Wait for Image Processing Completion n8n node to allow the external API service to begin processing.

  4. Status Polling: The Obtain the generated status n8n node sends a query to the Defapi API using the task ID received in Step 2 to check the job status.

  5. Conditional Check (If n8n node): The Check if Image Generation is Complete n8n node evaluates the response. If the status is 'success' (True), the flow proceeds to output the results. If not (False), the workflow loops back to the Wait n8n node, initiating the polling cycle again until the image is ready.

  6. Result Formatting: Upon success, the Format and Display Image Results n8n node extracts the final creative image URL.

  7. Account Management: Finally, the workflow uses the Get Your Balance n8n node to fetch the user's remaining credits, which is then displayed via the Show Balance n8n node, completing the full n8n workflow execution.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import the JSON: Copy the provided JSON code and import it directly into your n8n instance.

  2. Obtain Defapi Key: Register at Defapi.org to secure your API key. This key will be supplied by the user during the form submission and is crucial for the HTTP Request n8n node authorizations.

  3. Configure Form Trigger: Ensure the Submit Image for Creative Generation n8n trigger is active. Note the generated form URL; this is how users interact with the automation.

  4. Review HTTP Request Nodes: No hard-coded credentials are required in the n8n nodes, as the API key is passed dynamically from the form submission into the Authorization headers of the Send Image Generation Request to Defapi.org API and subsequent n8n nodes.

  5. Activate and Test: Activate the n8n workflow and submit a test request via the form URL to confirm the end-to-end image generation and polling process works correctly.

Node Details

This n8n workflow relies on several key n8n nodes for input, processing, and output:

Submit Image for Creative Generation (Form Trigger): This critical n8n trigger initiates the entire process. It collects the necessary inputs: prompt, imgurl, and the required apikey for authentication.
Send Image Generation Request to Defapi.org API (HTTP Request): Sends a POST request to Defapi, using the dynamic API key from the n8n trigger header. It specifies the google/nano-banana model and includes the prompt and product image URL in the JSON body.
Wait for Image Processing Completion (Wait): A temporary pause (10 seconds) implemented to prevent immediate, redundant polling before the AI task has started, optimizing the n8n workflow loop.
Obtain the generated status (HTTP Request): This n8n node performs the polling action, querying the status endpoint using the task_id derived from the previous step's output.
Check if Image Generation is Complete (If): This conditional n8n node checks if the status field in the API response equals 'success'. This determines whether the n8n workflow should retrieve the results or continue waiting.
Format and Display Image Results (Set): Extracts the final generated image URL from the API response array and formats it for output.


  • Get Your Balance (HTTP Request) & Show Balance (Set): These final n8n nodes demonstrate the ability to perform follow-up actions, fetching and displaying the remaining Defapi credit.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
panyanyany
panyanyany

Featured*