Authentication
Every request carries an API key as a bearer token. A key belongs to one company and acts as the person who made it.
Make a key
A company admin signs in and opens Settings → API & webhooks, names the key (for example "Estimating front end") and presses Make a key. The key is shown once; InsulEngine keeps only a one-way hash of it, so a lost key cannot be shown again. Make a new one and revoke the old.
Send it
Put the key in the Authorization header of every request, over HTTPS to
https://insulengine.com:
curl https://insulengine.com/v1/jobs \
-H "Authorization: Bearer $INSULENGINE_API_KEY"
import os, requests
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['INSULENGINE_API_KEY']}"
jobs = session.get("https://insulengine.com/v1/jobs").json()["jobs"]
const headers = { Authorization: `Bearer ${process.env.INSULENGINE_API_KEY}` };
const { jobs } = await (await fetch("https://insulengine.com/v1/jobs", { headers })).json();
A request with no key, a mistyped key or a revoked key answers 401.
What a key can do
| Key made by | Read jobs, takeoffs, estimates, downloads | Create jobs |
|---|---|---|
| Admin | Yes | Yes |
| Estimator | Yes | Yes |
| Viewer | Yes | No (403) |
- One company. A key reads and writes only the company it was made in, even if the person who made it belongs to others.
- The API only. A key works with the
/v1API and nothing else: not the app's own pages, its team or invitations, or anyone's sign-in. Anywhere else it answers403. - Not the settings. Keys and webhooks are managed on the Settings page, never with a key, so a leaked key cannot make more keys or send your data somewhere new.
Revoke a key
Settings → API & webhooks → Revoke stops a key at once. A key also stops working when the person who made it leaves the company, so make keys for systems from an account that will stay.
Keep it safe
- Keep keys on your server, in an environment variable or a secrets manager. Never put one in a browser, a mobile app or a code repository. If your front end runs in the browser, have it call your own server, and have your server call InsulEngine.
- Use one key per system, so you can revoke one without stopping the others. The settings page shows when each key was last used.