Connect with the API

Connect n8n to GuardenerAI with the API.

n8n can send leads from any source it handles into GuardenerAI through the public API. GuardenerAI has no n8n node, so this is a connection you build yourself with the HTTP Request node: the workflow looks the person up by email, then an If node creates a new lead or updates the one it found.

Not a native integration. An n8n workflow sends lead details to your workspace’s API. Leads land in GuardenerAI. Nothing flows back to n8n on its own.

What you need

  • n8n, on n8n Cloud or self-hosted. Both work the same way here.
  • A GuardenerAI API key with the Member role and Read and write scope, created by an admin under Settings, API keys.
  • Your workspace address, https://YOUR-ORG.guardenerai.com.

Step by step

  1. Save the key as a credential

    In an HTTP Request node set Authentication to Generic Credential Type, then Header Auth. Create the credential with Name X-Api-Key and your key as the Value. Every GuardenerAI request in the workflow can reuse it.

  2. Start the workflow

    Use the trigger for the app where your leads arrive, or a Webhook node if another system can post to n8n.

  3. Look the person up by email

    Add an HTTP Request node, method GET, with the Header Auth credential. Lower-case the email in the expression, because the match is case-sensitive.

    URL
    https://YOUR-ORG.guardenerai.com/api/leads?filter=email:equals:{{ $json.email.toLowerCase() }}
  4. Branch with If

    Add an If node that checks whether totalElements equals 0. The true branch is a new lead. The false branch is a lead you already have, and content[0].id is its id.

  5. Create or update

    On the true branch add an HTTP Request node, method POST, to /api/leads, with Send Body on and JSON as the body. firstName, lastName and email are required. On the false branch send a PUT to /api/leads/{id} with every field you want to keep, because a PUT replaces the whole record. Then publish the workflow.

    JSON body for the create
    {
      "firstName": "{{ $('Webhook').item.json.first_name }}",
      "lastName": "{{ $('Webhook').item.json.last_name }}",
      "email": "{{ $('Webhook').item.json.email.toLowerCase() }}",
      "message": "{{ $('Webhook').item.json.message }}",
      "sourceMedium": "n8n",
      "sourceCampaign": "contact form"
    }
Before you rely on it

What to know about this connection.

With n8n

  • For bulk runs, use the HTTP Request node’s Batching option (Items per Batch and Batch Interval (ms)) to stay under the rate limit.
  • Turn on Retry On Fail in the node’s settings and set Wait Between Tries (ms) to 1000 or more, so a 429 is retried after the second the API asks for.
  • n8n cannot hear about changes in GuardenerAI. To pull data out, start a workflow with a Schedule Trigger and ask the API.
  • A Webhook node’s test URL only listens while you test. Live traffic goes to the production URL, which n8n registers when you publish the workflow.

With every API connection

  • The key must have the Member role and Read and write scope. A Read only key gets a 403 on every write.
  • There is no upsert. Search for the record by email first, then create it or update the one you found.
  • There are no outbound webhooks. Data flows into GuardenerAI; nothing tells the other tool when a record changes, so anything reading back has to ask on a schedule.
  • Each key allows 10 requests per second. Above that the API answers 429 with Retry-After: 1, so wait a second and retry.
  • An update with PUT replaces the whole record. Send every field you want to keep, not only the one that changed.
  • If one of your duplicate rules blocks it, a create answers 409 duplicate_blocked with the matching records. Update the match instead of forcing a second copy.

Checked against n8n’s own documentation: HTTP Request node, HTTP Request credentials, Handling rate limits, Webhook node, If node. Their plans and features change, so confirm the current details there.

Where it lands

The modules this feeds.

FAQ

Fair questions.

Is there a GuardenerAI node in n8n?
No. You connect n8n with the HTTP Request node and the public API. GuardenerAI does not publish an n8n node.
Does this work on self-hosted n8n?
Yes. The workflow only needs to reach your workspace address over HTTPS, so n8n Cloud and self-hosted n8n behave the same.
Can a workflow start when a GuardenerAI record changes?
Not directly. GuardenerAI sends no outbound webhooks, so a workflow that needs GuardenerAI data has to run on a Schedule Trigger and ask the API.