When Flowise returns 401, check the token shape first: if it starts with eyJhbGc it is a login JWT, not an API key, and will never authenticate. Generate a real key under Settings, API Keys, and copy it into env. Restart the server after any env change, since the new value is not loaded hot. Put your real key in env, never in the example env file that ships with the repo.

Context: Flowise agentflow examples README documents the 401 causes that waste debugging time. The most common is using the wrong token type: user JWT tokens that start with eyJhbGc are not API keys, and calls with them fail. A second cause is editing env and forgetting to restart, the dev server does not pick up new values until restarted. The fix for an invalid key is regenerating it in Flowise under Settings, API Keys.