Workflow run API locally

Hello,
i’m trying to call run workflow using restAPI

POST /rest/workflows/${workflowId}/run
and send the headers
{
‘Content-Type’: ‘application/json’,
Accept: ‘application/json’,
‘X-N8N-API-KEY’: ‘My_API_key’
}

but i’m getting 401 unauthorized request even i’m setting the docker env for n8n as below

n8n:
image: n8nio/n8n
container_name: n8n
ports:
- “5678:5678”
environment:
- GENERIC_TIMEZONE=Europe/Berlin
- N8N_HOST=n8n
- N8N_PORT=5678
- NODE_ENV=production
- N8N_BASIC_AUTH_ACTIVE=false
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=admin
- N8N_API_REST_AUTH_DISABLED=false
volumes:
- ./n8n_data:/home/node/.n8n:rw
networks:
- app-network

and the API key is valid as i tried to call createFlow , list flows and activate API and it works file

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • docker version
  • didn’t set db so i think it’s default
  • default
  • running using Docker
  • windows

Welcome to the community @MuhammadGouda !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


Where did you get the idea of n8n API with the usage you demostrated in the post? Here’s what is supported by n8n REST API, API reference | n8n Docs. Note also the endpoints start with /api/v1/.

thanks for your reply @ihortom

actually i need to build an API to run workflow manually by giving it the workflow Id to be able to run the workflow using postman call

i did not find it in docs but i was searching over the web

how to handle such case, please ?

Hey @MuhammadGouda , I don’t think the API supports running a workflow manually. You can only activate a workflow to run either on schedule or by the trigger.

Therefore, the only solution I can think of is to use Webhook as the trigger to your “manual” workflow. Then you can run your workflow by sending HTTP Request (by Postman) to the webhook URL.

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