API Key or the token that we must add to the header.
In the following, we will present both methods.
⚠️ Important — Verify the HMAC before any authentication Before performing any authentication or token exchange, your application must verify the HMAC signature sent by Genuka in the installation callback. This step ensures the request truly comes from Genuka and prevents malicious third-party access. 👉 Learn how to verify the HMAC →
Using API Key authentication
Genuka uses API keys to authenticate requests.However, API Key authentication is reserved exclusively for Genuka clients who wish to connect their stores or perform actions directly from their own company account. ⚠️ Developers building external applications should not use this method — their integrations are authenticated via Access Tokens instead (see the next section).
How it works
- You can find these in your Genuka Dashboard → Settings → API Keys.
- Generate a new key and copy it.
Example request
Authentication with Access Token
Besides API keys, you can authenticate requests using an Access Token.This method is used for applications installed by a company via the Genuka platform. When a company installs your app, Genuka sends a callback with information such as
company_id, code, timestamp, hmac, and redirect_to.
How it works
- When your application is installed by a company, it receives a callback from Genuka containing
company_id,code,timestamp,hmac, andredirect_to. - Your application should use its
GENUKA_CLIENT_ID,GENUKA_CLIENT_SECRET,GENUKA_REDIRECT_URIalong with the endpointhttps://api.genuka.com/oauth/tokento exchange the code for an access token. - Store the company as a user in your database.
- Keep the access token private to ensure secure API requests on behalf of that company.
- Include the token in the
Authorizationheader for all subsequent requests.
Example: Using the Access Token
Common Authentication Errors
If authentication fails, Genuka returns clear error messages:| Error Scenario | HTTP Code | Message | Likely Cause |
|---|---|---|---|
| Missing API Key | 401 | "code": 401, "message": "API key is missing" | Authorization header not provided |
| Invalid or Revoked Key | 401 | "code": 401, "message": "Invalid API key" | Wrong or expired API key |
| Unauthorized Live Access | 403 | "code": 403, "message": "Sandbox key not allowed for live operation" | Using sandbox key for production request |
