{
  "name": "Abni starter: make an on-brand image",
  "nodes": [
    {
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        300
      ],
      "parameters": {}
    },
    {
      "id": "a1b2c3d4-0002-4000-8000-000000000002",
      "name": "List folders",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "",
          "name": "Abni API key"
        }
      },
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "url": "https://api.abni.ai/v1/folders"
      }
    },
    {
      "id": "a1b2c3d4-0003-4000-8000-000000000003",
      "name": "Make an image",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "",
          "name": "Abni API key"
        }
      },
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "method": "POST",
        "url": "https://api.abni.ai/v1/images",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"level1\": \"{{ $json.level1Folders[0].slug }}\",\n  \"prompt\": \"A bright hero image for our autumn newsletter\",\n  \"aspectRatio\": \"16:9\",\n  \"resolution\": \"2K\"\n}"
      }
    },
    {
      "id": "a1b2c3d4-0004-4000-8000-000000000004",
      "name": "Wait 10 seconds",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        660,
        300
      ],
      "webhookId": "a1b2c3d4-0004-4000-8000-0000000000aa",
      "parameters": {
        "amount": 10,
        "unit": "seconds"
      }
    },
    {
      "id": "a1b2c3d4-0005-4000-8000-000000000005",
      "name": "Check status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "",
          "name": "Abni API key"
        }
      },
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "url": "=https://api.abni.ai/v1/images/{{ $('Make an image').item.json.id }}",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "level1",
              "value": "={{ $('List folders').item.json.level1Folders[0].slug }}"
            }
          ]
        }
      }
    },
    {
      "id": "a1b2c3d4-0006-4000-8000-000000000006",
      "name": "Still being made?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1100,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "a1b2c3d4-0006-4000-8000-0000000000bb",
              "leftValue": "={{ $json.status }}",
              "rightValue": "processing",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "a1b2c3d4-0007-4000-8000-000000000007",
      "name": "Collect",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1320,
        400
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1b2c3d4-0007-4000-8000-0000000000c1",
              "name": "status",
              "value": "={{ $json.status }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0007-4000-8000-0000000000c2",
              "name": "imageUrl",
              "value": "={{ $json.imageUrl }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0007-4000-8000-0000000000c3",
              "name": "imageId",
              "value": "={{ $json.id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "a1b2c3d4-0008-4000-8000-000000000008",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        20
      ],
      "parameters": {
        "width": 520,
        "height": 220,
        "content": "## Abni starter\n1. In Abni, open **Settings › API & automation** and create a key.\n2. In n8n, create a **Header Auth** credential named **Abni API key**: Name `x-api-key`, Value your key. Pick it on the three Abni nodes.\n3. Change the prompt in **Make an image**, then click **Test workflow**. Image links last an hour, so download or use them straight away."
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "List folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List folders": {
      "main": [
        [
          {
            "node": "Make an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Make an image": {
      "main": [
        [
          {
            "node": "Wait 10 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 10 seconds": {
      "main": [
        [
          {
            "node": "Check status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check status": {
      "main": [
        [
          {
            "node": "Still being made?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Still being made?": {
      "main": [
        [
          {
            "node": "Wait 10 seconds",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Collect",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}
