Authentication
Authenticate Keymint API requests using Bearer tokens. Learn about API key scopes, rotation, and security standards.
Overview
All requests require your API key as a Bearer token:
Authorization: Bearer YOUR_API_KEYGetting Your API Key
Open Dashboard
Go to app.keymint.dev → Developer → API Keys.
Generate Key
Click Create key. Choose its scope (Client, Read-only or Admin), give it a name, then set product, IP and expiry restrictions.
Save Immediately
Copy your key now. It won't be shown again.
Scopes
API keys have one of three scopes:
| Scope | Access |
|---|---|
admin | Full read/write access to all resources |
client | Activation, optional first-time licensee claim, device-scoped deactivation, checkout, heartbeat, and checkin. Blocked from detailed key lookup and administrative operations |
read-only | View-only access (GET /key, GET /customer, GET /customer/by-id, GET /customer/keys) — cannot create, modify, or delete |
Use client keys for local SDK integrations or device activations where credentials must be bundled. Use read-only keys for detailed license lookups, dashboards, monitoring, or any context where mutations aren't needed.
A key can also carry an explicit list of permissions (for example license:read or license:sign). A key with a list is judged by that list on every scope, so a client key given license:read can call GET /key (the * wildcard still needs an admin key).
What each endpoint needs
| Endpoint | Scope (or permission) | Product-bound keys |
|---|---|---|
POST /key/activate, /key/deactivate, /key/checkout, /key/heartbeat, /key/checkin | client or admin (license:activate) | Only for their products |
GET /key | read-only or admin (license:read) | Only for their products |
POST /key, PATCH /key, POST /key/block, /key/unblock | admin (license:manage) | Only for their products |
DELETE /key | admin (license:delete; license:manage isn't enough) | Only for their products |
POST /key/sign | admin (license:sign) | Only for their products |
GET /customer, /customer/by-id, /customer/keys | read-only or admin (customer:read) | Refused |
POST /customer, PUT /customer/by-id, POST /customer/disable | admin (customer:write) | Refused |
DELETE /customer/by-id | admin (customer:delete) | Refused |
Product-bound keys
A key restricted to one or more products can only act on those products: a request for another product's license returns 401 api_key_invalid. Customer endpoints are workspace-wide and can't be narrowed to a product, so a product-bound key can't list, read, create, update, disable or delete customers; every customer endpoint answers it with 401 api_key_invalid. Use a key without a product restriction for customer management.
Usage Examples
curl https://api.keymint.dev/customer \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Error Responses
Every failure with a key returns the same response, so the API doesn't reveal whether a key exists or what it may do:
{
"message": "Invalid API key or insufficient permissions",
"code": 1,
"errorCode": "api_key_invalid"
}A request with no key at all gets errorCode: "api_key_missing".
| HTTP | errorCode | Cause |
|---|---|---|
401 | api_key_missing | No Authorization: Bearer header |
401 | api_key_invalid | The key is invalid, revoked or expired |
403 | api_key_no_workspace | The key isn't associated with a workspace |
401 | api_key_invalid | The key's scope doesn't allow this endpoint (for example a client key creating keys), or a product-bound key is used for another product |
403 / 401 | ip_not_allowed / api_key_invalid | The key has an IP allowlist and the request came from another address: 403 ip_not_allowed on license endpoints, the generic 401 api_key_invalid on customer endpoints and on requests that send an Idempotency-Key |
Once the API key is accepted, a license that can't be used gets one generic answer, so a key embedded in an app can't probe which licenses exist: activate, sign and checkout return 401 with errorCode: "license_invalid_or_forbidden", and heartbeat and checkin return 401 with errorCode: "session_invalid". API key problems on these endpoints still return api_key_missing or api_key_invalid. Every 401 carries a WWW-Authenticate: Bearer resource_metadata="…" header. See Error Codes.
Security Best Practices
Storage
Store admin and read-only keys in environment variables. Never commit them to source control or embed them in client-side code. Only client keys are intended for bundled runtime activation flows.
# .env
KEYMINT_API_KEY=your_api_key_hereLeast Privilege
- Use
read-onlykeys wherever possible - Create separate keys per service or environment
- Rotate keys every 90 days
- Revoke compromised keys immediately