Skip to content

API keys

An API key lets another system (an ERP, a reporting tool, your own application) call Defthand’s Inspections API. A key is not a person: it has only the permissions you choose and reaches only your company’s data. It has no access at all to the customer portal and user management endpoints.

  • The Integrations module must be on in your company. Otherwise API keys does not appear in the menu or in Settings (Module store).
  • You need the permission to manage API keys (the Admin role has it). Without it, it says “Managing API keys needs the “Manage API Keys” permission.”

Where: Administration → Configuration → API keys, Settings → API keys, or API keys in the profile menu.

Column Meaning
Name The name you gave the key.
Prefix The first few characters of the key; lets you recognize which key is in use. The full key is never shown again.
Permissions How many permissions it has (“3 permissions”).
Expires End of validity.
Last used When it was last used; Never if it has never been used.
Status Active, Expired or Revoked.

If there are no keys yet, it says “No API keys yet.”

  1. Press New key. The New API key window opens: “The key is shown only once. The server keeps only its hash.”
  2. Enter a Name, e.g. “ERP integration”. It cannot be left empty.
  3. Choose Valid for: 30 days, 90 days (default), 180 days, 365 days or 730 days.
  4. Under Permissions, choose what the key may do (table below). At least one permission must be chosen.
  5. Press Create.

The Your key is ready window opens:

  • “Copy this key now and keep it somewhere safe. It is not shown again.”
  • Take it with Copy (“Key copied”), then press I copied it, close.
  • “Send it in requests with this header: Authorization: ApiKey <key>”
Group Permission
Inspections View inspections, View all inspections
Findings View findings
Corrective actions View corrective actions, Manage corrective actions (due date, owner), Verify or send back corrective actions
Reports Download reports
Analytics and visitor feedback View analytics and visitor votes
Locations View locations

Things to watch:

  • A key is not a member of any team or location. To read the whole company’s inspections, also choose View all inspections.
  • You can give only permissions you have yourself.
  • View locations reads all locations on a key; so to give it you must have the permission to manage locations.
  • The list contains only the permissions of modules that are on in your company.
  1. In the list, press Revoke on the key’s row.
  2. The “Revoke the key: ERP integration” window says “Every later request with this key is refused. A revocation cannot be undone; create a new key if you need one.” Press Revoke.

It says “Key revoked” and the status becomes Revoked.

Keys cannot be extended. Before one expires:

  1. Create a new key with the same permissions.
  2. Enter the new key in your integration and check that it works (Last used is updated).
  3. Close the old key with Revoke.
  • Create a separate key for each system; if one leaks, you revoke only that one.
  • Give a key only the permissions it really needs. Do not give the permission to manage corrective actions to a system that only reads reports.
  • Do not put a key in a code repository, an e-mail or a chat.
  • Look into any key whose Last used date is unexpected; revoke the ones not in use.

The quality team wants to pull inspection results into its own reporting tool every night:

  1. New key → Name: “Nightly report”, Valid for: 365 days.
  2. Permissions: View inspections, View all inspections, View findings, Download reports.
  3. Create → Copy → paste the key into the reporting tool’s secret setting → I copied it, close.

For the API’s endpoints, request formats and error codes: Developers.