Getting started with the API
This guide creates a key and uses it to call the API for the first time.
Before you start
- A Hive Engine user with the Admin role.
- The Business plan (or an enterprise licence). In a fiduciary Mandant, the lead must first switch on API access for this Mandant.
- A terminal with
curl. - About 5 minutes.
Step 1: Create a key
Open Settings → API access, click Create key, give it a name and choose the role. The exact steps are in the API access tutorial. Copy the key right away: it is shown only once.
A key always starts with hek_.
Step 2: First request
Replace <your-instance> with the address of your Hive Engine instance and hek_… with your key:
curl https://<your-instance>/api/v1/me \ -H "Authorization: Bearer hek_…"The response tells you who you are for the API and what your key may do:
{ "tenant_id": "f4a8c2d6b1e9", "tenant_name": "Example Ltd", "key_name": "ERP connection", "key_prefix": "hek_a1b2c3d4", "role_name": "Full Access", "access_level": null, "modules": [ { "module": "crm", "read": true, "write": true } ]}role_nameis set for keys of a company,access_levelfor keys of a Mandant (nullotherwise).moduleslists for each module whether your key may read and write.
Step 3: Fetch data
curl "https://<your-instance>/api/v1/crm/companies?limit=10" \ -H "Authorization: Bearer hek_…"To see every endpoint, open the interactive reference at https://<your-instance>/api/v1/docs (you need to be logged in to Hive Engine), click Authorize and paste your key. The CRM endpoints are also explained with examples in the CRM reference. Formats, paging and error codes are explained on the Conventions page.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 with invalid_api_key | Key copied wrongly, revoked or expired | Check the header Authorization: Bearer hek_…, create a new key if needed |
403 with api_access_not_in_plan | The plan does not include API access | Switch to Business |
403 with api_access_disabled | The Mandant switched API access off | The Mandant’s lead switches on API access for this Mandant |
403 with module_not_enabled | The endpoint’s module is not active or hidden for the role | Enable the module or choose another role |
429 with rate_limited | More than 120 requests per minute | Retry after Retry-After seconds |