Using your API Key
Your API key identifies your PiQ SaaS subscription. Find it under Account › Licenses on parametriq.co.uk: your PiQ SaaS licence shows its API Key, with a button to copy it.
Sending it
Put the key in the X-API-KEY header of every request:
X-API-KEY: XXXX-XXXX-XXXX-XXXXX
- A request without the header is refused with 400 Bad Request.
- A request with a key that isn't an active PiQ SaaS licence is refused with 401 Unauthorized. A subscription that is paused, cancelled or unpaid stops its key working until it is active again.
Keeping it safe
Treat the key like a password: anyone who has it can use your subscription. Keep it out of source code and web pages that others can see (read it from a setting or an environment variable instead), and call the API from your own server rather than from a browser, so the key isn't sent to your users.