Workflow and Executions into JSON?

Is there way to get from N8N (link is like) https://URL/workflow/4zSYexHxAVT9M8Nh/executions/19773 the workflow and executions inside of the workflows as JSON?
I need it inside of a workflow to save it when a job start.

Hello!

it’s absolutely possible to retrieve a workflow execution as JSON inside another n8n workflow.

If you’re on n8n Cloud or self-hosted with API access, you can use the HTTP Request node to fetch execution data from the API.

Endpoint example:
GET https://<your-n8n-domain>/rest/executions/19773

Setup in HTTP Request node:

  • Method: GET
  • Authentication: Add a header like:
    Authorization: Bearer <your-personal-api-key>

you’ll get a full JSON with: workflow ID, node data, execution start time, input/output, execution status

You can simply use the built in n8n Node for this

Then get the data as follow in a code block:

const execution = $('Get Execution').first().json;
const runData = execution.data.resultData.runData;
const workflowData = execution.workflowData

From here you can stringify the json if needed JSON.stringify()

NB: if you want to also get the execution data of a workflow, ensure to toggle this setting in the workflows properties:

2 Likes

Thank you both.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.