Tutorial: Listing running workflow exections with API

How to list running executions from inside a workflow (Self-Hosted n8n)

I’ve seen a bunch of threads asking how to see currently running executions on self-hosted n8n. This is not possible via the official n8n API, but I made it work with the internal REST endpoints.

It’s just three nodes: Login → Grab cookie → Get executions.

Example URLs below use http://localhost:5678. It should work directly with this url. But you can swap it with your base URL.


1) HTTP Request — Login

This hits the n8n login endpoint and gives us a session cookie.

  • Method: POST

  • URL: http://localhost:5678/rest/login

  • Authentication: None

  • Send body as JSON:

    {
      "emailOrLdapLoginId": "your@email.or.ldapId",
      "password": "your-password"
    }
    
    
  • Options → Response:

    • Response Format: JSON

    • Full Response: :white_check_mark: (important — we need headers)

This returns a Set-Cookie header containing the JWT session (commonly the n8n-auth cookie).


2) Code — Grab cookie

Extract the session cookie from the Login node’s headers so we can reuse it.

// Name this node "Grab Cookie". Assumes the Login node is named "Login".
const headers = $node["Login"].json.headers || {};
const raw = headers['set-cookie'] || headers['Set-Cookie'] || [];
const list = Array.isArray(raw) ? raw : [raw];

// Keep only the "name=value" part; find the n8n auth cookie.
const cookie = list
  .map(s => String(s).split(';')[0].trim())
  .find(s => s.startsWith('n8n-auth='));

if (!cookie) {
  throw new Error('Auth cookie not found in /rest/login response');
}

return [{ json: { cookie } }];

Tip: If your Login node is named differently, update $node["Login"] accordingly.


3) HTTP Request — Get executions

Now call the internal executions endpoint using the cookie.

  • Method: GET

  • URL: http://localhost:5678/rest/executions

  • Authentication: None

  • Headers:

    • Cookie: {{$json.cookie}} (from the “Grab Cookie” node)
  • Options → Response:

    • Response Format: JSON

    • Split Into Items: :white_check_mark: (nice quality-of-life: one item per execution)

This endpoint returns finished and running executions (the same live data the Editor shows). The public /api/v1/executions doesn’t expose the “running” list in the same way, which is why this internal endpoint is handy.


(Optional) Show only “running”

Right after step 3, add either:

IF node

  • Condition: {{$json.status}} equals running

or

Code node

// When "Split Into Items" is ON in step 3, each item is one execution.
if ($json.status === 'running') {
  return [{ json: $json }];
}
return [];


What you get

Each item is an execution object (e.g., id, workflowId, status, timestamps, etc.). Use it to:

  • Build a tiny Webhook that returns only currently running executions

  • Alert when your workflow is already running

  • Create your own dashboard inside n8n


Notes

  • These /rest/* endpoints are internal to the Editor app and may change between versions. Keep the three-node block isolated so it’s easy to update later.

  • If you’re not on localhost, make sure your reverse proxy forwards cookies correctly (no stripping/rewriting).

That’s it—three nodes and you’ve got a reliable list of running executions directly from your self-hosted n8n. If you want, I can share a minimal importable workflow that wires these exact nodes together.

2 « J'aime »