Zapier connection "API key not valid"
Hey there,
when trying to connect our self-hosted cal.com with zapier, I always get this error:
authentication failed: The app returned “API key not valid”. What happened (You are seeing this because you are an admin): Stack trace: ResponseError: {“status”:401,“headers”:{“content-type”:“application/json; charset=utf-8”,“retry-after”:null},“content”:“{\“message\“:\“API key not valid\“}”,“request”:{“url”:“https://XXXXX/api/integrations/zapier/listBookings?apiKey=cal_XXXX”}} at _throwForStatus (/var/task/node_modules/zapier-platform-core/src/http-middlewares/after/prepare-response.js:13:11) at outResp.throwForStatus (/var/task/node_modules/zapier-platform-core/src/http-middlewares/after/prepare-response.js:68:5) at throwForStatusMiddleware (/var/task/node_modules/zapier-platform-core/src/http-middlewares/after/throw-for-status.js:5:14) at Object.
I don't have a clue why. Is there anything which needs to be configured to get it up and running with the docker self-hosted variant? I followed these steps: https://github.com/calcom/cal.com/tree/main/packages/app-store/zapier
Also updated to the newest version (4.0.5) and tried it, getting the same error.
Thanks for your help!
Any update on this? Did you find a solution to this issue?
2025-06-06 EDIT:
Found the issue...
createHandler uses cal_ as fallback value if environment variable API_KEY_PREFIX is not set,
but the validation uses substring(0) instead of substring(4) for validation.
I wonder how there aren't more issues about this without any fix...
SOLUTION:
If you don't want to change the codebase, easiest workaround is to set the environment variable API_KEY_PREFIX to any value, even if it is just cal_.