Workflow Executions API CLI

Hello.

Is there a way or an API to get the Workflow Executions from the Executions menu so that for example with a curl to see a json? structure with the fields Started Time / Name / Status / Mode / Running Time everytime we call it?

Or something via cli instead of seeing it only via browser?

Thank you.

Hey @Mulen,

There isn’t any official API documentation but I have just taken a look at the page using the browser dev tools and it looks like you can use…

curl https://n8n.host.tld/rest/executions -u username:password

And that will return something like…

{"data":{"count":8,"results":[{"id":"6392","finished":false,"mode":"trigger","waitTill":null,"startedAt":"2021-10-20T18:30:55.061Z","stoppedAt":"2021-10-20T18:31:00.184Z","workflowId":"29","workflowName":"Twitter to Discord"}, ... I REMOVED THE OTHERS],"estimated":false}}

You can replace the -u option with the Basic authorization header as well, Looking at the way the page loads you can also pass in a filter object and a limit so if you wanted the last 30 successful runs you can do…

curl 'https://n8n.host.tld/rest/executions?filter=%7B%22finished%22:true%7D&limit=30' -u username:password

Hopefully this helps.

2 Likes

Thank you.

I will check it, that’s what i needed.

2 Likes

Hi @Mulen, you might also want to leave a vote on the corresponding feature request for such an API to help our team plan their development efforts: Official n8n API. It would be great if you could share your use case in there as well.

Thanks so much and have a nice day!

1 Like