> ## Documentation Index
> Fetch the complete documentation index at: https://www.agent37.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Host n8n

> Run n8n, the open-source workflow automation tool, on its own always-on instance, with a public URL for the editor and webhooks and the managed model ready for its AI nodes.

The `agent37-n8n` [template](/docs/agents-api/templates) runs n8n, the open-source workflow automation tool, on an Agent37 instance: an always-on computer serving n8n's visual editor, webhooks, hundreds of app integrations, and AI nodes, from the official n8n image. It is a web app, not an agent harness: there is no chat API on this instance, and `https://{instanceId}.agent37.app/v1/responses` does not exist on it. Every create mints a public URL for the editor, `https://n8n-{instanceId}.agent37.app`, and n8n's own owner account, fixed at create, guards it.

```text title="Paste this into your coding agent" wrap theme={null}
Read https://www.agent37.com/docs/llms-full.txt.
I want n8n, the workflow automation tool, on its own always-on instance.
Create it with POST /v1/instances using the agent37-n8n template, passing the n8n owner password I choose as N8N_OWNER_PASSWORD in the instance's env (ask me for it).
Done when I can sign in at the public URL in the response's public_ports (https://n8n-{instanceId}.agent37.app) with my account email and that password.
My key is in AGENT37_API_KEY.
```

## Create the instance

One call to the hosting API at `https://api.agent37.com`, with the n8n owner password you choose as [instance env](/docs/agents-api/instances#environment-variables):

```bash curl theme={null}
curl -X POST https://api.agent37.com/v1/instances \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "template": "agent37-n8n", "env": { "N8N_OWNER_PASSWORD": "choose-a-password" } }'
```

`N8N_OWNER_PASSWORD` (8 characters or more) is required: without it the create returns `400 invalid_request`. The owner's email defaults to your workspace owner's address (or, from the dashboard, the account that clicked create); pass `N8N_OWNER_EMAIL` to use another. The API never returns the password.

The `201` response carries the instance id and, in `public_ports`, the editor's public URL. The template mints a [public port](/docs/agents-api/public-ports) on `5678` with the fixed prefix `n8n` on every create, so `public_ports[0].url` is `https://n8n-{instanceId}.agent37.app`. Trimmed to the fields that matter here:

```json theme={null}
{
  "id": "ab12cd34ef",
  "status": "running",
  "template": "agent37-n8n",
  "public_ports": [
    { "port": 5678, "prefix": "n8n", "url": "https://n8n-ab12cd34ef.agent37.app" }
  ]
}
```

Open that URL in a browser and sign in with the owner email and password. There is no sign-up page: the owner account is created on the first boot, so nobody who finds the URL before you can claim the instance. From then on it is an ordinary n8n owner account: change the password or email in n8n's settings, and invite teammates from inside n8n. The URL needs no Agent37 credential, because n8n's own login guards it.

To pick your own hostname, declare a `public_ports` entry for port `5678` yourself (say a different `prefix`): the template uses yours and adds no default. Other declared ports are kept alongside the default. Unlike the other system templates there is no gateway on `3737` and no terminal or file browser port; [SSH](/docs/agents-api/ssh) still works, log in as `node`. The template offers the same three [shapes](/docs/agents-api/instances#shapes-and-pricing) as every other; 2 vCPU / 4 GB is fine for a single-user n8n. Pin a release with `agent37-n8n@<tag>`, like any [system template](/docs/agents-api/templates#pin-a-template-version).

## Webhooks and OAuth

The public URL is permanent and unauthenticated, which is what webhooks and OAuth callbacks need: an external service POSTs to `https://n8n-{instanceId}.agent37.app/webhook/...` with no credential, and an OAuth provider redirects back to the same host. n8n's webhook paths are unguessable per node, so the URL supplies reachability, not trust. The OAuth redirect URLs n8n shows when you create a credential already use the public URL; copy them into the provider as shown.

## AI nodes on the managed model

On every boot the image seeds an n8n credential named **Agent37 managed model**, of type OpenAI, pointed at the managed LLM endpoint with the instance's managed token. In the editor, pick it on the **OpenAI Chat Model** node (or any OpenAI-compatible node); the model list comes from the managed endpoint, `default` plus the other managed models. Usage bills to the workspace wallet under the instance's [budget](/docs/agents-api/budgets), exactly like managed usage on any other template; see [Managed services](/docs/agents-api/managed-services). Add your own OpenAI, Anthropic, or OpenRouter credentials in n8n as usual when you want a specific provider.

## What persists

Everything n8n stores (workflows, credentials, execution history, its encryption key) lives in its SQLite database on the instance's persistent disk. It survives stop, start, restart, resize, and [image updates](/docs/agents-api/instances#update). No external database is needed.

## Auto-sleep and schedules

`auto_sleep` is off by default. With it on, n8n's Schedule triggers do not fire while the instance sleeps; an incoming webhook does wake it, after a cold-start delay. Leave [auto-sleep](/docs/agents-api/instances#auto-sleep) off for scheduled workflows.

## Settings

Pass any `N8N_*` variable n8n documents as [instance env](/docs/agents-api/instances#environment-variables). The image sets `N8N_EDITOR_BASE_URL` and `N8N_WEBHOOK_URL` from the public port automatically, so those need no setting.

## Troubleshooting

| Symptom                                                              | Fix                                                                                                                                                                                                     |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The public URL shows a sign-up page                                  | The owner account was not created on the first boot. Do not sign up: [contact support](mailto:support@agent37.com).                                                                                     |
| Create returns `400 invalid_request` mentioning `N8N_OWNER_PASSWORD` | Pass the owner password (8 characters or more) in the instance `env`; it is required on this template.                                                                                                  |
| A Schedule trigger did not fire                                      | The instance was asleep. Schedules do not run while an instance sleeps; set `auto_sleep: false` with `PATCH /v1/instances/{id}`.                                                                        |
| An AI node lists no models, or a run on the managed credential fails | The instance budget is exhausted or the wallet is empty, so the managed endpoint refuses the call with `402`. See [when a managed call is refused](/docs/agents-api/budgets#when-a-managed-call-is-refused). |
| A webhook URL returns `404`                                          | The workflow is not active, or you used the test URL instead of the production URL. Activate the workflow and copy the production URL from the Webhook node.                                            |
