Managing API keys
API keys are unique identifiers used for authentication, allowing users, developers, or programs to access APIs securely. They are essential for tracking and controlling API usage, helping to prevent abuse and ensure secure communication.
Using API keys to connect to Qlik Cloud APIs
You can use API keys to interact with the REST API reference on qlik.dev. Tools such as Postman or qlik-cli can be used for API access. For more information, see Overview of Qlik APIs and qlik-cli.
Example: Using Postman to connect to Qlik APIs
Do the following:
-
Start Postman.
-
Set the HTTP method to GET.
-
Enter the URL for the Qlik Cloud API endpoint.
For example, to list all spaces in the tenant:
https://your-tenant.eu.qlikcloud.com/api/v1/spaces
-
On the Auth tab, choose Bearer Token as the Auth Type.
-
Enter your API key in the Tokenfield.
-
Click Send.
If the request is successful, the API will return a JSON response. In this example, the response would include a list of spaces.
Enabling API keys in the tenant
By default, API key generation is disabled. Tenant administrators must enable API keys in the tenant to allow users to generate them.
Do the following:
- In the Administration activity center, go to Settings.
- Under API keys, select Enable API keys.
-
Adjust the following settings as needed:
-
Change maximum token expiration: Modify the expiration for newly generated tokens. Existing API keys will retain their original expiration value. There is no maximum limit for this value.
- Change maximum of active API keys per user: This limit applies only to new API keys. If the limit is reached, the creation of additional API keys will be denied. The maximum value you can set is 1000.
Information noteYou may need to refresh your browser to see the changes reflected in the API keys section on your user profile page. -
-
To start generating API keys, click Generate new. You will be redirected to the API keys section of your user profile.
Generating and managing API keys
Generating API keys
To generate new API keys, you must have the Developer role. Tenant admins can assign this role to users.
Do the following:
-
Click your user profile icon and select Profile settings.
-
Go to the API keys section and click Generate new key.
-
Provide a description and set an expiration time for the API key.
-
Click Generate to create the key.
-
Copy the generated API key and store it securely. Note that the key cannot be retrieved later.
Editing API keys
You can change the name of an API key after creation.
Deleting API keys
Do the following:
-
Click your user profile icon and select Profile settings.
-
Go to the API keys section.
-
Click next to the API key you want to delete and select Delete.
-
To remove all keys, click Delete all above the list of keys.
Monitoring and revoking API keys
You can view all API keys associated with your tenant in the API keys section of the Administration activity center. You can search for keys by name, ID, or owner.
API key statuses
API keys can have the following statuses:
- Active: The API key is currently in use.
- Expired: The expiry date has been reached.
- Revoked: The API key has been revoked and can no longer be used.
Revoking API keys
As a tenant administrator, actively monitoring API key activities is essential for maintaining security. If suspicious activities are detected, you can revoke the API key.
Do the following:
-
In the Administration activity center, go to Events.
-
Look for any suspicious activities, such as excessive usage of a particular API key.
-
Click next to the event to expand its details and copy the API key ID.
-
Go to the API keys section and search for the API key using its ID.
-
Click next to the key and select Revoke. You can only revoke keys with status Active.
-
To revoke multiple API keys, select them in the table and click Revoke in the upper-right corner.
Best practices for API key management
-
Keep keys confidential: Store API keys securely and avoid exposing them in public code repositories.
-
Regenerate regularly: Periodically regenerate your API keys to enhance security.
-
Monitor usage: Regularly check API key activities to identify any suspicious behavior.