OpenWA icon indicating copy to clipboard operation
OpenWA copied to clipboard

API key

Open sunnag7 opened this issue 6 months ago • 10 comments

From where do we obtain API key ?

sunnag7 avatar May 18 '26 18:05 sunnag7

The API Key is in /data/ directory, into .api-key archive file (dev-admin-key) wit default

jlge23 avatar May 18 '26 19:05 jlge23

But where is this /data/ is located, is it generated after deployment?

sunnag7 avatar May 18 '26 19:05 sunnag7

If you deployed OpenWA using docker, the data directory is located at /app/data/, being "/app/data/.api-key" the full path of the file containing the API key.

sudo docker exec -it <your_container_name> "/bin/cat" "/app/data/.api-key"; echo

Use this command to read the file directly from your host terminal, replace the container name with OpenWA API container name (openwa-api by default).

s0ck37 avatar May 18 '26 19:05 s0ck37

I am not using docker, i fetched repo and npm build

sunnag7 avatar May 18 '26 19:05 sunnag7

In that case, after you run npm run dev, the data directory should be created in the directory you fetched the repo, and you should be able to find the file containing the API key.

s0ck37 avatar May 18 '26 20:05 s0ck37

You can also look at the terminal output at start when running 'npm run dev'. the api-key is printed there.

nheymann avatar May 19 '26 08:05 nheymann

This is the API_KEY by default, test = dev-admin-key

jlge23 avatar May 19 '26 16:05 jlge23

Hi, I tried using the default API key 'dev-admin-key', but for each request I get: 'Error: Unauthorized'

Gaitan19 avatar May 19 '26 18:05 Gaitan19

How do you have the variable API_MASTER_KEY or API_KEY defined in your .env file? Are you using Docker?

jlge23 avatar May 19 '26 18:05 jlge23

The API key is stored in data/.api-key (default 'dev-admin-key' in dev) and is also printed in the startup logs. Closing as answered — see the thread above.

rmyndharis avatar Jun 13 '26 07:06 rmyndharis