{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e67847ce-f519-45a3-bba6-380af6cdd648",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        96,
        64
      ],
      "parameters": {
        "url": "={{ $json.images[0] }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "generated_image"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e380ad74-2cc6-4d1e-ae30-d1fca03cb39e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -208
      ],
      "parameters": {
        "width": 976,
        "height": 252,
        "content": "## \u2728 How To Get Started\n\n1. Double-click the **APImage API** node to open it.  \n2. Replace `YOUR_API_KEY` with your actual API Key (keep the `\"Bearer\"` prefix).  \n3. Use the **Generate Image** node to submit a request.\n\n> \u2139\ufe0f You can find your API Key inside the Dashboard of your APImage account.\n\n\ud83d\udd17 [Open the Dashboard \ud83e\udc65](https://apimage.org/dashboard)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9ea17920-9c28-4d21-9f48-e64193fec34e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        256
      ],
      "parameters": {
        "width": 480,
        "height": 304,
        "content": "### \ud83d\udce4 Choose Your Destination\n\nYou can replace the **\"Upload to Google Drive\"** node with any other service where you'd like to upload the AI-generated image \u2014 such as **Dropbox**, **WordPress**, **Shopify**, or **Notion**.\n\nJust make sure to use the correct **file name**, as defined in the **\"Download Image\"** node (Put Output in Field).\n\n\n\n\n\n\n\n\n[How to set up Google Drive credentials \ud83e\udc65](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googledrive/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.googleDrive)"
      },
      "typeVersion": 1
    },
    {
      "id": "82a45985-c85e-404e-b202-6344d34c933c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        256
      ],
      "parameters": {
        "width": 480,
        "height": 304,
        "content": "### \ud83e\udde9 Choose Your Input\n\nYou can replace the **\"Generate Image\"** node with any other node that sends data to the **\"APImage API\"** node.  \nJust make sure the following parameters are set:\n\n- **`prompt`** \u2013 any text, up to **1000 characters**\n- **`dimensions`** \u2013 choose one of:  \n  `Square`, `Landscape`, `Portrait`\n- **`model`** \u2013 choose one of:  \n  `Basic`, `Premium` *(available for APImage Pro and business customers)*\n\n[View API Documentation \ud83e\udc65](https://apimage.org/docs)"
      },
      "typeVersion": 1
    },
    {
      "id": "b48797c6-7c96-4e9a-827b-d05c435dbe13",
      "name": "APImage API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -128,
        64
      ],
      "parameters": {
        "url": "https://apimage.org/api/ai-image-generate",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"prompt\": \"{{ $json['Describe the image you want'] }}\",\n  \"dimensions\": \"{{ $json['Dimensions'] }}\",\n  \"model\": \"{{ $json['AI Model'] }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3d77e24e-cf80-4ace-9a58-faa4dd3a4f09",
      "name": "Generate Image",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -352,
        64
      ],
      "parameters": {
        "options": {},
        "formTitle": "APImage AI Image Generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Describe the image you want",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Dimensions",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Square"
                  },
                  {
                    "option": "Landscape"
                  },
                  {
                    "option": "Portrait"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "AI Model",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Basic"
                  },
                  {
                    "option": "Premium"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "formDescription": "Generate images in seconds"
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a9c4e5a-b223-4c71-98b6-d88306cc974a",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        320,
        64
      ],
      "parameters": {
        "name": "generated_image",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "inputDataFieldName": "generated_image"
      },
      "typeVersion": 3
    },
    {
      "id": "358d7fe8-6e82-4e77-a7e4-788e94b79e40",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        640
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 352,
        "content": "### \ud83d\udc1e Debug Support\n\n**504 Gateway Timeout Error**  \nThis error typically occurs when n8n reaches its maximum wait time for a job to complete. To resolve it, increase the value of the **Timeout** setting (in milliseconds). For example, setting it to `180000` allows up to 3 minutes.\n\nThis issue is most common on the cloud-hosted version of n8n, where stricter limits apply. On self-hosted instances, the error rarely occurs, as you have full control over execution settings.\n\nBut no worries, even if this error occurs, APImage is still able to generate the image, you will find every image inside your APImage Dashboard \u2192 Usage Data \u2192 Image Generations\n\nIf you experience any issues regarding the APImage API itself, contact: \n\n\u2709 [ask@support@apimage.org](mailto:ask@support@apimage.org)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "APImage API": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "APImage API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}