Authentication
The Heffl API uses API keys for authentication. Every request must include a valid API key.Getting your API key
- Go to Settings > Developer in your Heffl dashboard
- Click Create API Key
- Name your key to identify its purpose (e.g., “Website Forms”, “Data Sync”)
- Copy the API key immediately
Using your API key
Include the API key in thex-api-key header with every request:
JavaScript example
Python example
API key scope
API keys operate at the workspace level. A key has access to all data within the workspace it was created in, subject to the same data boundaries as the user who created it.Revoking API keys
To revoke an API key:- Go to Settings > Developer
- Find the key in the list
- Click Revoke
401 Unauthorized responses.
Security best practices
| Practice | Description |
|---|---|
| Use environment variables | Store API keys in env vars, never hardcode them |
| Separate keys per environment | Use different keys for development, staging, and production |
| Rotate periodically | Create new keys and revoke old ones on a regular schedule |
| Never expose client-side | API keys should only be used in server-side code |
| Audit usage | Review active keys and revoke any that are unused |
| Don’t commit to version control | Add .env files to .gitignore |
Troubleshooting
401 Unauthorized
- Verify the API key is included in the
x-api-keyheader (notAuthorization) - Check that the key hasn’t been revoked
- Ensure there are no extra spaces or line breaks in the key
403 Forbidden
- The API key is valid but doesn’t have access to the requested resource
- Check that the key was created in the correct workspace
FAQ
Can I use Bearer token authentication?
Can I use Bearer token authentication?
No. The Heffl API exclusively uses the
x-api-key header for authentication. Bearer tokens are used internally for the web app but are not available for API access.Do API keys expire?
Do API keys expire?
API keys do not expire automatically. They remain active until manually revoked.
Can I restrict an API key to specific endpoints?
Can I restrict an API key to specific endpoints?
Currently, API keys have access to all available API endpoints. Endpoint-level restrictions are not yet supported.