TypicallySince you would store thewill be generating an API key for each user, you could do exactly like you suggest- which is essentially treating each token inlike you would a configuration file in your program or web applicationpassword. It's also good practice to encryptYou could store the portion ofid, the config file which contains sensitive information.
Note that you cannotsalt, and the hash of the credentials becausetoken in your database. Hashing is great as long as you never need to be able to decrypt themget the original key back to plain text so you can pass them on.
As a side note, ifNote that since this is something your applicationsystem is a websitegenerating, it isn't as important to hash it in the configuration file should not be publicly accessiblefirst place (apache/IIS/etc will prevent that based on the file typeunlike for a user generated password), so in theory, if. But this depends on your webthreat model. If someone hacks your server is secure, many people feelwould you care if they don't have to encrypt the sensitive portions of the config file. That being said, I almost always recommend it. It's pretty common for config files to be stored in source control which may have different levels of security access.
As for storing the token in the database, that is similar to the config file, in that your "file" is inhad a database. The same rules should apply. You could encrypt thelist of everyone's API key in the DB if you wish? If yes, but more importantly make sure that access to the DBthen hashing them is locked down as tight as possible, similar to how you would for locking down a config file on the web serverway to go.