Generate an API key
Maintainer:
When designing for the generation of API keys, ensure users know what the key is created for, the security implications, and the end destination of the key.
![Example of an API key being generated Example of an API key being generated](/static/fc0c0ba7e3a1ebc68eb6acdf3152a519/3cbba/1.png)
General access keys
Instant generation
Users click a primary Generate button. Consider displaying a Generating… state if the API key takes time to generate.
![Example of a generate button. Example of a generate button.](/static/c525c4e597996d854f05bee6e2603269/3cbba/2.png)
Once the API key is generated it displays in a modal. Include a Copy button.
![Example of a successfully created API key Example of a successfully created API key](/static/c9f47f3e34aaeb208d105a4c8dddfad8/3cbba/3.png)
Optionally:
- Display two parts to the API key where required
- Provide information text about the API key
- Allow users to toggle the visibility of the key
- Provide a secondary link to download the key
![Example of a hidden API key Example of a hidden API key](/static/bdfddf1f3ff9598547a503918585f775/3cbba/4.png)
Example of a hidden API key
![Example of a revealed API key Example of a revealed API key](/static/dbfaa322856c05fd3ec339449531edcb/3cbba/5.png)
Example of a revealed API key
Name the API key
You can ask a user to provide a descriptive name before the key is generated. This is particularly useful in instances where a user may have keys for several applications stored in the same location.
![Example of an API key with a custom name Example of an API key with a custom name](/static/d81a35a998c640be809d5b6b97083e4f/3cbba/6.png)
![Example of an API key destination selector Example of an API key destination selector](/static/7b985850d6c7a8473add7fce0c3c1fcb/3cbba/7.png)
Example of an API key destination selector
Restricted access keys
A user may want to limit the access an application or service is granted. Restricted access allows a user to assign specific access control and permissions before the API key is generated.
![Example of a restricted API key generation Example of a restricted API key generation](/static/61b49b13ad829b06c53a142225b2bd2d/1ec2b/8.png)