Endpoint tiers
The API uses a two-tier model based on HTTP method:| Tier | Methods | Auth required |
|---|---|---|
| Public | GET | No — call directly |
| Write | POST | Yes — X-API-Key header required |
Passing the API key
Include the key in theX-API-Key request header.
Content-Type:
Error responses
A missing or incorrect key on a write endpoint returns HTTP401:
If no
API_KEY is set in /etc/poplock-api.conf, write endpoints are disabled entirely. The server logs a warning at startup: [WARN] No API_KEY set — write endpoints are disabled until one is configured.Security considerations
- Store the API key in
/etc/poplock-api.confwithchmod 600permissions. See Installation for setup steps. - Never share the API key in Discord messages or public channels. The intended deployment pattern is to store the key inside n8n, which acts as a relay — Discord users hit n8n webhooks, n8n validates their roles, and n8n proxies authorized requests to the PopLock API.
- The API sets
Access-Control-Allow-Origin: *on all responses. To limit access to trusted hosts, restrict inbound traffic to port6767at the firewall level rather than relying on CORS alone.